From e016a163e97d29a4c343189e678633066a3365ab Mon Sep 17 00:00:00 2001 From: Peter Zotov Date: Fri, 15 Nov 2013 02:51:18 +0000 Subject: [PATCH] [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 --- lib/Target/TargetMachineC.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); }