const Target *
TargetRegistry::getClosestStaticTargetForTriple(const std::string &TT,
std::string &Error) {
+ // Provide special warning when no targets are initialized.
+ if (begin() == end()) {
+ Error = "Unable to find target for this triple (no targets are registered)";
+ return 0;
+ }
const Target *Best = 0, *EquallyBest = 0;
unsigned BestQuality = 0;
for (iterator it = begin(), ie = end(); it != ie; ++it) {
}
if (!Best) {
- Error = "No available targets are compatible with this module";
+ Error = "No available targets are compatible with this triple";
return 0;
}
const Target *
TargetRegistry::getClosestStaticTargetForModule(const Module &M,
std::string &Error) {
+ // Provide special warning when no targets are initialized.
+ if (begin() == end()) {
+ Error = "Unable to find target for this module (no targets are registered)";
+ return 0;
+ }
+
const Target *Best = 0, *EquallyBest = 0;
unsigned BestQuality = 0;
for (iterator it = begin(), ie = end(); it != ie; ++it) {
const Target *
TargetRegistry::getClosestTargetForJIT(std::string &Error) {
+ // Provide special warning when no targets are initialized.
+ if (begin() == end()) {
+ Error = "No JIT is available for this host (no targets are registered)";
+ return 0;
+ }
+
const Target *Best = 0, *EquallyBest = 0;
unsigned BestQuality = 0;
for (iterator it = begin(), ie = end(); it != ie; ++it) {