[clang-tools-extra] dabc901 - [clangd] Use starts_with instead of startswith in CompileCommands.cpp (NFC)

Jie Fu via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 12 00:18:56 PST 2024


Author: Jie Fu
Date: 2024-01-12T16:18:14+08:00
New Revision: dabc9018ee856dee672fb1035fd3eb1bb39bd7a6

URL: https://github.com/llvm/llvm-project/commit/dabc9018ee856dee672fb1035fd3eb1bb39bd7a6
DIFF: https://github.com/llvm/llvm-project/commit/dabc9018ee856dee672fb1035fd3eb1bb39bd7a6.diff

LOG: [clangd] Use starts_with instead of startswith in CompileCommands.cpp (NFC)

llvm-project/clang-tools-extra/clangd/CompileCommands.cpp:324:52:
 error: 'startswith' is deprecated: Use starts_with instead [-Werror,-Wdeprecated-declarations]
  324 |         Cmd, [&](llvm::StringRef Arg) { return Arg.startswith(Flag); });
      |                                                    ^~~~~~~~~~
      |                                                    starts_with

Added: 
    

Modified: 
    clang-tools-extra/clangd/CompileCommands.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/CompileCommands.cpp b/clang-tools-extra/clangd/CompileCommands.cpp
index 1b4b24d59cb83a..166f17e9b3f712 100644
--- a/clang-tools-extra/clangd/CompileCommands.cpp
+++ b/clang-tools-extra/clangd/CompileCommands.cpp
@@ -321,7 +321,7 @@ void CommandMangler::operator()(tooling::CompileCommand &Command,
   // Check whether the flag appears in the command as a prefix.
   auto HasPrefix = [&](llvm::StringRef Flag) {
     return llvm::any_of(
-        Cmd, [&](llvm::StringRef Arg) { return Arg.startswith(Flag); });
+        Cmd, [&](llvm::StringRef Arg) { return Arg.starts_with(Flag); });
   };
 
   llvm::erase_if(Cmd, [](llvm::StringRef Elem) {


        


More information about the cfe-commits mailing list