This patch is the AST-changing bit broken out of the patch proposed here:
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20121008/065734.html
to change how using-directives are stored, and remove them from the land
of NamedDecl.
This small patch changes what I think is the only place in the source
that ever produces a UsingDirectiveDecl inside something that isn't a
namespace or the TU: the implicit using-directive created for an
anonymous namespace, when that anonymous namespace is inside a linkage
spec. In other words:
extern "C" {
namespace {
int i;
}
}
Previously we put the using-directive inside the linkage spec, with this
patch we put it in the TU. As far as I know, this has no effect on
anyone's compile, but changing the AST is more risky than the rest of
the patch so I'm breaking it off into its own piece.
Please review!
Nick
Index: lib/Sema/SemaDeclCXX.cpp
===================================================================
--- lib/Sema/SemaDeclCXX.cpp (revision 166909)
+++ lib/Sema/SemaDeclCXX.cpp (working copy)
@@ -5595,15 +5595,15 @@
if (!PrevNS) {
UsingDirectiveDecl* UD
- = UsingDirectiveDecl::Create(Context, CurContext,
+ = UsingDirectiveDecl::Create(Context, Parent,
/* 'using' */ LBrace,
/* 'namespace' */ SourceLocation(),
/* qualifier */ NestedNameSpecifierLoc(),
/* identifier */ SourceLocation(),
Namespc,
- /* Ancestor */ CurContext);
+ /* Ancestor */ Parent);
UD->setImplicit();
- CurContext->addDecl(UD);
+ Parent->addDecl(UD);
}
}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits