[llvm-c] Make LLVMGetTargetFromName actually work
authorPeter Zotov <whitequark@whitequark.org>
Fri, 15 Nov 2013 02:51:18 +0000 (02:51 +0000)
committerPeter Zotov <whitequark@whitequark.org>
Fri, 15 Nov 2013 02:51:18 +0000 (02:51 +0000)
LLVMGetTargetFromName used to compare two char* strings directly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194771 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/TargetMachineC.cpp

index e111380..3d5f827 100644 (file)
@@ -73,9 +73,10 @@ LLVMTargetRef LLVMGetNextTarget(LLVMTargetRef T) {
 }
 
 LLVMTargetRef LLVMGetTargetFromName(const char *Name) {
+  StringRef NameRef = Name;
   for (TargetRegistry::iterator IT = TargetRegistry::begin(),
                                 IE = TargetRegistry::end(); IT != IE; ++IT) {
-    if (IT->getName() == Name)
+    if (IT->getName() == NameRef)
       return wrap(&*IT);
   }