[clang] c7cdf3c - [clang] Use 'starts_with' instead of 'startswith' in Gnu.cpp (NFC)

Jie Fu via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 18 00:10:59 PST 2023


Author: Jie Fu
Date: 2023-12-18T16:10:49+08:00
New Revision: c7cdf3cd5d748901e1370f1bfe803685ca658fb6

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

LOG: [clang] Use 'starts_with' instead of 'startswith' in Gnu.cpp (NFC)

llvm-project/clang/lib/Driver/ToolChains/Gnu.cpp:1757:14:
 error: 'startswith' is deprecated: Use starts_with instead [-Werror,-Wdeprecated-declarations]
 1757 |     if (Flag.startswith("!march=") || Flag.startswith("-march="))
      |              ^~~~~~~~~~
      |              starts_with

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Gnu.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index 02228e19dcf2ea..7f463ddd17d3d6 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -1754,7 +1754,7 @@ selectRISCVMultilib(const MultilibSet &RISCVMultilibSet, StringRef Arch,
 
   // Collect all flags except march=*
   for (StringRef Flag : Flags) {
-    if (Flag.startswith("!march=") || Flag.startswith("-march="))
+    if (Flag.starts_with("!march=") || Flag.starts_with("-march="))
       continue;
 
     NewFlags.push_back(Flag.str());


        


More information about the cfe-commits mailing list