]> granicus.if.org Git - clang/commitdiff
When we transform a C++ exception declaration (e.g., for template
authorDouglas Gregor <dgregor@apple.com>
Thu, 14 Apr 2011 22:32:28 +0000 (22:32 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 14 Apr 2011 22:32:28 +0000 (22:32 +0000)
instantiation), be sure to add the transformed declaration into the
current DeclContext. Also, remove the -Wuninitialized hack that works
around this bug. Fixes <rdar://problem/9200676>.

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

lib/Analysis/UninitializedValues.cpp
lib/Sema/TreeTransform.h

index 59a42813fc55144d9b7c05a611e4eb924ab9b08c..a1a49b6757f811387f4c6f5aa082b52e735a5943 100644 (file)
@@ -394,13 +394,7 @@ public:
   void BlockStmt_VisitObjCForCollectionStmt(ObjCForCollectionStmt *fs);
   
   bool isTrackedVar(const VarDecl *vd) {
-#if 1
-    // FIXME: This is a temporary workaround to deal with the fact
-    // that DeclContext's do not always contain all of their variables!
-    return vals.hasEntry(vd);
-#else
     return ::isTrackedVar(vd, cast<DeclContext>(ac.getDecl()));
-#endif
   }
   
   FindVarResult findBlockVarDecl(Expr *ex);
index a639f5f303480b5720ce8993cfecbcb775deb2f7..b6d38f618bf0d14aa9129d3b00ecc4927d812dc0 100644 (file)
@@ -1203,8 +1203,11 @@ public:
                                 SourceLocation StartLoc,
                                 SourceLocation IdLoc,
                                 IdentifierInfo *Id) {
-    return getSema().BuildExceptionDeclaration(0, Declarator,
-                                               StartLoc, IdLoc, Id);
+    VarDecl *Var = getSema().BuildExceptionDeclaration(0, Declarator,
+                                                       StartLoc, IdLoc, Id);
+    if (Var)
+      getSema().CurContext->addDecl(Var);
+    return Var;
   }
 
   /// \brief Build a new C++ catch statement.