<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hello,<br>
<br>
General to your recent patches, you should not mix comestic
changes and feature changes.<br>
<br>
Sylvestre<br>
On 12/10/2013 17:48, Peter Zotov wrote:<br>
</div>
<blockquote
cite="mid:differential-rev-PHID-DREV-rzyeqddwjf4gismis53d-req@llvm-reviews.chandlerc.com"
type="cite">
<pre wrap="">If no targets are registered, LLVMGetFirstTarget currently fails with an assertion. This patch makes it return NULL instead, similarly to how LLVMGetNextTarget would.
<a class="moz-txt-link-freetext" href="http://llvm-reviews.chandlerc.com/D1908">http://llvm-reviews.chandlerc.com/D1908</a>
Files:
lib/Target/TargetMachineC.cpp
Index: lib/Target/TargetMachineC.cpp
===================================================================
--- lib/Target/TargetMachineC.cpp
+++ lib/Target/TargetMachineC.cpp
@@ -48,21 +48,29 @@
inline TargetMachine *unwrap(LLVMTargetMachineRef P) {
return reinterpret_cast<TargetMachine*>(P);
}
+
inline Target *unwrap(LLVMTargetRef P) {
return reinterpret_cast<Target*>(P);
}
+
inline LLVMTargetMachineRef wrap(const TargetMachine *P) {
return
reinterpret_cast<LLVMTargetMachineRef>(const_cast<TargetMachine*>(P));
}
+
inline LLVMTargetRef wrap(const Target * P) {
return reinterpret_cast<LLVMTargetRef>(const_cast<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());
}
</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
llvm-commits mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a>
</pre>
</blockquote>
<br>
</body>
</html>