diff --git a/include/llvm/IR/Metadata.h b/include/llvm/IR/Metadata.h index a4e9f532980..36b1e063cb9 100644 --- a/include/llvm/IR/Metadata.h +++ b/include/llvm/IR/Metadata.h @@ -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) { diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp index 20e7ce63abf..5681a1e3608 100644 --- a/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -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; }