diff options
author | Nico Weber <thakis@chromium.org> | 2021-06-28 14:58:36 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-28 14:58:36 (GMT) |
commit | c8f8f2a9e3016ab7a9ecb2e8b084cf441f3ae88e (patch) | |
tree | d234b6f38dcc1eea40b5ba918500318f057da9db | |
parent | d68f107f7a80d552d764c8cd0545955be02debe2 (diff) | |
parent | c7b2cf60f4c07440728307c0e68f99c464ac7f7b (diff) | |
download | Ninja-c8f8f2a9e3016ab7a9ecb2e8b084cf441f3ae88e.zip Ninja-c8f8f2a9e3016ab7a9ecb2e8b084cf441f3ae88e.tar.gz Ninja-c8f8f2a9e3016ab7a9ecb2e8b084cf441f3ae88e.tar.bz2 |
Merge pull request #1991 from zmodem/filter_filenames_less
CLParser: Don't filter filename lines after seeing /showIncludes
-rw-r--r-- | src/clparser.cc | 4 | ||||
-rw-r--r-- | src/clparser_test.cc | 11 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/clparser.cc b/src/clparser.cc index 40e9407..070bcfd 100644 --- a/src/clparser.cc +++ b/src/clparser.cc @@ -83,6 +83,7 @@ bool CLParser::Parse(const string& output, const string& deps_prefix, // Loop over all lines in the output to process them. assert(&output != filtered_output); size_t start = 0; + bool seen_show_includes = false; #ifdef _WIN32 IncludesNormalize normalizer("."); #endif @@ -95,6 +96,7 @@ bool CLParser::Parse(const string& output, const string& deps_prefix, string include = FilterShowIncludes(line, deps_prefix); if (!include.empty()) { + seen_show_includes = true; string normalized; #ifdef _WIN32 if (!normalizer.Normalize(include, &normalized, err)) @@ -107,7 +109,7 @@ bool CLParser::Parse(const string& output, const string& deps_prefix, #endif if (!IsSystemInclude(normalized)) includes_.insert(normalized); - } else if (FilterInputFilename(line)) { + } else if (!seen_show_includes && FilterInputFilename(line)) { // Drop it. // TODO: if we support compiling multiple output files in a single // cl.exe invocation, we should stash the filename. diff --git a/src/clparser_test.cc b/src/clparser_test.cc index 0b829c1..f141680 100644 --- a/src/clparser_test.cc +++ b/src/clparser_test.cc @@ -70,6 +70,17 @@ TEST(CLParserTest, ParseFilenameFilter) { ASSERT_EQ("cl: warning\n", output); } +TEST(CLParserTest, NoFilenameFilterAfterShowIncludes) { + CLParser parser; + string output, err; + ASSERT_TRUE(parser.Parse( + "foo.cc\r\n" + "Note: including file: foo.h\r\n" + "something something foo.cc\r\n", + "", &output, &err)); + ASSERT_EQ("something something foo.cc\n", output); +} + TEST(CLParserTest, ParseSystemInclude) { CLParser parser; string output, err; |