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

David Blaikie dblaikie at gmail.com
Thu Nov 13 16:07:08 PST 2014


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)


> +
>  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;
>    }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141113/cca3a3fe/attachment.html>


More information about the llvm-commits mailing list