mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-01 00:33:09 +00:00
llvm-c: Return NULL from LLVMGetFirstTarget instead of asserting
If no targets are registered, LLVMGetFirstTarget currently fails with an assertion. This patch makes it return NULL instead, similarly to how LLVMGetNextTarget would. Patch by Peter Zotov Differential Revision: http://llvm-reviews.chandlerc.com/D1908 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192878 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4ef1999d61
commit
2fee43f9b2
@ -60,8 +60,12 @@ inline LLVMTargetRef wrap(const Target * P) {
|
||||
}
|
||||
|
||||
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());
|
||||
|
Loading…
Reference in New Issue
Block a user