[cfe-commits] r70673 - in /cfe/trunk/lib: Parse/ParseStmt.cpp Sema/SemaStmt.cpp

Eli Friedman eli.friedman at gmail.com
Sun May 3 00:49:50 PDT 2009


Author: efriedma
Date: Sun May  3 02:49:42 2009
New Revision: 70673

URL: http://llvm.org/viewvc/llvm-project?rev=70673&view=rev
Log:
Don't insert an extra ParenExpr around asm operands.


Modified:
    cfe/trunk/lib/Parse/ParseStmt.cpp
    cfe/trunk/lib/Sema/SemaStmt.cpp

Modified: cfe/trunk/lib/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmt.cpp?rev=70673&r1=70672&r2=70673&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseStmt.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmt.cpp Sun May  3 02:49:42 2009
@@ -1272,7 +1272,9 @@
     }
 
     // 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;

Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=70673&r1=70672&r2=70673&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Sun May  3 02:49:42 2009
@@ -940,12 +940,11 @@
                        << 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 @@
                        << 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());
       }
     }
     





More information about the cfe-commits mailing list