[llvm] 80f38fb - [clang] [NFC] Deduplicate the logic between StringMapEntry.first() and StringMapEntry.getKey() (#113735)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 28 09:10:11 PDT 2024


Author: Boaz Brickner
Date: 2024-10-28T09:10:07-07:00
New Revision: 80f38fbdcfa96316908bb4ac3481d9eac6abf60e

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

LOG: [clang] [NFC] Deduplicate the logic between StringMapEntry.first() and StringMapEntry.getKey() (#113735)

Added: 
    

Modified: 
    llvm/include/llvm/ADT/StringMapEntry.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/StringMapEntry.h b/llvm/include/llvm/ADT/StringMapEntry.h
index 98b51cc1aebd59..d93af5aedc39d7 100644
--- a/llvm/include/llvm/ADT/StringMapEntry.h
+++ b/llvm/include/llvm/ADT/StringMapEntry.h
@@ -116,9 +116,7 @@ class StringMapEntry final : public StringMapEntryStorage<ValueTy> {
     return reinterpret_cast<const char *>(this + 1);
   }
 
-  StringRef first() const {
-    return StringRef(getKeyData(), this->getKeyLength());
-  }
+  StringRef first() const { return getKey(); }
 
   /// Create a StringMapEntry for the specified key construct the value using
   /// \p InitiVals.


        


More information about the llvm-commits mailing list