[PATCH] D34947: [clangd] Add support for per-file extra flags

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 4 04:22:53 PDT 2017


ilya-biryukov added inline comments.


================
Comment at: clangd/GlobalCompilationDatabase.cpp:22
+    return;
+  if (Command.CommandLine.empty())
+    Command.CommandLine.push_back("clang");
----------------
If `Command.CommandLine.empty()` is true, extra flags will be added **before** 'clang' in the command-line.
Maybe restore `assert(Command.CommandLine.size() >= 2)` (i.e. at least a compiler binary and input file should be in the commandline) and remove this if?


================
Comment at: clangd/GlobalCompilationDatabase.cpp:60
+    PathRef File, std::vector<std::string> ExtraFlags) {
+  ExtraFlagsForFile[File] = ExtraFlags;
 }
----------------
Maybe `std::move` the vector before assignment to avoid copying?


https://reviews.llvm.org/D34947





More information about the cfe-commits mailing list