diff --git a/src/project.cc b/src/project.cc index 2bf8c4f7..00518ddf 100644 --- a/src/project.cc +++ b/src/project.cc @@ -52,10 +52,15 @@ static std::vector kBlacklistMulti = { // Blacklisted flags which are always removed from the command line. static std::vector kBlacklist = { - "-c", "-MP", "-MD", "-MMD", "--fcolor-diagnostics", + "-c", + "-MP", + "-MD", + "-MMD", + "--fcolor-diagnostics", // This strips path-like args but is a bit hacky. - "/", "..", + "/", + "..", }; // Arguments which are followed by a potentially relative path. We need to make @@ -207,7 +212,9 @@ std::vector LoadFromDirectoryListing(ProjectConfig* config) { std::vector args; std::cerr << "Using arguments: "; - for (const std::string& line : ReadLines(config->project_dir + "/.cquery")) { + for (std::string line : + ReadLinesWithEnding(config->project_dir + "/.cquery")) { + Trim(line); if (line.empty() || StartsWith(line, "#")) continue; if (!args.empty()) diff --git a/src/utils.cc b/src/utils.cc index 0c8d2d2e..c568d8a0 100644 --- a/src/utils.cc +++ b/src/utils.cc @@ -245,7 +245,7 @@ optional ReadContent(const std::string& filename) { } } -std::vector ReadLines(std::string filename) { +std::vector ReadLinesWithEnding(std::string filename) { std::vector result; std::ifstream input(filename); @@ -296,7 +296,7 @@ std::unordered_map ParseTestExpectation( std::string active_output_filename; std::string active_output_contents; - for (std::string line_with_ending : ReadLines(filename)) { + for (std::string line_with_ending : ReadLinesWithEnding(filename)) { if (StartsWith(line_with_ending, "*/")) break; diff --git a/src/utils.h b/src/utils.h index a15575d9..0a4a8198 100644 --- a/src/utils.h +++ b/src/utils.h @@ -74,7 +74,7 @@ void EnsureEndsInSlash(std::string& path); std::string EscapeFileName(std::string path); optional ReadContent(const std::string& filename); -std::vector ReadLines(std::string filename); +std::vector ReadLinesWithEnding(std::string filename); std::vector ToLines(const std::string& content, bool trim_whitespace);