diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2015-08-07 23:02:44 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2015-08-07 23:02:44 +0000 |
| commit | 51ece4aae5857052d224ce52277924c74685714e (patch) | |
| tree | ca13cf9e2e8c2499f61f1246e455efd2804abd36 /lib/Sema/SemaStmtAsm.cpp | |
| parent | c192b3dcffd5e672a2b2e1730e2440febb4fb192 (diff) | |
Notes
Diffstat (limited to 'lib/Sema/SemaStmtAsm.cpp')
| -rw-r--r-- | lib/Sema/SemaStmtAsm.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/Sema/SemaStmtAsm.cpp b/lib/Sema/SemaStmtAsm.cpp index d19d8819d8e2..8e3e89f1e572 100644 --- a/lib/Sema/SemaStmtAsm.cpp +++ b/lib/Sema/SemaStmtAsm.cpp @@ -254,17 +254,19 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, << Info.getConstraintStr() << InputExpr->getSourceRange()); } else if (Info.requiresImmediateConstant() && !Info.allowsRegister()) { - llvm::APSInt Result; - if (!InputExpr->EvaluateAsInt(Result, Context)) - return StmtError( - Diag(InputExpr->getLocStart(), diag::err_asm_immediate_expected) - << Info.getConstraintStr() << InputExpr->getSourceRange()); - if (Result.slt(Info.getImmConstantMin()) || - Result.sgt(Info.getImmConstantMax())) - return StmtError(Diag(InputExpr->getLocStart(), - diag::err_invalid_asm_value_for_constraint) - << Result.toString(10) << Info.getConstraintStr() - << InputExpr->getSourceRange()); + if (!InputExpr->isValueDependent()) { + llvm::APSInt Result; + if (!InputExpr->EvaluateAsInt(Result, Context)) + return StmtError( + Diag(InputExpr->getLocStart(), diag::err_asm_immediate_expected) + << Info.getConstraintStr() << InputExpr->getSourceRange()); + if (Result.slt(Info.getImmConstantMin()) || + Result.sgt(Info.getImmConstantMax())) + return StmtError(Diag(InputExpr->getLocStart(), + diag::err_invalid_asm_value_for_constraint) + << Result.toString(10) << Info.getConstraintStr() + << InputExpr->getSourceRange()); + } } else { ExprResult Result = DefaultFunctionArrayLvalueConversion(Exprs[i]); |
