|
@@ -378,17 +378,17 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
|
|
|
<< InputExpr->getSourceRange());
|
|
|
} else if (Info.requiresImmediateConstant() && !Info.allowsRegister()) {
|
|
|
if (!InputExpr->isValueDependent()) {
|
|
|
- Expr::EvalResult EVResult;
|
|
|
- if (!InputExpr->EvaluateAsInt(EVResult, Context))
|
|
|
+ llvm::SmallVector<PartialDiagnosticAt, 1> Diags;
|
|
|
+ llvm::APSInt Result = InputExpr->EvaluateKnownConstInt(Context, &Diags);
|
|
|
+ if (!Diags.empty())
|
|
|
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 {
|