Put the usage-directive inside the nearest namespace or TU decl. We don't want
authorNick Lewycky <nicholas@mxc.ca>
Sun, 4 Nov 2012 20:21:54 +0000 (20:21 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Sun, 4 Nov 2012 20:21:54 +0000 (20:21 +0000)
to have UsingDirectiveDecl inside anything other than those two.

No user-visible functionality change.

llvm-svn: 167376

clang/lib/Sema/SemaDeclCXX.cpp

index f0bd810..f9eb9eb 100644 (file)
@@ -5595,15 +5595,15 @@ Decl *Sema::ActOnStartNamespaceDef(Scope *NamespcScope,
 
     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);
     }
   }