]> granicus.if.org Git - clang/commitdiff
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.

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

lib/Sema/SemaDeclCXX.cpp

index f0bd810574321d0d74199d67838d19d5735ed5d8..f9eb9ebc992050314679886b012cb96ee6c9fd17 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);
     }
   }