[Lldb-commits] [lldb] r141838 - in /lldb/trunk/source/Plugins/SymbolFile/DWARF: SymbolFileDWARF.cpp SymbolFileDWARF.h

Greg Clayton gclayton at apple.com
Wed Oct 12 17:00:53 PDT 2011


Author: gclayton
Date: Wed Oct 12 19:00:53 2011
New Revision: 141838

URL: http://llvm.org/viewvc/llvm-project?rev=141838&view=rev
Log:
Added a function to test if a ClangNamespaceDecl matches the current symbol
file. This will help us to minimize lookups that can't possibly match anything
in the current symbol file.


Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=141838&r1=141837&r2=141838&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Wed Oct 12 19:00:53 2011
@@ -1944,6 +1944,31 @@
 #endif
     }
 }
+
+bool
+SymbolFileDWARF::NamespaceDeclMatchesThisSymbolFile (const ClangNamespaceDecl *namespace_decl)
+{
+    if (namespace_decl == NULL)
+    {
+        // Invalid namespace decl which means we aren't matching only things
+        // in this symbol file, so return true to indicate it matches this
+        // symbol file.
+        return true;
+    }
+    
+    clang::ASTContext *namespace_ast = namespace_decl->GetASTContext();
+
+    if (namespace_ast == NULL)
+        return true;    // No AST in the "namespace_decl", return true since it 
+                        // could then match any symbol file, including this one
+
+    if (namespace_ast == GetClangASTContext().getASTContext())
+        return true;    // The ASTs match, return true
+    
+    // The namespace AST was valid, and it does not match...
+    return false;
+}
+
 bool
 SymbolFileDWARF::DIEIsInNamespace (const ClangNamespaceDecl *namespace_decl, 
                                    DWARFCompileUnit* cu, 
@@ -1952,10 +1977,11 @@
     // No namespace specified, so the answesr i
     if (namespace_decl == NULL)
         return true;
-    
+
     const DWARFDebugInfoEntry *decl_ctx_die = GetDeclContextDIEContainingDIE (cu, die);
     if (decl_ctx_die)
     {
+
         clang::NamespaceDecl *clang_namespace_decl = namespace_decl->GetNamespaceDecl();
         if (clang_namespace_decl)
         {

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=141838&r1=141837&r2=141838&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Wed Oct 12 19:00:53 2011
@@ -250,6 +250,8 @@
         flagsGotDebugTypesData      = (1 << 12)
     };
     
+    bool                    NamespaceDeclMatchesThisSymbolFile (const lldb_private::ClangNamespaceDecl *namespace_decl);
+
     bool                    DIEIsInNamespace (const lldb_private::ClangNamespaceDecl *namespace_decl, 
                                               DWARFCompileUnit* cu, 
                                               const DWARFDebugInfoEntry* die);





More information about the lldb-commits mailing list