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

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


> On 2014-Nov-13, at 16:07, David Blaikie <dblaikie at gmail.com> wrote:
> 
> 
> 
> On Thu, Nov 13, 2014 at 3:59 PM, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:
> 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(); }
> 
> 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)
>  

It's still in use internally in the class for now.





More information about the llvm-commits mailing list