[Lldb-commits] [lldb] r260747 - Disable recognition of "using" declarations at translation-unit level.

Sean Callanan via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 12 13:55:06 PST 2016

Author: spyffe
Date: Fri Feb 12 15:55:05 2016
New Revision: 260747

URL: http://llvm.org/viewvc/llvm-project?rev=260747&view=rev
Disable recognition of "using" declarations at translation-unit level.

Currently CountDeclLevels uses the ASTs which have no distinction between
separate translation units.  If one .o file has a "using" declaration at
translation unit level, that "using" declaration will be in the same translation
unit as functions from other .o files in the same module.  This leads to
erroneous name conflicts as the CountDeclLevels-based function filtering logic
accepts too many fucntions.

In the future we will identify the translation units for top-level Decls more
reliably and restore that functionality.  There's a TODO to that effect in the


Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=260747&r1=260746&r2=260747&view=diff
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Fri Feb 12 15:55:05 2016
@@ -9926,6 +9926,15 @@ ClangASTContext::CountDeclLevels (clang:
                 if (searched.find(it->second) != searched.end())
+                // Currently DWARF has one shared translation unit for all Decls at top level, so this
+                // would erroneously find using statements anywhere.  So don't look at the top-level
+                // translation unit.
+                // TODO fix this and add a testcase that depends on it.
+                if (llvm::isa<clang::TranslationUnitDecl>(it->second))
+                    continue;
                 symbol_file->ParseDeclsForContext(CompilerDeclContext(this, it->second));

More information about the lldb-commits mailing list