Author: Sam McCall Date: 2020-07-13T20:44:11+02:00 New Revision: 9d3e9a3e3c10cf7ff961df8e107c7cb0e1bc447c
URL: https://github.com/llvm/llvm-project/commit/9d3e9a3e3c10cf7ff961df8e107c7cb0e1bc447c DIFF: https://github.com/llvm/llvm-project/commit/9d3e9a3e3c10cf7ff961df8e107c7cb0e1bc447c.diff LOG: [clangd] Remove const_cast. NFC Added: Modified: clang-tools-extra/clangd/CompileCommands.cpp clang-tools-extra/clangd/Config.h Removed: ################################################################################ diff --git a/clang-tools-extra/clangd/CompileCommands.cpp b/clang-tools-extra/clangd/CompileCommands.cpp index 0b27e0e3e828..4b6955576942 100644 --- a/clang-tools-extra/clangd/CompileCommands.cpp +++ b/clang-tools-extra/clangd/CompileCommands.cpp @@ -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=* diff --git a/clang-tools-extra/clangd/Config.h b/clang-tools-extra/clangd/Config.h index 878c9e8549b5..d2c3ef37abd5 100644 --- a/clang-tools-extra/clangd/Config.h +++ b/clang-tools-extra/clangd/Config.h @@ -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; }; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits