[cfe-commits] r129544 - in /cfe/trunk/lib: Analysis/UninitializedValues.cpp Sema/TreeTransform.h

Douglas Gregor dgregor at apple.com
Thu Apr 14 15:32:28 PDT 2011


Author: dgregor
Date: Thu Apr 14 17:32:28 2011
New Revision: 129544

URL: http://llvm.org/viewvc/llvm-project?rev=129544&view=rev
Log:
When we transform a C++ exception declaration (e.g., for template
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>.

Modified:
    cfe/trunk/lib/Analysis/UninitializedValues.cpp
    cfe/trunk/lib/Sema/TreeTransform.h

Modified: cfe/trunk/lib/Analysis/UninitializedValues.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/UninitializedValues.cpp?rev=129544&r1=129543&r2=129544&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/UninitializedValues.cpp (original)
+++ cfe/trunk/lib/Analysis/UninitializedValues.cpp Thu Apr 14 17:32:28 2011
@@ -394,13 +394,7 @@
   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);

Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=129544&r1=129543&r2=129544&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Thu Apr 14 17:32:28 2011
@@ -1203,8 +1203,11 @@
                                 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.





More information about the cfe-commits mailing list