diff options
author | Evan Martin <martine@danga.com> | 2012-08-12 23:29:43 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2012-08-12 23:29:43 (GMT) |
commit | 449b62075c81431c58ab9fef0054d61513d9d656 (patch) | |
tree | 2fba32069a42caa65a8d00112ea461a7d129a5fe /src/msvc_helper-win32.cc | |
parent | de3f570cfe0bfdd564913a1431dc95fd17ff44eb (diff) | |
download | Ninja-449b62075c81431c58ab9fef0054d61513d9d656.zip Ninja-449b62075c81431c58ab9fef0054d61513d9d656.tar.gz Ninja-449b62075c81431c58ab9fef0054d61513d9d656.tar.bz2 |
msvc helper: drop system includes
Drop any #includes that look like they're referencing system headers.
This reduces the dependency information considerably.
Diffstat (limited to 'src/msvc_helper-win32.cc')
-rw-r--r-- | src/msvc_helper-win32.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/msvc_helper-win32.cc b/src/msvc_helper-win32.cc index f6b2a22..624bc2d 100644 --- a/src/msvc_helper-win32.cc +++ b/src/msvc_helper-win32.cc @@ -17,6 +17,7 @@ #include <string.h> #include <windows.h> +#include "includes_normalize.h" #include "util.h" namespace { @@ -46,6 +47,13 @@ string CLWrapper::FilterShowIncludes(const string& line) { } // static +bool CLWrapper::IsSystemInclude(const string& path) { + // TODO: this is a heuristic, perhaps there's a better way? + return (path.find("program files") != string::npos || + path.find("microsoft visual studio") != string::npos); +} + +// static bool CLWrapper::FilterInputFilename(const string& line) { // TODO: other extensions, like .asm? return EndsWith(line, ".c") || @@ -115,7 +123,9 @@ int CLWrapper::Run(const string& command, string* extra_output) { string include = FilterShowIncludes(line); if (!include.empty()) { - includes_.push_back(include); + include = IncludesNormalize::Normalize(include, NULL); + if (!IsSystemInclude(include)) + includes_.push_back(include); } else if (FilterInputFilename(line)) { // Drop it. // TODO: if we support compiling multiple output files in a single |