TargetRegistry中没有目标

时间:2018-01-20 20:19:56

标签: llvm

我有以下代码,它应该获得默认的llvm :: Target。

auto const targetTriple = llvm::sys::getDefaultTargetTriple();
llvm_module.setTargetTriple(targetTriple);
std::string error;
auto const * target = llvm::TargetRegistry::lookupTarget(targetTriple, error);
if (target == nullptr) {
    auto targets = llvm::TargetRegistry::targets();
    size_t targetCount = 0;
    for (auto const & _ : targets) {
        ++targetCount;
    }       
    ERROR(Unknown, "llvm::TargetRegistry::lookupTarget failed for " + targetTriple + ". llvm::TargetRegistry::targets() contains " + std::to_string(targetCount) + " elements.");
}

此代码生成此错误消息:

  对于i686-pc-windows-msvc,

llvm :: TargetRegistry :: lookupTarget失败。   llvm :: TargetRegistry :: targets()包含0个元素

我错过了一步吗?

0 个答案:

没有答案