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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102341 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/StmtDumper.cpp b/lib/AST/StmtDumper.cpp
index f8b8173..ca62ed1 100644
--- a/lib/AST/StmtDumper.cpp
+++ b/lib/AST/StmtDumper.cpp
@@ -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 {
diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp
index a248c5a..e8ade2a 100644
--- a/lib/CodeGen/CGObjCGNU.cpp
+++ b/lib/CodeGen/CGObjCGNU.cpp
@@ -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;
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index 62e7900..3905bd4 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -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;
diff --git a/lib/Frontend/PCHReaderStmt.cpp b/lib/Frontend/PCHReaderStmt.cpp
index cf26b6e..5e08be1 100644
--- a/lib/Frontend/PCHReaderStmt.cpp
+++ b/lib/Frontend/PCHReaderStmt.cpp
@@ -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;
diff --git a/lib/Frontend/RewriteObjC.cpp b/lib/Frontend/RewriteObjC.cpp
index 5f3b272..a1cbb32 100644
--- a/lib/Frontend/RewriteObjC.cpp
+++ b/lib/Frontend/RewriteObjC.cpp
@@ -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
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 9a223e9..8ee5d32 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -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;
 }