]> granicus.if.org Git - clang/commitdiff
Make ActOnWhileStmt take a FullExprArg for the condition expr.
authorAnders Carlsson <andersca@mac.com>
Sun, 17 May 2009 21:22:26 +0000 (21:22 +0000)
committerAnders Carlsson <andersca@mac.com>
Sun, 17 May 2009 21:22:26 +0000 (21:22 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71990 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Parse/Action.h
lib/Parse/ParseStmt.cpp
lib/Sema/Sema.h
lib/Sema/SemaStmt.cpp
lib/Sema/SemaTemplateInstantiateStmt.cpp
tools/clang-cc/PrintParserCallbacks.cpp

index cd1945704fac3a1cafa1c2bb895cd77928459fac..4d188b53fcb13f97f7f7f23629b64554a7fd7d5b 100644 (file)
@@ -506,8 +506,8 @@ public:
     return StmtEmpty();
   }
 
-  virtual OwningStmtResult ActOnWhileStmt(SourceLocation WhileLoc, ExprArg Cond,
-                                          StmtArg Body) {
+  virtual OwningStmtResult ActOnWhileStmt(SourceLocation WhileLoc, 
+                                          FullExprArg Cond, StmtArg Body) {
     return StmtEmpty();
   }
   virtual OwningStmtResult ActOnDoStmt(SourceLocation DoLoc, StmtArg Body,
index cf4e2f44bc213488f19f5c71976487728d435423..1bcfed7e20471c076aefb8e49aa0f2ee58b2ad53 100644 (file)
@@ -777,7 +777,7 @@ Parser::OwningStmtResult Parser::ParseWhileStatement() {
   if (Cond.isInvalid() || Body.isInvalid())
     return StmtError();
 
-  return Actions.ActOnWhileStmt(WhileLoc, move(Cond), move(Body));
+  return Actions.ActOnWhileStmt(WhileLoc, Actions.FullExpr(Cond), move(Body));
 }
 
 /// ParseDoStatement
index 9c2774549801d22943b48d7cb8ab0ed96a118582..a5f50a80af64718c204b40787e40aec2f8125500 100644 (file)
@@ -1182,8 +1182,8 @@ public:
   virtual OwningStmtResult ActOnStartOfSwitchStmt(ExprArg Cond);
   virtual OwningStmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc,
                                                  StmtArg Switch, StmtArg Body);
-  virtual OwningStmtResult ActOnWhileStmt(SourceLocation WhileLoc, ExprArg Cond,
-                                          StmtArg Body);
+  virtual OwningStmtResult ActOnWhileStmt(SourceLocation WhileLoc, 
+                                          FullExprArg Cond, StmtArg Body);
   virtual OwningStmtResult ActOnDoStmt(SourceLocation DoLoc, StmtArg Body,
                                        SourceLocation WhileLoc, ExprArg Cond);
 
index 155b51048a7c7c5feddb3dce5b538d3a27d6b6e7..ebaa99fa989f91b66dbd7da96cd275b0f1da430b 100644 (file)
@@ -542,13 +542,14 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, StmtArg Switch,
 }
 
 Action::OwningStmtResult
-Sema::ActOnWhileStmt(SourceLocation WhileLoc, ExprArg Cond, StmtArg Body) {
-  Expr *condExpr = Cond.takeAs<Expr>();
+Sema::ActOnWhileStmt(SourceLocation WhileLoc, FullExprArg Cond, StmtArg Body) {
+  ExprArg CondArg(Cond.release());
+  Expr *condExpr = CondArg.takeAs<Expr>();
   assert(condExpr && "ActOnWhileStmt(): missing expression");
 
   if (!condExpr->isTypeDependent()) {
     DefaultFunctionArrayConversion(condExpr);
-    Cond = condExpr;
+    CondArg = condExpr;
     QualType condType = condExpr->getType();
     
     if (getLangOptions().CPlusPlus) {
@@ -560,7 +561,7 @@ Sema::ActOnWhileStmt(SourceLocation WhileLoc, ExprArg Cond, StmtArg Body) {
                        << condType << condExpr->getSourceRange());
   }
 
-  Cond.release();
+  CondArg.release();
   return Owned(new (Context) WhileStmt(condExpr, Body.takeAs<Stmt>(), 
                                        WhileLoc));
 }
index 8dcdce2712e9919e8336d7b84aa9139cd3b68f6f..938e58b8fddb7eb8de0d46a2a7af0e22e192f6ae 100644 (file)
@@ -267,7 +267,7 @@ Sema::OwningStmtResult TemplateStmtInstantiator::VisitWhileStmt(WhileStmt *S) {
   if (Body.isInvalid())
     return SemaRef.StmtError();
 
-  return SemaRef.ActOnWhileStmt(S->getWhileLoc(), move(Cond), move(Body));
+  return SemaRef.ActOnWhileStmt(S->getWhileLoc(), FullExpr(Cond), move(Body));
 }
 
 Sema::OwningStmtResult TemplateStmtInstantiator::VisitDoStmt(DoStmt *S) {
index 73a653d7d88038ed2a13dc784d06fe95c521ec85..f99ee277d17c41d8cc0581b464ce9b2a45446244 100644 (file)
@@ -317,7 +317,7 @@ namespace {
     }
 
     virtual OwningStmtResult ActOnWhileStmt(SourceLocation WhileLoc,
-                                            ExprArg Cond, StmtArg Body) {
+                                            FullExprArg Cond, StmtArg Body) {
       llvm::cout << __FUNCTION__ << "\n";
       return StmtEmpty();
     }