diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2019-10-23 17:52:09 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2019-10-23 17:52:09 +0000 | 
| commit | 519fc96c475680de2cc49e7811dbbfadb912cbcc (patch) | |
| tree | 310ca684459b7e9ae13c9a3b9abf308b3a634afe /lib/Sema/SemaStmtAsm.cpp | |
| parent | 2298981669bf3bd63335a4be179bc0f96823a8f4 (diff) | |
Notes
Diffstat (limited to 'lib/Sema/SemaStmtAsm.cpp')
| -rw-r--r-- | lib/Sema/SemaStmtAsm.cpp | 32 | 
1 files changed, 13 insertions, 19 deletions
| diff --git a/lib/Sema/SemaStmtAsm.cpp b/lib/Sema/SemaStmtAsm.cpp index b123a739a7ab..9b051e02d127 100644 --- a/lib/Sema/SemaStmtAsm.cpp +++ b/lib/Sema/SemaStmtAsm.cpp @@ -383,25 +383,19 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,      } else if (Info.requiresImmediateConstant() && !Info.allowsRegister()) {        if (!InputExpr->isValueDependent()) {          Expr::EvalResult EVResult; -        if (!InputExpr->EvaluateAsRValue(EVResult, Context, true)) -          return StmtError( -              Diag(InputExpr->getBeginLoc(), diag::err_asm_immediate_expected) -              << Info.getConstraintStr() << InputExpr->getSourceRange()); - -        // For compatibility with GCC, we also allow pointers that would be -        // integral constant expressions if they were cast to int. -        llvm::APSInt IntResult; -        if (!EVResult.Val.toIntegralConstant(IntResult, InputExpr->getType(), -                                             Context)) -          return StmtError( -              Diag(InputExpr->getBeginLoc(), diag::err_asm_immediate_expected) -              << Info.getConstraintStr() << InputExpr->getSourceRange()); - -        if (!Info.isValidAsmImmediate(IntResult)) -          return StmtError(Diag(InputExpr->getBeginLoc(), -                                diag::err_invalid_asm_value_for_constraint) -                           << IntResult.toString(10) << Info.getConstraintStr() -                           << InputExpr->getSourceRange()); +        if (InputExpr->EvaluateAsRValue(EVResult, Context, true)) { +          // For compatibility with GCC, we also allow pointers that would be +          // integral constant expressions if they were cast to int. +          llvm::APSInt IntResult; +          if (EVResult.Val.toIntegralConstant(IntResult, InputExpr->getType(), +                                               Context)) +            if (!Info.isValidAsmImmediate(IntResult)) +              return StmtError(Diag(InputExpr->getBeginLoc(), +                                    diag::err_invalid_asm_value_for_constraint) +                               << IntResult.toString(10) +                               << Info.getConstraintStr() +                               << InputExpr->getSourceRange()); +        }        }      } else { | 
