#ifdef _WIN32
if (deps_type == "msvc") {
CLParser parser;
- if (!parser.Parse(result->output, deps_prefix, &result->output, err))
+ string output;
+ if (!parser.Parse(result->output, deps_prefix, &output, err))
return false;
+ result->output = output;
for (set<string>::iterator i = parser.includes_.begin();
i != parser.includes_.end(); ++i) {
// ~0 is assuming that with MSVC-parsed headers, it's ok to always make
#include "msvc_helper.h"
#include <algorithm>
+#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <windows.h>
bool CLParser::Parse(const string& output, const string& deps_prefix,
string* filtered_output, string* err) {
// Loop over all lines in the output to process them.
+ assert(&output != filtered_output);
size_t start = 0;
while (start < output.size()) {
size_t end = output.find_first_of("\r\n", start);
/// Exposed for testing.
static bool FilterInputFilename(string line);
- /// Parse the full output of cl, returning the output (if any) that
- /// should printed. Returns true on success, or false with err filled.
+ /// Parse the full output of cl, filling filtered_output with the text that
+ /// should be printed (if any). Returns true on success, or false with err
+ /// filled. output must not be the same object as filtered_object.
bool Parse(const string& output, const string& deps_prefix,
string* filtered_output, string* err);