OSDN Git Service

constify GlobalValue::getGUID() and GlobalValue::getGlobalIdentifier() (NFC)
authorMehdi Amini <mehdi.amini@apple.com>
Sat, 2 Apr 2016 05:25:27 +0000 (05:25 +0000)
committerMehdi Amini <mehdi.amini@apple.com>
Sat, 2 Apr 2016 05:25:27 +0000 (05:25 +0000)
From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265217 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/GlobalValue.h
lib/IR/Globals.cpp

index 987d748..964d509 100644 (file)
@@ -318,7 +318,7 @@ public:
 
   /// Return the modified name for this global value suitable to be
   /// used as the key for a global lookup (e.g. profile or ThinLTO).
-  std::string getGlobalIdentifier();
+  std::string getGlobalIdentifier() const;
 
   /// Declare a type to represent a global unique identifier for a global value.
   /// This is a 64 bits hash that is used by PGO and ThinLTO to have a compact
@@ -331,7 +331,7 @@ public:
 
   /// Return a 64-bit global unique ID constructed from global value name
   /// (i.e. returned by getGlobalIdentifier()).
-  GUID getGUID() { return getGUID(getGlobalIdentifier()); }
+  GUID getGUID() const { return getGUID(getGlobalIdentifier()); }
 
   /// @name Materialization
   /// Materialization is used to construct functions only as they're needed.
index 47827fb..bf86db2 100644 (file)
@@ -123,7 +123,7 @@ std::string GlobalValue::getGlobalIdentifier(StringRef Name,
   return NewName;
 }
 
-std::string GlobalValue::getGlobalIdentifier() {
+std::string GlobalValue::getGlobalIdentifier() const {
   return getGlobalIdentifier(getName(), getLinkage(),
                              getParent()->getSourceFileName());
 }