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>.

llvm-svn: 129544
This commit is contained in:
Douglas Gregor 2011-04-14 22:32:28 +00:00
parent eb0e0b19b0
commit 40965fa78a
2 changed files with 5 additions and 8 deletions

View 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);

View 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.