From: Peter Zotov Date: Fri, 15 Nov 2013 02:51:18 +0000 (+0000) Subject: [llvm-c] Make LLVMGetTargetFromName actually work X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e016a163e97d29a4c343189e678633066a3365ab;p=oota-llvm.git [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 --- diff --git a/lib/Target/TargetMachineC.cpp b/lib/Target/TargetMachineC.cpp index e111380c628..3d5f8277f00 100644 --- a/lib/Target/TargetMachineC.cpp +++ b/lib/Target/TargetMachineC.cpp @@ -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); }