diff options
Diffstat (limited to 'src/msvc_helper-win32.cc')
-rw-r--r-- | src/msvc_helper-win32.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/msvc_helper-win32.cc b/src/msvc_helper-win32.cc index ac957e4..f6b2a22 100644 --- a/src/msvc_helper-win32.cc +++ b/src/msvc_helper-win32.cc @@ -19,6 +19,16 @@ #include "util.h" +namespace { + +/// Return true if \a input ends with \a needle. +bool EndsWith(const string& input, const string& needle) { + return (input.size() >= needle.size() && + input.substr(input.size() - needle.size()) == needle); +} + +} // anonymous namespace + // static string CLWrapper::FilterShowIncludes(const string& line) { static const char kMagicPrefix[] = "Note: including file: "; @@ -35,6 +45,15 @@ string CLWrapper::FilterShowIncludes(const string& line) { return ""; } +// static +bool CLWrapper::FilterInputFilename(const string& line) { + // TODO: other extensions, like .asm? + return EndsWith(line, ".c") || + EndsWith(line, ".cc") || + EndsWith(line, ".cxx") || + EndsWith(line, ".cpp"); +} + int CLWrapper::Run(const string& command, string* extra_output) { SECURITY_ATTRIBUTES security_attributes = {}; security_attributes.nLength = sizeof(SECURITY_ATTRIBUTES); @@ -97,6 +116,10 @@ int CLWrapper::Run(const string& command, string* extra_output) { string include = FilterShowIncludes(line); if (!include.empty()) { includes_.push_back(include); + } else if (FilterInputFilename(line)) { + // Drop it. + // TODO: if we support compiling multiple output files in a single + // cl.exe invocation, we should stash the filename. } else { if (extra_output) { extra_output->append(line); |