From f4742f4c8437e24cb6f9486e2f1685d1513180e9 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Thu, 13 Nov 2014 23:59:16 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221951 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/IR/Metadata.h | 5 +++++ lib/Transforms/Vectorize/LoopVectorize.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) 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; }