diff options
author | Peter Kümmel <kuemmel@coffeelogic.de> | 2013-10-13 10:20:17 (GMT) |
---|---|---|
committer | Peter Kümmel <syntheticpp@gmx.net> | 2013-10-18 23:25:47 (GMT) |
commit | 037b0934f929ba17434906fb781aeb1acb583385 (patch) | |
tree | f426231b651860a2ddc382d2c1ff842cdeab95d0 /src/msvc_helper-win32.cc | |
parent | 6f7ea464bb9161ce2e15deb97977886de152c12d (diff) | |
download | Ninja-037b0934f929ba17434906fb781aeb1acb583385.zip Ninja-037b0934f929ba17434906fb781aeb1acb583385.tar.gz Ninja-037b0934f929ba17434906fb781aeb1acb583385.tar.bz2 |
add deps_prefix for localized /showIncludes' output parsing
Diffstat (limited to 'src/msvc_helper-win32.cc')
-rw-r--r-- | src/msvc_helper-win32.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/msvc_helper-win32.cc b/src/msvc_helper-win32.cc index 7c45029..3065ab0 100644 --- a/src/msvc_helper-win32.cc +++ b/src/msvc_helper-win32.cc @@ -48,14 +48,13 @@ string EscapeForDepfile(const string& path) { } // static -string CLParser::FilterShowIncludes(const string& line) { - static const char kMagicPrefix[] = "Note: including file: "; +string CLParser::FilterShowIncludes(const string& line, const string& deps_prefix) { + static const string deps_prefix_english = "Note: including file: "; const char* in = line.c_str(); const char* end = in + line.size(); - - if (end - in > (int)sizeof(kMagicPrefix) - 1 && - memcmp(in, kMagicPrefix, sizeof(kMagicPrefix) - 1) == 0) { - in += sizeof(kMagicPrefix) - 1; + const string& prefix = deps_prefix.empty() ? deps_prefix_english : deps_prefix; + if (end - in > (int)prefix.size() && memcmp(in, prefix.c_str(), (int)prefix.size()) == 0) { + in += prefix.size(); while (*in == ' ') ++in; return line.substr(in - line.c_str()); @@ -81,7 +80,7 @@ bool CLParser::FilterInputFilename(string line) { EndsWith(line, ".cpp"); } -string CLParser::Parse(const string& output) { +string CLParser::Parse(const string& output, const string& deps_prefix) { string filtered_output; // Loop over all lines in the output to process them. @@ -92,7 +91,7 @@ string CLParser::Parse(const string& output) { end = output.size(); string line = output.substr(start, end - start); - string include = FilterShowIncludes(line); + string include = FilterShowIncludes(line, deps_prefix); if (!include.empty()) { include = IncludesNormalize::Normalize(include, NULL); if (!IsSystemInclude(include)) |