IR: Make MDString::getName() private
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 13 Nov 2014 23:59:16 +0000 (23:59 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 13 Nov 2014 23:59:16 +0000 (23:59 +0000)
Hide the fact that `MDString`'s string is stored in `Value::Name` --
that's going to change soon.  Update the only in-tree client that was
using it instead of `Value::getString()`.

Part of PR21532.

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

include/llvm/IR/Metadata.h
lib/Transforms/Vectorize/LoopVectorize.cpp

index a4e9f5329809c4f57135bc29d56646aa558fd247..36b1e063cb9ef820ae31ea9035317832676738b8 100644 (file)
@@ -61,6 +61,11 @@ class MDString : public Value {
   MDString(const MDString &) LLVM_DELETED_FUNCTION;
 
   explicit MDString(LLVMContext &C);
+
+private:
+  /// \brief Shadow Value::getName() to prevent its use.
+  StringRef getName() const { return Value::getName(); }
+
 public:
   static MDString *get(LLVMContext &Context, StringRef Str);
   static MDString *get(LLVMContext &Context, const char *Str) {
index 20e7ce63abf712060f8ebd1cf2239a83246efd4d..5681a1e36081c69132fca7548459c56e7ed373fa 100644 (file)
@@ -1159,7 +1159,7 @@ private:
       return false;
 
     for (auto H : HintTypes)
-      if (Name->getName().endswith(H.Name))
+      if (Name->getString().endswith(H.Name))
         return true;
     return false;
   }