<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 13, 2014 at 3:59 PM, Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: dexonsmith<br>
Date: Thu Nov 13 17:59:16 2014<br>
New Revision: 221951<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=221951&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=221951&view=rev</a><br>
Log:<br>
IR: Make MDString::getName() private<br>
<br>
Hide the fact that `MDString`'s string is stored in `Value::Name` --<br>
that's going to change soon. Update the only in-tree client that was<br>
using it instead of `Value::getString()`.<br>
<br>
Part of PR21532.<br>
<br>
Modified:<br>
llvm/trunk/include/llvm/IR/Metadata.h<br>
llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp<br>
<br>
Modified: llvm/trunk/include/llvm/IR/Metadata.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Metadata.h?rev=221951&r1=221950&r2=221951&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Metadata.h?rev=221951&r1=221950&r2=221951&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/IR/Metadata.h (original)<br>
+++ llvm/trunk/include/llvm/IR/Metadata.h Thu Nov 13 17:59:16 2014<br>
@@ -61,6 +61,11 @@ class MDString : public Value {<br>
MDString(const MDString &) LLVM_DELETED_FUNCTION;<br>
<br>
explicit MDString(LLVMContext &C);<br>
+<br>
+private:<br>
+ /// \brief Shadow Value::getName() to prevent its use.<br>
+ StringRef getName() const { return Value::getName(); }<br></blockquote><div><br></div><div>You could just delete it (LLVM_DELETED_FUNCTION) rather than giving it an implementation you don't want anyone to use. (compiler error on modern compilers, linker error otherwise if anyone tries to call it)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
public:<br>
static MDString *get(LLVMContext &Context, StringRef Str);<br>
static MDString *get(LLVMContext &Context, const char *Str) {<br>
<br>
Modified: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=221951&r1=221950&r2=221951&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=221951&r1=221950&r2=221951&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp Thu Nov 13 17:59:16 2014<br>
@@ -1159,7 +1159,7 @@ private:<br>
return false;<br>
<br>
for (auto H : HintTypes)<br>
- if (Name->getName().endswith(H.Name))<br>
+ if (Name->getString().endswith(H.Name))<br>
return true;<br>
return false;<br>
}<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>