[llvm] r221951 - IR: Make MDString::getName() private

Duncan P. N. Exon Smith dexonsmith at apple.com
Thu Nov 13 15:59:16 PST 2014


Author: dexonsmith
Date: Thu Nov 13 17:59:16 2014
New Revision: 221951

URL: http://llvm.org/viewvc/llvm-project?rev=221951&view=rev
Log:
IR: Make MDString::getName() private

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.

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

Modified: llvm/trunk/include/llvm/IR/Metadata.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Metadata.h?rev=221951&r1=221950&r2=221951&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Metadata.h (original)
+++ llvm/trunk/include/llvm/IR/Metadata.h Thu Nov 13 17:59:16 2014
@@ -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) {

Modified: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=221951&r1=221950&r2=221951&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp Thu Nov 13 17:59:16 2014
@@ -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;
   }





More information about the llvm-commits mailing list