forked from OSchip/llvm-project
Use "EvaluateAsRValue" instead of as a known int, because if it's not a known
integer we want to emit a diagnostic instead of asserting. llvm-svn: 349604
This commit is contained in:
parent
13381fbc29
commit
642e140beb
|
@ -379,16 +379,16 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
|
|||
} else if (Info.requiresImmediateConstant() && !Info.allowsRegister()) {
|
||||
if (!InputExpr->isValueDependent()) {
|
||||
Expr::EvalResult EVResult;
|
||||
if (!InputExpr->EvaluateAsInt(EVResult, Context))
|
||||
if (!InputExpr->EvaluateAsRValue(EVResult, Context, true))
|
||||
return StmtError(
|
||||
Diag(InputExpr->getBeginLoc(), diag::err_asm_immediate_expected)
|
||||
<< Info.getConstraintStr() << InputExpr->getSourceRange());
|
||||
llvm::APSInt Result = EVResult.Val.getInt();
|
||||
if (!Info.isValidAsmImmediate(Result))
|
||||
return StmtError(Diag(InputExpr->getBeginLoc(),
|
||||
diag::err_invalid_asm_value_for_constraint)
|
||||
<< Result.toString(10) << Info.getConstraintStr()
|
||||
<< InputExpr->getSourceRange());
|
||||
if (!Info.isValidAsmImmediate(Result))
|
||||
return StmtError(Diag(InputExpr->getBeginLoc(),
|
||||
diag::err_invalid_asm_value_for_constraint)
|
||||
<< Result.toString(10) << Info.getConstraintStr()
|
||||
<< InputExpr->getSourceRange());
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue