Commit 9b2173c4 authored by lhchavez's avatar lhchavez Committed by Commit bot

Make build/include_what_you_use more consistent

This is a cherry-pick of https://github.com/google/styleguide/pull/158/

BUG=627202
TEST=cpplint_unittest.py

Review-Url: https://codereview.chromium.org/2147593002
parent d5c7b7ad
......@@ -5415,8 +5415,13 @@ def CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error,
continue
for pattern, template, header in _re_pattern_templates:
if pattern.search(line):
required[header] = (linenum, template)
matched = pattern.search(line)
if matched:
# Don't warn about IWYU in non-STL namespaces:
# (We check only the first match per line; good enough.)
prefix = line[:matched.start()]
if prefix.endswith('std::') or not prefix.endswith('::'):
required[header] = (linenum, template)
# The policy is that if you #include something in foo.h you don't need to
# include it again in foo.cc. Here, we will look at possible includes.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment