Introduce support for "transparent" DeclContexts, which are
DeclContexts whose members are visible from enclosing DeclContexts up
to (and including) the innermost enclosing non-transparent
DeclContexts. Transparent DeclContexts unify the mechanism to be used
for various language features, including C enumerations, anonymous
unions, C++0x inline namespaces, and C++ linkage
specifications. Please refer to the documentation in the Clang
internals manual for more information.

Only enumerations and linkage specifications currently use transparent
DeclContexts.

Still to do: use transparent DeclContexts to implement anonymous
unions and GCC's anonymous structs extension, and, later, the C++0x
features. We also need to tighten up the DeclContext/ScopedDecl link
to ensure that every ScopedDecl is in a single DeclContext, which
will ensure that we can then enforce ownership and reduce the memory
footprint of DeclContext.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61735 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/ASTConsumers.cpp b/Driver/ASTConsumers.cpp
index 6681ec9..6836d0c 100644
--- a/Driver/ASTConsumers.cpp
+++ b/Driver/ASTConsumers.cpp
@@ -116,14 +116,14 @@
     Out << "};\n";
   } else if (TagDecl *TD = dyn_cast<TagDecl>(D)) {
     Out << "Read top-level tag decl: '" << TD->getNameAsString() << "'\n";
-  } else if (ScopedDecl *SD = dyn_cast<ScopedDecl>(D)) {
-    Out << "Read top-level variable decl: '" << SD->getNameAsString() << "'\n";
   } else if (LinkageSpecDecl *LSD = dyn_cast<LinkageSpecDecl>(D)) {
     PrintLinkageSpec(LSD);
   } else if (FileScopeAsmDecl *AD = dyn_cast<FileScopeAsmDecl>(D)) {
     Out << "asm(";
     AD->getAsmString()->printPretty(Out);
     Out << ")\n";
+  } else if (ScopedDecl *SD = dyn_cast<ScopedDecl>(D)) {
+    Out << "Read top-level variable decl: '" << SD->getNameAsString() << "'\n";
   } else {
     assert(0 && "Unknown decl type!");
   }
@@ -197,8 +197,8 @@
   if (LS->hasBraces()) 
     Out << "{\n";
 
-  for (LinkageSpecDecl::decl_const_iterator D = LS->decls_begin(), 
-                                         DEnd = LS->decls_end();
+  for (LinkageSpecDecl::decl_iterator D = LS->decls_begin(), 
+                                   DEnd = LS->decls_end();
        D != DEnd; ++D)
     PrintDecl(*D);