本文整理汇总了C++中APSInt::isSigned方法的典型用法代码示例。如果您正苦于以下问题:C++ APSInt::isSigned方法的具体用法?C++ APSInt::isSigned怎么用?C++ APSInt::isSigned使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类APSInt
的用法示例。
在下文中一共展示了APSInt::isSigned方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkWidth
void LiteralAnalyser::checkWidth(int availableWidth, const Limit* L, const Expr* Right, const char* tname) {
APSInt Result = checkLiterals(Right);
assert(Result.isSigned() && "TEMP FOR NOW");
int64_t value = Result.getSExtValue();
bool overflow = false;
if (Result.isNegative()) {
const int64_t limit = L->minVal;
if (value < limit) overflow = true;
} else {
if (availableWidth == 64) {
// NOTE: assume for now value always fits in uint64
} else {
const int64_t limit = (int64_t)L->maxVal;
if (value > limit) overflow = true;
}
}
//fprintf(stderr, "VAL=%lld width=%d signed=%d\n", value, availableWidth, Result.isSigned());
if (overflow) {
SmallString<20> ss;
Result.toString(ss, 10, true);
Diags.Report(Right->getLocStart(), diag::err_literal_outofbounds)
<< tname << L->minStr << L->maxStr << ss << Right->getSourceRange();
}
}
示例2: success
/// Decode a numeric leaf value that is known to be a uint64_t.
Error llvm::codeview::consume_numeric(ArrayRef<uint8_t> &Data, uint64_t &Num) {
APSInt N;
if (auto EC = consume(Data, N))
return EC;
if (N.isSigned() || !N.isIntN(64))
return make_error<CodeViewError>(cv_error_code::corrupt_record,
"Data is not a numeric value!");
Num = N.getLimitedValue();
return Error::success();
}
示例3: B
void ExprEngine::
VisitOffsetOfExpr(const OffsetOfExpr *OOE,
ExplodedNode *Pred, ExplodedNodeSet &Dst) {
StmtNodeBuilder B(Pred, Dst, *currBldrCtx);
APSInt IV;
if (OOE->EvaluateAsInt(IV, getContext())) {
assert(IV.getBitWidth() == getContext().getTypeSize(OOE->getType()));
assert(OOE->getType()->isIntegerType());
assert(IV.isSigned() == OOE->getType()->isSignedIntegerOrEnumerationType());
SVal X = svalBuilder.makeIntVal(IV);
B.generateNode(OOE, Pred,
Pred->getState()->BindExpr(OOE, Pred->getLocationContext(),
X));
}
// FIXME: Handle the case where __builtin_offsetof is not a constant.
}
示例4:
void ScalarTraits<APSInt>::output(const APSInt &S, void *,
llvm::raw_ostream &OS) {
S.print(OS, S.isSigned());
}