[clang] 8c296d5 - [Interpreter] Fix warnings

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 19 12:57:18 PST 2023


Author: Kazu Hirata
Date: 2023-12-19T12:57:10-08:00
New Revision: 8c296d58c50902e367f64417948d6e2d43828f36

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

LOG: [Interpreter] Fix warnings

This patch fixes:

  clang/lib/Interpreter/CodeCompletion.cpp:126:35: error: 'startswith'
  is deprecated: Use starts_with instead
  [-Werror,-Wdeprecated-declarations]

  clang/lib/Interpreter/CodeCompletion.cpp:189:42: error: 'startswith'
  is deprecated: Use starts_with instead
  [-Werror,-Wdeprecated-declarations]

Added: 
    

Modified: 
    clang/lib/Interpreter/CodeCompletion.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Interpreter/CodeCompletion.cpp b/clang/lib/Interpreter/CodeCompletion.cpp
index a9789355b2c5f3..25183ae9eeb99e 100644
--- a/clang/lib/Interpreter/CodeCompletion.cpp
+++ b/clang/lib/Interpreter/CodeCompletion.cpp
@@ -123,7 +123,7 @@ class CompletionContextHandler {
     // situation.
     if (!CCC.getBaseType().isNull() || !CCC.getPreferredType().isNull())
       return;
-    if (StringRef(Result.Keyword).startswith(Prefix))
+    if (StringRef(Result.Keyword).starts_with(Prefix))
       Results.push_back(Result.Keyword);
   }
 
@@ -186,7 +186,7 @@ void ReplCompletionConsumer::ProcessCodeCompleteResults(
         break;
       }
       if (!Result.Declaration->getDeclName().isIdentifier() ||
-          !Result.Declaration->getName().startswith(Prefix)) {
+          !Result.Declaration->getName().starts_with(Prefix)) {
         break;
       }
       CCH->handleDeclaration(Result);


        


More information about the cfe-commits mailing list