[PATCH] C API: return NULL from LLVMGetFirstTarget instead of asserting
Peter Zotov
whitequark at whitequark.org
Sat Oct 12 10:51:22 PDT 2013
Removed whitespace changes.
http://llvm-reviews.chandlerc.com/D1908
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D1908?vs=4859&id=4881#toc
Files:
lib/Target/TargetMachineC.cpp
Index: lib/Target/TargetMachineC.cpp
===================================================================
--- lib/Target/TargetMachineC.cpp
+++ lib/Target/TargetMachineC.cpp
@@ -60,8 +60,12 @@
}
LLVMTargetRef LLVMGetFirstTarget() {
- const Target* target = &*TargetRegistry::begin();
- return wrap(target);
+ if(TargetRegistry::begin() == TargetRegistry::end()) {
+ return NULL;
+ }
+
+ const Target* target = &*TargetRegistry::begin();
+ return wrap(target);
}
LLVMTargetRef LLVMGetNextTarget(LLVMTargetRef T) {
return wrap(unwrap(T)->getNext());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1908.2.patch
Type: text/x-patch
Size: 567 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131012/62129df1/attachment.bin>
More information about the llvm-commits
mailing list