[cfe-commits] r102341 - in /cfe/trunk: include/clang/AST/StmtObjC.h lib/AST/StmtDumper.cpp lib/CodeGen/CGObjCGNU.cpp lib/CodeGen/CGObjCMac.cpp lib/Frontend/PCHReaderStmt.cpp lib/Frontend/RewriteObjC.cpp lib/Sema/SemaDeclObjC.cpp

Douglas Gregor dgregor at apple.com
Mon Apr 26 09:46:50 PDT 2010


Author: dgregor
Date: Mon Apr 26 11:46:50 2010
New Revision: 102341

URL: http://llvm.org/viewvc/llvm-project?rev=102341&view=rev
Log:
Make the static type of the exception variable in an Objective-C
@catch a VarDecl. The dynamic type is still a ParmVarDecl, but that
will change soon. No effective functionality change.

Modified:
    cfe/trunk/include/clang/AST/StmtObjC.h
    cfe/trunk/lib/AST/StmtDumper.cpp
    cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
    cfe/trunk/lib/CodeGen/CGObjCMac.cpp
    cfe/trunk/lib/Frontend/PCHReaderStmt.cpp
    cfe/trunk/lib/Frontend/RewriteObjC.cpp
    cfe/trunk/lib/Sema/SemaDeclObjC.cpp

