summaryrefslogtreecommitdiff
path: root/src/clparser.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/clparser.cc')
-rw-r--r--src/clparser.cc18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/clparser.cc b/src/clparser.cc
index f73a8c1..7994c06 100644
--- a/src/clparser.cc
+++ b/src/clparser.cc
@@ -18,8 +18,12 @@
#include <assert.h>
#include <string.h>
+#include "metrics.h"
+#include "string_piece_util.h"
+
#ifdef _WIN32
#include "includes_normalize.h"
+#include "string_piece.h"
#else
#include "util.h"
#endif
@@ -53,7 +57,7 @@ string CLParser::FilterShowIncludes(const string& line,
// static
bool CLParser::IsSystemInclude(string path) {
- transform(path.begin(), path.end(), path.begin(), ::tolower);
+ transform(path.begin(), path.end(), path.begin(), ToLowerASCII);
// 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);
@@ -61,7 +65,7 @@ bool CLParser::IsSystemInclude(string path) {
// static
bool CLParser::FilterInputFilename(string line) {
- transform(line.begin(), line.end(), line.begin(), ::tolower);
+ transform(line.begin(), line.end(), line.begin(), ToLowerASCII);
// TODO: other extensions, like .asm?
return EndsWith(line, ".c") ||
EndsWith(line, ".cc") ||
@@ -72,9 +76,15 @@ bool CLParser::FilterInputFilename(string line) {
// static
bool CLParser::Parse(const string& output, const string& deps_prefix,
string* filtered_output, string* err) {
+ METRIC_RECORD("CLParser::Parse");
+
// Loop over all lines in the output to process them.
assert(&output != filtered_output);
size_t start = 0;
+#ifdef _WIN32
+ IncludesNormalize normalizer(".");
+#endif
+
while (start < output.size()) {
size_t end = output.find_first_of("\r\n", start);
if (end == string::npos)
@@ -85,12 +95,12 @@ bool CLParser::Parse(const string& output, const string& deps_prefix,
if (!include.empty()) {
string normalized;
#ifdef _WIN32
- if (!IncludesNormalize::Normalize(include, NULL, &normalized, err))
+ if (!normalizer.Normalize(include, &normalized, err))
return false;
#else
// TODO: should this make the path relative to cwd?
normalized = include;
- unsigned int slash_bits;
+ uint64_t slash_bits;
if (!CanonicalizePath(&normalized, &slash_bits, err))
return false;
#endif