From: Peter Zotov Date: Fri, 15 Nov 2013 02:51:01 +0000 (+0000) Subject: [llvm-c] Simplify signature of LLVMGetTargetFromName X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=5ea0c20ce7a161d23a9bf8f1beea0ffb6a02898c;ds=sidebyside [llvm-c] Simplify signature of LLVMGetTargetFromName LLVMGetTargetFromName was not yet present in an LLVM release, so this does not break compatibility. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194769 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm-c/TargetMachine.h b/include/llvm-c/TargetMachine.h index 84f9144ad54..15d664f54cf 100644 --- a/include/llvm-c/TargetMachine.h +++ b/include/llvm-c/TargetMachine.h @@ -64,7 +64,7 @@ LLVMTargetRef LLVMGetNextTarget(LLVMTargetRef T); /*===-- Target ------------------------------------------------------------===*/ /** Finds the target corresponding to the given name and stores it in \p T. Returns 0 on success. */ -LLVMBool LLVMGetTargetFromName(const char *Name, LLVMTargetRef *T); +LLVMTargetRef LLVMGetTargetFromName(const char *Name); /** Finds the target corresponding to the given triple and stores it in \p T. Returns 0 on success. Optionally returns any error in ErrorMessage. diff --git a/lib/Target/TargetMachineC.cpp b/lib/Target/TargetMachineC.cpp index 36600d1c87e..061d0e9e189 100644 --- a/lib/Target/TargetMachineC.cpp +++ b/lib/Target/TargetMachineC.cpp @@ -72,17 +72,14 @@ LLVMTargetRef LLVMGetNextTarget(LLVMTargetRef T) { return wrap(unwrap(T)->getNext()); } -LLVMBool LLVMGetTargetFromName(const char *Name, LLVMTargetRef *T) { +LLVMTargetRef LLVMGetTargetFromName(const char *Name) { for (TargetRegistry::iterator IT = TargetRegistry::begin(), IE = TargetRegistry::end(); IT != IE; ++IT) { - if (IT->getName() == Name) { - *T = wrap(&*IT); - - return 0; - } + if (IT->getName() == Name) + return wrap(&*IT); } - return 1; + return NULL; } LLVMBool LLVMGetTargetFromTriple(const char* TripleStr, LLVMTargetRef *T,