[Lldb-commits] [lldb] r141832 - in /lldb/trunk/source/Plugins/SymbolFile/DWARF: SymbolFileDWARF.cpp SymbolFileDWARF.h
Greg Clayton
gclayton at apple.com
Wed Oct 12 16:34:26 PDT 2011
Author: gclayton
Date: Wed Oct 12 18:34:26 2011
New Revision: 141832
URL: http://llvm.org/viewvc/llvm-project?rev=141832&view=rev
Log:
Added the ability to see if a DIE is contained in a namespace.
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=141832&r1=141831&r2=141832&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Wed Oct 12 18:34:26 2011
@@ -1944,7 +1944,43 @@
#endif
}
}
+bool
+SymbolFileDWARF::DIEIsInNamespace (const ClangNamespaceDecl *namespace_decl,
+ DWARFCompileUnit* cu,
+ const DWARFDebugInfoEntry* die)
+{
+ // 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)
+ {
+ if (decl_ctx_die->Tag() != DW_TAG_namespace)
+ return false;
+ DeclContextToDIEMap::iterator pos = m_decl_ctx_to_die.find(clang_namespace_decl);
+
+ if (pos == m_decl_ctx_to_die.end())
+ return false;
+
+ return decl_ctx_die == pos->second;
+ }
+ else
+ {
+ // We have a namespace_decl that was not NULL but it contained
+ // a NULL "clang::NamespaceDecl", so this means the global namespace
+ // So as long the the contained decl context DIE isn't a namespace
+ // we should be ok.
+ if (decl_ctx_die->Tag() != DW_TAG_namespace)
+ return true;
+ }
+ }
+ return false;
+}
uint32_t
SymbolFileDWARF::FindGlobalVariables (const ConstString &name, bool append, uint32_t max_matches, VariableList& variables)
{
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=141832&r1=141831&r2=141832&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Wed Oct 12 18:34:26 2011
@@ -249,6 +249,10 @@
flagsGotDebugNamesData = (1 << 11),
flagsGotDebugTypesData = (1 << 12)
};
+
+ bool DIEIsInNamespace (const lldb_private::ClangNamespaceDecl *namespace_decl,
+ DWARFCompileUnit* cu,
+ const DWARFDebugInfoEntry* die);
DISALLOW_COPY_AND_ASSIGN (SymbolFileDWARF);
bool ParseCompileUnit (DWARFCompileUnit* cu, lldb::CompUnitSP& compile_unit_sp);
More information about the lldb-commits
mailing list