Fix performance regression in loading compile_commands.json

Regression was caused by accidental copying.
This commit is contained in:
Jacob Dufault 2017-10-24 19:00:29 -07:00
parent 738b338d47
commit ccff74a79c

View File

@ -30,9 +30,10 @@ namespace {
bool g_disable_normalize_path_for_test = false;
std::string NormalizePathWithTestOptOut(const std::string& path) {
if (g_disable_normalize_path_for_test)
return "&" +
path; // Add a & so we can test to verify a path is normalized.
if (g_disable_normalize_path_for_test) {
// Add a & so we can test to verify a path is normalized.
return "&" + path;
}
return NormalizePath(path);
}
@ -122,7 +123,7 @@ Project::Entry GetCompilationEntryFromCompileCommandEntry(
continue;
}
auto cleanup_maybe_relative_path = [entry](const std::string& path) {
auto cleanup_maybe_relative_path = [&](const std::string& path) {
assert(!path.empty());
if (path[0] == '/')
return NormalizePathWithTestOptOut(path);