summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2021-06-28 10:58:36 -0400
committerGitHub <noreply@github.com>2021-06-28 10:58:36 -0400
commitc8f8f2a9e3016ab7a9ecb2e8b084cf441f3ae88e (patch)
treed234b6f38dcc1eea40b5ba918500318f057da9db
parentd68f107f7a80d552d764c8cd0545955be02debe2 (diff)
parentc7b2cf60f4c07440728307c0e68f99c464ac7f7b (diff)
downloadninja-c8f8f2a9e3016ab7a9ecb2e8b084cf441f3ae88e.tar.gz
Merge pull request #1991 from zmodem/filter_filenames_less
CLParser: Don't filter filename lines after seeing /showIncludes
-rw-r--r--src/clparser.cc4
-rw-r--r--src/clparser_test.cc11
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;