[cfe-commits] r65759 - in /cfe/trunk: include/clang/AST/Stmt.h lib/AST/Stmt.cpp lib/CodeGen/CGObjCMac.cpp lib/Sema/SemaStmt.cpp

Daniel Dunbar daniel at zuster.org
Sat Feb 28 20:28:34 PST 2009


Author: ddunbar
Date: Sat Feb 28 22:28:32 2009
New Revision: 65759

URL: http://llvm.org/viewvc/llvm-project?rev=65759&view=rev
Log:
ObjCAtCatchStmt's ParamStmt is always a DeclStmt.

Modified:
    cfe/trunk/include/clang/AST/Stmt.h
    cfe/trunk/lib/AST/Stmt.cpp
    cfe/trunk/lib/CodeGen/CGObjCMac.cpp
    cfe/trunk/lib/Sema/SemaStmt.cpp

Modified: cfe/trunk/include/clang/AST/Stmt.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=65759&r1=65758&r2=65759&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Sat Feb 28 22:28:32 2009
@@ -1066,7 +1066,8 @@
 
 public:
   ObjCAtCatchStmt(SourceLocation atCatchLoc, SourceLocation rparenloc,
-                  Stmt *catchVarStmtDecl, Stmt *atCatchStmt, Stmt *atCatchList);
+                  DeclStmt *catchVarStmtDecl, 
+                  Stmt *atCatchStmt, Stmt *atCatchList);
   
   const Stmt *getCatchBody() const { return SubExprs[BODY]; }
   Stmt *getCatchBody() { return SubExprs[BODY]; }
@@ -1078,8 +1079,11 @@
     return static_cast<ObjCAtCatchStmt*>(SubExprs[NEXT_CATCH]);
   }
 
-  const Stmt *getCatchParamStmt() const { return SubExprs[SELECTOR]; }
-  Stmt *getCatchParamStmt() { return SubExprs[SELECTOR]; }
+  const DeclStmt *getCatchParamStmt() const { 
+    return static_cast<const DeclStmt*>(SubExprs[SELECTOR]); }
+  DeclStmt *getCatchParamStmt() { 
+    return static_cast<DeclStmt*>(SubExprs[SELECTOR]); 
+  }
   
   SourceLocation getRParenLoc() const { return RParenLoc; }
   

Modified: cfe/trunk/lib/AST/Stmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Stmt.cpp?rev=65759&r1=65758&r2=65759&view=diff

==============================================================================
--- cfe/trunk/lib/AST/Stmt.cpp (original)
+++ cfe/trunk/lib/AST/Stmt.cpp Sat Feb 28 22:28:32 2009
@@ -180,12 +180,13 @@
 
 ObjCAtCatchStmt::ObjCAtCatchStmt(SourceLocation atCatchLoc,
                                  SourceLocation rparenloc,
-                                 Stmt *catchVarStmtDecl, Stmt *atCatchStmt,
+                                 DeclStmt *catchVarStmtDecl, Stmt *atCatchStmt,
                                  Stmt *atCatchList)
 : Stmt(ObjCAtCatchStmtClass) {
   SubExprs[SELECTOR] = catchVarStmtDecl;
   SubExprs[BODY] = atCatchStmt;
   SubExprs[NEXT_CATCH] = NULL;
+  // FIXME: O(N^2) in number of catch blocks.
   if (atCatchList) {
     ObjCAtCatchStmt *AtCatchList = static_cast<ObjCAtCatchStmt*>(atCatchList);
 

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=65759&r1=65758&r2=65759&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Sat Feb 28 22:28:32 2009
@@ -1999,8 +1999,7 @@
     for (; CatchStmt; CatchStmt = CatchStmt->getNextCatchStmt()) {
       llvm::BasicBlock *NextCatchBlock = CGF.createBasicBlock("catch");
 
-      const DeclStmt *CatchParam = 
-        cast_or_null<DeclStmt>(CatchStmt->getCatchParamStmt());
+      const DeclStmt *CatchParam = CatchStmt->getCatchParamStmt();
       const VarDecl *VD = 0;
       const PointerType *PT = 0;
 

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Sat Feb 28 22:28:32 2009
@@ -964,7 +964,7 @@
                            StmtArg Body, StmtArg catchList) {
   Stmt *CatchList = static_cast<Stmt*>(catchList.release());
   ObjCAtCatchStmt *CS = new (Context) ObjCAtCatchStmt(AtLoc, RParen,
-    static_cast<Stmt*>(Parm.release()), static_cast<Stmt*>(Body.release()),
+    static_cast<DeclStmt*>(Parm.release()), static_cast<Stmt*>(Body.release()),
     CatchList);
   return Owned(CatchList ? CatchList : CS);
 }





More information about the cfe-commits mailing list