Modified: cfe/trunk/include/clang/AST/StmtObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtObjC.h?rev=102341&r1=102340&r2=102341&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/StmtObjC.h (original)
+++ cfe/trunk/include/clang/AST/StmtObjC.h Mon Apr 26 11:46:50 2010
@@ -71,13 +71,13 @@
 /// ObjCAtCatchStmt - This represents objective-c's @catch statement.
 class ObjCAtCatchStmt : public Stmt {
 private:
-  ParmVarDecl *ExceptionDecl;
+  VarDecl *ExceptionDecl;
   Stmt *Body;
   SourceLocation AtCatchLoc, RParenLoc;
 
 public:
   ObjCAtCatchStmt(SourceLocation atCatchLoc, SourceLocation rparenloc,
-                  ParmVarDecl *catchVarDecl,
+                  VarDecl *catchVarDecl,
                   Stmt *atCatchStmt)
     : Stmt(ObjCAtCatchStmtClass), ExceptionDecl(catchVarDecl), 
     Body(atCatchStmt), AtCatchLoc(atCatchLoc), RParenLoc(rparenloc) { }
@@ -89,13 +89,13 @@
   Stmt *getCatchBody() { return Body; }
   void setCatchBody(Stmt *S) { Body = S; }
 
-  const ParmVarDecl *getCatchParamDecl() const {
+  const VarDecl *getCatchParamDecl() const {
     return ExceptionDecl;
   }
-  ParmVarDecl *getCatchParamDecl() {
+  VarDecl *getCatchParamDecl() {
     return ExceptionDecl;
   }
-  void setCatchParamDecl(ParmVarDecl *D) { ExceptionDecl = D; }
+  void setCatchParamDecl(VarDecl *D) { ExceptionDecl = D; }
 
   SourceLocation getAtCatchLoc() const { return AtCatchLoc; }
   void setAtCatchLoc(SourceLocation Loc) { AtCatchLoc = Loc; }

Modified: cfe/trunk/lib/AST/StmtDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtDumper.cpp?rev=102341&r1=102340&r2=102341&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtDumper.cpp (original)
+++ cfe/trunk/lib/AST/StmtDumper.cpp Mon Apr 26 11:46:50 2010
@@ -555,7 +555,7 @@
 
 void StmtDumper::VisitObjCAtCatchStmt(ObjCAtCatchStmt *Node) {
   DumpStmt(Node);
-  if (ParmVarDecl *CatchParam = Node->getCatchParamDecl()) {
+  if (VarDecl *CatchParam = Node->getCatchParamDecl()) {
     OS << " catch parm = ";
     DumpDeclarator(CatchParam);
   } else {

Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=102341&r1=102340&r2=102341&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Mon Apr 26 11:46:50 2010
@@ -1773,7 +1773,7 @@
   llvm::Value *RethrowPtr = CGF.CreateTempAlloca(Exc->getType(), "_rethrow");
 
   llvm::SmallVector<llvm::Value*, 8> ESelArgs;
-  llvm::SmallVector<std::pair<const ParmVarDecl*, const Stmt*>, 8> Handlers;
+  llvm::SmallVector<std::pair<const VarDecl*, const Stmt*>, 8> Handlers;
 
   ESelArgs.push_back(Exc);
   ESelArgs.push_back(Personality);
@@ -1787,7 +1787,7 @@
 
       for (unsigned I = 0, N = AtTry.getNumCatchStmts(); I != N; ++I) {
         const ObjCAtCatchStmt *CatchStmt = AtTry.getCatchStmt(I);
-        const ParmVarDecl *CatchDecl = CatchStmt->getCatchParamDecl();
+        const VarDecl *CatchDecl = CatchStmt->getCatchParamDecl();
         Handlers.push_back(std::make_pair(CatchDecl,
                                           CatchStmt->getCatchBody()));
 
@@ -1826,7 +1826,7 @@
       ESelArgs.begin(), ESelArgs.end(), "selector");
 
   for (unsigned i = 0, e = Handlers.size(); i != e; ++i) {
-    const ParmVarDecl *CatchParam = Handlers[i].first;
+    const VarDecl *CatchParam = Handlers[i].first;
     const Stmt *CatchBody = Handlers[i].second;
 
     llvm::BasicBlock *Next = 0;

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=102341&r1=102340&r2=102341&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Mon Apr 26 11:46:50 2010
@@ -2670,7 +2670,7 @@
       const ObjCAtCatchStmt *CatchStmt = AtTryStmt->getCatchStmt(I);
       llvm::BasicBlock *NextCatchBlock = CGF.createBasicBlock("catch");
 
-      const ParmVarDecl *CatchParam = CatchStmt->getCatchParamDecl();
+      const VarDecl *CatchParam = CatchStmt->getCatchParamDecl();
       const ObjCObjectPointerType *OPT = 0;
 
       // catch(...) always matches.
@@ -5562,13 +5562,13 @@
   SelectorArgs.push_back(ObjCTypes.getEHPersonalityPtr());
 
   // Construct the lists of (type, catch body) to handle.
-  llvm::SmallVector<std::pair<const ParmVarDecl*, const Stmt*>, 8> Handlers;
+  llvm::SmallVector<std::pair<const VarDecl*, const Stmt*>, 8> Handlers;
   bool HasCatchAll = false;
   if (isTry) {
     const ObjCAtTryStmt &AtTry = cast<ObjCAtTryStmt>(S);
     for (unsigned I = 0, N = AtTry.getNumCatchStmts(); I != N; ++I) {
       const ObjCAtCatchStmt *CatchStmt = AtTry.getCatchStmt(I);
-      const ParmVarDecl *CatchDecl = CatchStmt->getCatchParamDecl();
+      const VarDecl *CatchDecl = CatchStmt->getCatchParamDecl();
       Handlers.push_back(std::make_pair(CatchDecl, CatchStmt->getCatchBody()));
 
       // catch(...) always matches.
@@ -5618,7 +5618,7 @@
                            SelectorArgs.begin(), SelectorArgs.end(),
                            "selector");
   for (unsigned i = 0, e = Handlers.size(); i != e; ++i) {
-    const ParmVarDecl *CatchParam = Handlers[i].first;
+    const VarDecl *CatchParam = Handlers[i].first;
     const Stmt *CatchBody = Handlers[i].second;
 
     llvm::BasicBlock *Next = 0;

Modified: cfe/trunk/lib/Frontend/PCHReaderStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReaderStmt.cpp?rev=102341&r1=102340&r2=102341&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHReaderStmt.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReaderStmt.cpp Mon Apr 26 11:46:50 2010
@@ -839,7 +839,7 @@
 unsigned PCHStmtReader::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
   VisitStmt(S);
   S->setCatchBody(cast_or_null<Stmt>(StmtStack.back()));
-  S->setCatchParamDecl(cast_or_null<ParmVarDecl>(Reader.GetDecl(Record[Idx++])));
+  S->setCatchParamDecl(cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++])));
   S->setAtCatchLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
   S->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
   return 1;

Modified: cfe/trunk/lib/Frontend/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/RewriteObjC.cpp?rev=102341&r1=102340&r2=102341&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Frontend/RewriteObjC.cpp Mon Apr 26 11:46:50 2010
@@ -1881,7 +1881,7 @@
   Stmt *lastCatchBody = 0;
   for (unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
     ObjCAtCatchStmt *Catch = S->getCatchStmt(I);
-    ParmVarDecl *catchDecl = Catch->getCatchParamDecl();
+    VarDecl *catchDecl = Catch->getCatchParamDecl();
 
     if (I == 0)
       buf = "if ("; // we are generating code for the first catch clause

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=102341&r1=102340&r2=102341&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Mon Apr 26 11:46:50 2010
@@ -1711,6 +1711,6 @@
   // FIXME: Perform checking on the declaration here.
   DeclPtrTy Dcl = ActOnParamDeclarator(S, D);
   if (Dcl.get())
-    cast<ParmVarDecl>(Dcl.getAs<Decl>())->setDeclContext(CurContext);
+    cast<VarDecl>(Dcl.getAs<Decl>())->setDeclContext(CurContext);
   return Dcl;
 }





More information about the cfe-commits mailing list