[llvm-commits] [llvm] r84811 - in /llvm/trunk: include/llvm/Metadata.h lib/VMCore/Metadata.cpp

Devang Patel dpatel at apple.com
Wed Oct 21 17:22:06 PDT 2009


Author: dpatel
Date: Wed Oct 21 19:22:05 2009
New Revision: 84811

URL: http://llvm.org/viewvc/llvm-project?rev=84811&view=rev
Log:
Use StringRef to construct MDString.

Modified:
    llvm/trunk/include/llvm/Metadata.h
    llvm/trunk/lib/VMCore/Metadata.cpp

Modified: llvm/trunk/include/llvm/Metadata.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Metadata.h?rev=84811&r1=84810&r2=84811&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Metadata.h (original)
+++ llvm/trunk/include/llvm/Metadata.h Wed Oct 21 19:22:05 2009
@@ -57,8 +57,8 @@
 
   StringRef Str;
 protected:
-  explicit MDString(LLVMContext &C, const char *begin, unsigned l)
-    : MetadataBase(Type::getMetadataTy(C), Value::MDStringVal), Str(begin, l) {}
+  explicit MDString(LLVMContext &C, StringRef S)
+    : MetadataBase(Type::getMetadataTy(C), Value::MDStringVal), Str(S) {}
 
 public:
   static MDString *get(LLVMContext &Context, StringRef Str);

Modified: llvm/trunk/lib/VMCore/Metadata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Metadata.cpp?rev=84811&r1=84810&r2=84811&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Metadata.cpp (original)
+++ llvm/trunk/lib/VMCore/Metadata.cpp Wed Oct 21 19:22:05 2009
@@ -33,7 +33,8 @@
   MDString *&S = Entry.getValue();
   if (S) return S;
   
-  return S = new MDString(Context, Entry.getKeyData(), Entry.getKeyLength());
+  return S = 
+    new MDString(Context, StringRef(Entry.getKeyData(), Entry.getKeyLength()));
 }
 
 //===----------------------------------------------------------------------===//





More information about the llvm-commits mailing list