diff options
author | Bill Wendling <isanbard@gmail.com> | 2018-12-19 04:54:29 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2018-12-19 04:54:29 +0000 |
commit | 642e140bebe0825168078f15b992e604b6af4e81 (patch) | |
tree | a441552b23fa09da66137a3632b149dfba24172e | |
parent | 13381fbc29f1d38c4c0c21a1596baf25d4f2dfd4 (diff) | |
download | bcm5719-llvm-642e140bebe0825168078f15b992e604b6af4e81.tar.gz bcm5719-llvm-642e140bebe0825168078f15b992e604b6af4e81.zip |
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
-rw-r--r-- | clang/lib/Sema/SemaStmtAsm.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaStmtAsm.cpp b/clang/lib/Sema/SemaStmtAsm.cpp index d209266049e..9e084c99d0d 100644 --- a/clang/lib/Sema/SemaStmtAsm.cpp +++ b/clang/lib/Sema/SemaStmtAsm.cpp @@ -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 { |