[llvm] 01c5b5c - [ObjCopy] Use StringRef::consume_front (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 19 18:54:18 PST 2024


Author: Kazu Hirata
Date: 2024-01-19T18:54:06-08:00
New Revision: 01c5b5c1040ac8ee95d7a07d84546750a4e9e1c3

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

LOG: [ObjCopy] Use StringRef::consume_front (NFC)

Added: 
    

Modified: 
    llvm/lib/ObjCopy/CommonConfig.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ObjCopy/CommonConfig.cpp b/llvm/lib/ObjCopy/CommonConfig.cpp
index f44e70d996b2e1..ff3cb4d44c126e 100644
--- a/llvm/lib/ObjCopy/CommonConfig.cpp
+++ b/llvm/lib/ObjCopy/CommonConfig.cpp
@@ -20,11 +20,7 @@ NameOrPattern::create(StringRef Pattern, MatchStyle MS,
     return NameOrPattern(Pattern);
   case MatchStyle::Wildcard: {
     SmallVector<char, 32> Data;
-    bool IsPositiveMatch = true;
-    if (Pattern[0] == '!') {
-      IsPositiveMatch = false;
-      Pattern = Pattern.drop_front();
-    }
+    bool IsPositiveMatch = !Pattern.consume_front("!");
     Expected<GlobPattern> GlobOrErr = GlobPattern::create(Pattern);
 
     // If we couldn't create it as a glob, report the error, but try again


        


More information about the llvm-commits mailing list