aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-05-03 07:49:42 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-05-03 07:49:42 +0000
commit72056a237c536ee63285ab0850cb50f299281767 (patch)
treeae01163b3bc34b9cdba78fe4a9e37b2c80b46f7c
parent4df4ee0ff6f804e9d3dd478712e3b5b20cd3bf2f (diff)
Don't insert an extra ParenExpr around asm operands.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70673 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Parse/ParseStmt.cpp4
-rw-r--r--lib/Sema/SemaStmt.cpp17
2 files changed, 11 insertions, 10 deletions
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp
index c692a18ed9..d0d462b66c 100644
--- a/lib/Parse/ParseStmt.cpp
+++ b/lib/Parse/ParseStmt.cpp
@@ -1272,7 +1272,9 @@ bool Parser::ParseAsmOperandsOpt(llvm::SmallVectorImpl<std::string> &Names,
}
// Read the parenthesized expression.
- OwningExprResult Res(ParseSimpleParenExpression());
+ SourceLocation OpenLoc = ConsumeParen();
+ OwningExprResult Res(ParseExpression());
+ MatchRHSPunctuation(tok::r_paren, OpenLoc);
if (Res.isInvalid()) {
SkipUntil(tok::r_paren);
return true;
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index d1246d28b6..808368906b 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -940,12 +940,11 @@ Sema::OwningStmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc,
<< Info.getConstraintStr());
// Check that the output exprs are valid lvalues.
- // FIXME: Operands to asms should not be parsed as ParenExprs.
- ParenExpr *OutputExpr = cast<ParenExpr>(Exprs[i]);
+ Expr *OutputExpr = Exprs[i];
if (CheckAsmLValue(OutputExpr, *this)) {
- return StmtError(Diag(OutputExpr->getSubExpr()->getLocStart(),
+ return StmtError(Diag(OutputExpr->getLocStart(),
diag::err_asm_invalid_lvalue_in_output)
- << OutputExpr->getSubExpr()->getSourceRange());
+ << OutputExpr->getSourceRange());
}
OutputConstraintInfos.push_back(Info);
@@ -969,23 +968,23 @@ Sema::OwningStmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc,
<< Info.getConstraintStr());
}
- ParenExpr *InputExpr = cast<ParenExpr>(Exprs[i]);
+ Expr *InputExpr = Exprs[i];
// Only allow void types for memory constraints.
if (Info.allowsMemory() && !Info.allowsRegister()) {
if (CheckAsmLValue(InputExpr, *this))
- return StmtError(Diag(InputExpr->getSubExpr()->getLocStart(),
+ return StmtError(Diag(InputExpr->getLocStart(),
diag::err_asm_invalid_lvalue_in_input)
<< Info.getConstraintStr()
- << InputExpr->getSubExpr()->getSourceRange());
+ << InputExpr->getSourceRange());
}
if (Info.allowsRegister()) {
if (InputExpr->getType()->isVoidType()) {
- return StmtError(Diag(InputExpr->getSubExpr()->getLocStart(),
+ return StmtError(Diag(InputExpr->getLocStart(),
diag::err_asm_invalid_type_in_input)
<< InputExpr->getType() << Info.getConstraintStr()
- << InputExpr->getSubExpr()->getSourceRange());
+ << InputExpr->getSourceRange());
}
}