[llvm-c] Make LLVMGetTargetFromName actually work

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
This commit is contained in:
Peter Zotov 2013-11-15 02:51:18 +00:00
parent fa74752298
commit e016a163e9

View File

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