]> granicus.if.org Git - clang/commitdiff
Make the static type of the exception variable in an Objective-C
authorDouglas Gregor <dgregor@apple.com>
Mon, 26 Apr 2010 16:46:50 +0000 (16:46 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 26 Apr 2010 16:46:50 +0000 (16:46 +0000)
@catch a VarDecl. The dynamic type is still a ParmVarDecl, but that
will change soon. No effective functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102341 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 6cb2b1f18a3c75a88e962bc7aac999ff2515ab72..269aa4c6dab2d1c8d8e5974dba4a00cb4577b343 100644 (file)
@@ -71,13 +71,13 @@ public:
 /// 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 @@ public:
   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; }
index f8b817351936d2f0cef44ce126475eec43ffdae4..ca62ed12d058cb649af2fe46d134ffeaf09ba75d 100644 (file)
@@ -555,7 +555,7 @@ void StmtDumper::VisitObjCMessageExpr(ObjCMessageExpr* Node) {
 
 void StmtDumper::VisitObjCAtCatchStmt(ObjCAtCatchStmt *Node) {
   DumpStmt(Node);
-  if (ParmVarDecl *CatchParam = Node->getCatchParamDecl()) {
+  if (VarDecl *CatchParam = Node->getCatchParamDecl()) {
     OS << " catch parm = ";
     DumpDeclarator(CatchParam);
   } else {
index a248c5a1be0c919c054f94629d8af436cd480c57..e8ade2adb1a73658d59f9e1bb3c2a62f36ab55b7 100644 (file)
@@ -1773,7 +1773,7 @@ void CGObjCGNU::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF,
   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 @@ void CGObjCGNU::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF,
 
       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 @@ void CGObjCGNU::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF,
       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;
index 62e7900533985f491cb7a86621a20ec4528d1892..3905bd4f3d18a3ceeac2811ed1af907a5b3f67d8 100644 (file)
@@ -2670,7 +2670,7 @@ void CGObjCMac::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF,
       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 @@ CGObjCNonFragileABIMac::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF,
   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 @@ CGObjCNonFragileABIMac::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF,
                            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;
index cf26b6e237265ccdcf594cbb4e0500a037888aea..5e08be138a161526a5d42e0493cce52a7d741ff5 100644 (file)
@@ -839,7 +839,7 @@ unsigned PCHStmtReader::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
 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;
index 5f3b27201f5892e9b065921fd74b79b6460f710a..a1cbb324c497b153eeffb3cf732b7ffa3c174b37 100644 (file)
@@ -1881,7 +1881,7 @@ Stmt *RewriteObjC::RewriteObjCTryStmt(ObjCAtTryStmt *S) {
   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
index 9a223e91dc3c08ef50df07fbdecfddc7052e010b..8ee5d3292ee53be2c231c95bf7cb954e9e7ff175 100644 (file)
@@ -1711,6 +1711,6 @@ Sema::DeclPtrTy Sema::ActOnObjCExceptionDecl(Scope *S, Declarator &D) {
   // 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;
 }