[llvm] a0b459d - [IR] Use StringRef::consume_front (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 22 21:19:25 PST 2024


Author: Kazu Hirata
Date: 2024-01-22T21:19:13-08:00
New Revision: a0b459df256e8d16cade7f38a6fdaf2e763c847f

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

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

Added: 
    

Modified: 
    llvm/include/llvm/IR/GlobalValue.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/GlobalValue.h b/llvm/include/llvm/IR/GlobalValue.h
index e97a7f2b963606..aa8188cd99fee1 100644
--- a/llvm/include/llvm/IR/GlobalValue.h
+++ b/llvm/include/llvm/IR/GlobalValue.h
@@ -564,8 +564,7 @@ class GlobalValue : public Constant {
   /// arbitrary GlobalValue, this is not the function you're looking for; see
   /// Mangler.h.
   static StringRef dropLLVMManglingEscape(StringRef Name) {
-    if (!Name.empty() && Name[0] == '\1')
-      return Name.substr(1);
+    Name.consume_front("\1");
     return Name;
   }
 


        


More information about the llvm-commits mailing list