[llvm] [clang] Deduplicate the logic between StringMapEntry.first() and StringMapEntry.getKey() (PR #113735)

Boaz Brickner via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 25 13:05:54 PDT 2024


https://github.com/bricknerb created https://github.com/llvm/llvm-project/pull/113735

Zero behavior diff.

>From cf1ff225026cce406fb54f6e11514dcf61ca8def Mon Sep 17 00:00:00 2001
From: Boaz Brickner <brickner at google.com>
Date: Fri, 25 Oct 2024 21:48:08 +0200
Subject: [PATCH] [clang] Deduplicate the logic between StringMapEntry.first()
 and StringMapEntry.getKey().

---
 llvm/include/llvm/ADT/StringMapEntry.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/include/llvm/ADT/StringMapEntry.h b/llvm/include/llvm/ADT/StringMapEntry.h
index 98b51cc1aebd59..a3ff2415869be6 100644
--- a/llvm/include/llvm/ADT/StringMapEntry.h
+++ b/llvm/include/llvm/ADT/StringMapEntry.h
@@ -117,7 +117,7 @@ class StringMapEntry final : public StringMapEntryStorage<ValueTy> {
   }
 
   StringRef first() const {
-    return StringRef(getKeyData(), this->getKeyLength());
+    return getKey();
   }
 
   /// Create a StringMapEntry for the specified key construct the value using



More information about the llvm-commits mailing list