[clangd] Remove const_cast. NFC
authorSam McCall <sam.mccall@gmail.com>
Mon, 13 Jul 2020 18:44:03 +0000 (20:44 +0200)
committerSam McCall <sam.mccall@gmail.com>
Mon, 13 Jul 2020 18:44:11 +0000 (20:44 +0200)
clang-tools-extra/clangd/CompileCommands.cpp
clang-tools-extra/clangd/Config.h

index 0b27e0e..4b69555 100644 (file)
@@ -183,8 +183,7 @@ CommandMangler CommandMangler::forTests() {
 }
 
 void CommandMangler::adjust(std::vector<std::string> &Cmd) const {
-  // FIXME: remove const_cast once unique_function is const-compatible.
-  for (auto &Edit : const_cast<Config &>(Config::current()).CompileFlags.Edits)
+  for (auto &Edit : Config::current().CompileFlags.Edits)
     Edit(Cmd);
 
   // Check whether the flag exists, either as -flag or -flag=*
index 878c9e8..d2c3ef3 100644 (file)
@@ -52,8 +52,8 @@ struct Config {
   /// Controls how the compile command for the current file is determined.
   struct {
     // Edits to apply to the compile command, in sequence.
-    // FIXME: these functions need to be const-callable. For now, const_cast.
-    std::vector<llvm::unique_function<void(std::vector<std::string> &)>> Edits;
+    std::vector<llvm::unique_function<void(std::vector<std::string> &) const>>
+        Edits;
   } CompileFlags;
 };