[英]Linker error building with llvm
我正在嘗試建立Kint 。 我收到了無法確定原因的鏈接錯誤。 這是源文件:
#pragma once
#include <llvm/Support/Debug.h>
#include <llvm/Support/ConstantRange.h>
// llvm::ConstantRange fixup.
class CRange : public llvm::ConstantRange {
typedef llvm::APInt APInt;
typedef llvm::ConstantRange super;
public:
CRange(uint32_t BitWidth, bool isFullSet) : super(BitWidth, isFullSet) {}
// Constructors.
CRange(const super &CR) : super(CR) {}
CRange(const APInt &Value)
: super(Value) {}
CRange(const APInt &Lower, const APInt &Upper)
: super(Lower, Upper) {}
static CRange makeFullSet(uint32_t BitWidth) {
return CRange(BitWidth, true);
}
static CRange makeEmptySet(uint32_t BitWidth) {
return CRange(BitWidth, false);
}
static CRange makeICmpRegion(unsigned Pred, const CRange &other) {
return super::makeICmpRegion(Pred, other);
}
void match(const CRange &R) {
if (this->getBitWidth() != R.getBitWidth()) {
llvm::dbgs() << "warning: range " << *this << " "
<< this->getBitWidth() << " and " << R << " "
<< R.getBitWidth() << " unmatch\n";
*this = this->zextOrTrunc(R.getBitWidth());
}
}
bool safeUnion(const CRange &R) {
CRange V = R, Old = *this;
V.match(*this);
*this = this->unionWith(V);
return Old != *this;
}
CRange sdiv(const CRange &RHS) const {
if (isEmptySet() || RHS.isEmptySet())
return makeEmptySet(getBitWidth());
// FIXME: too conservative.
return makeFullSet(getBitWidth());
}
};
這是錯誤消息:
/home/riyad/src/kint-updated/kint/build/src/../../src/CRange.h:32: undefined reference to `llvm::ConstantRange::ConstantRange(llvm::APInt const&)'
/home/riyad/src/kint-updated/kint/build/src/../../src/CRange.h:32: undefined reference to `llvm::ConstantRange::ConstantRange(llvm::APInt const&)'
/home/riyad/src/kint-updated/kint/build/src/../../src/CRange.h:32: undefined reference to `llvm::ConstantRange::ConstantRange(llvm::APInt const&)'
/home/riyad/src/kint-updated/kint/build/src/../../src/CRange.h:32: undefined reference to `llvm::ConstantRange::ConstantRange(llvm::APInt const&)'
/home/riyad/src/kint-updated/kint/build/src/../../src/CRange.h:32: undefined reference to `llvm::ConstantRange::ConstantRange(llvm::APInt const&)'
但是llvm::ConstantRange::ConstantRange(llvm::APInt const&)
中已經定義了llvm llvm::ConstantRange::ConstantRange(llvm::APInt const&)
。 這是llvm中ConstantRange.h
的源代碼。
#if LLVM_HAS_RVALUE_REFERENCES
// If we have move semantics, pass APInts by value and move them into place.
typedef APInt APIntMoveTy;
#else
// Otherwise pass by const ref to save one copy.
typedef const APInt &APIntMoveTy;
#endif
public:
/// Initialize a full (the default) or empty set for the specified bit width.
///
explicit ConstantRange(uint32_t BitWidth, bool isFullSet = true);
/// Initialize a range to hold the single specified value.
///
ConstantRange(APIntMoveTy Value);
/// @brief Initialize a range of values explicitly. This will assert out if
/// Lower==Upper and Lower != Min or Max value for its type. It will also
/// assert out if the two APInt's are not the same bit width.
ConstantRange(APIntMoveTy Lower, APIntMoveTy Upper);
我試過同時使用llvm 3.4和llvm 3.5。 我正在使用gcc 4.8.2。 我找不到任何無法建立的原因?
我猜你的代碼和llvm代碼使用LLVM_HAS_RVALUE_REFERENCES
未定義/定義值LLVM_HAS_RVALUE_REFERENCES
嘗試在代碼中定義LLVM_HAS_RVALUE_REFERENCES
基本上,您要求輸入(T const&)
,但是llvm具有使用(T)
方法
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.