spyffe updated this revision to Diff 57879.
spyffe added a comment.
Added a test case,
Repository:
rL LLVM
http://reviews.llvm.org/D20395
Files:
include/lldb/Symbol/ClangASTContext.h
include/lldb/Symbol/CompilerDecl.h
include/lldb/Symbol/GoASTContext.h
include/lldb/Symbol/JavaASTContext.h
include/lldb/Symbol/TypeSystem.h
packages/Python/lldbsuite/test/lang/c/inlines/TestInlines.py
packages/Python/lldbsuite/test/lang/c/inlines/main.c
source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
source/Symbol/ClangASTContext.cpp
source/Symbol/CompilerDecl.cpp
source/Symbol/JavaASTContext.cpp
source/Symbol/Variable.cpp
Index: include/lldb/Symbol/TypeSystem.h
===================================================================
--- include/lldb/Symbol/TypeSystem.h
+++ include/lldb/Symbol/TypeSystem.h
@@ -127,12 +127,6 @@
virtual ConstString
DeclGetMangledName (void *opaque_decl);
- virtual lldb::VariableSP
- DeclGetVariable (void *opaque_decl) = 0;
-
- virtual void
- DeclLinkToObject (void *opaque_decl, std::shared_ptr<void> object) = 0;
-
virtual CompilerDeclContext
DeclGetDeclContext (void *opaque_decl);
Index: include/lldb/Symbol/JavaASTContext.h
===================================================================
--- include/lldb/Symbol/JavaASTContext.h
+++ include/lldb/Symbol/JavaASTContext.h
@@ -70,12 +70,6 @@
ConstString
DeclGetName(void *opaque_decl) override;
- lldb::VariableSP
- DeclGetVariable(void *opaque_decl) override;
-
- void
- DeclLinkToObject(void *opaque_decl, std::shared_ptr<void> object) override;
-
//----------------------------------------------------------------------
// CompilerDeclContext functions
//----------------------------------------------------------------------
Index: include/lldb/Symbol/GoASTContext.h
===================================================================
--- include/lldb/Symbol/GoASTContext.h
+++ include/lldb/Symbol/GoASTContext.h
@@ -85,17 +85,6 @@
return ConstString();
}
- lldb::VariableSP
- DeclGetVariable (void *opaque_decl) override
- {
- return lldb::VariableSP();
- }
-
- void
- DeclLinkToObject (void *opaque_decl, std::shared_ptr<void> object) override
- {
- }
-
//----------------------------------------------------------------------
// CompilerDeclContext functions
//----------------------------------------------------------------------
Index: include/lldb/Symbol/CompilerDecl.h
===================================================================
--- include/lldb/Symbol/CompilerDecl.h
+++ include/lldb/Symbol/CompilerDecl.h
@@ -65,12 +65,6 @@
IsClang () const;
//----------------------------------------------------------------------
- // Object linked to the decl
- //----------------------------------------------------------------------
- lldb::VariableSP
- GetAsVariable ();
-
- //----------------------------------------------------------------------
// Accessors
//----------------------------------------------------------------------
Index: include/lldb/Symbol/ClangASTContext.h
===================================================================
--- include/lldb/Symbol/ClangASTContext.h
+++ include/lldb/Symbol/ClangASTContext.h
@@ -557,12 +557,6 @@
//----------------------------------------------------------------------
// CompilerDecl override functions
//----------------------------------------------------------------------
- lldb::VariableSP
- DeclGetVariable (void *opaque_decl) override;
-
- void
- DeclLinkToObject (void *opaque_decl, std::shared_ptr<void> object) override;
-
ConstString
DeclGetName (void *opaque_decl) override;
@@ -1218,7 +1212,6 @@
uint32_t m_pointer_byte_size;
bool m_ast_owned;
bool m_can_evaluate_expressions;
- std::map<void *, std::shared_ptr<void>> m_decl_objects;
// clang-format on
private:
//------------------------------------------------------------------
Index: source/Symbol/Variable.cpp
===================================================================
--- source/Symbol/Variable.cpp
+++ source/Symbol/Variable.cpp
@@ -252,15 +252,8 @@
CompilerDecl
Variable::GetDecl ()
{
- CompilerDecl decl;
Type *type = GetType();
- if (type)
- {
- decl = type->GetSymbolFile()->GetDeclForUID(GetID());
- if (decl)
- decl.GetTypeSystem()->DeclLinkToObject(decl.GetOpaqueDecl(), shared_from_this());
- }
- return decl;
+ return type ? type->GetSymbolFile()->GetDeclForUID(GetID()) : CompilerDecl();
}
void
Index: source/Symbol/JavaASTContext.cpp
===================================================================
--- source/Symbol/JavaASTContext.cpp
+++ source/Symbol/JavaASTContext.cpp
@@ -535,17 +535,6 @@
return ConstString();
}
-lldb::VariableSP
-JavaASTContext::DeclGetVariable(void *opaque_decl)
-{
- return lldb::VariableSP();
-}
-
-void
-JavaASTContext::DeclLinkToObject(void *opaque_decl, std::shared_ptr<void> object)
-{
-}
-
std::vector<CompilerDecl>
JavaASTContext::DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name, const bool ignore_imported_decls)
{
Index: source/Symbol/CompilerDecl.cpp
===================================================================
--- source/Symbol/CompilerDecl.cpp
+++ source/Symbol/CompilerDecl.cpp
@@ -31,12 +31,6 @@
return m_type_system->DeclGetMangledName(m_opaque_decl);
}
-lldb::VariableSP
-CompilerDecl::GetAsVariable ()
-{
- return m_type_system->DeclGetVariable(m_opaque_decl);
-}
-
CompilerDeclContext
CompilerDecl::GetDeclContext() const
{
Index: source/Symbol/ClangASTContext.cpp
===================================================================
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -9596,25 +9596,7 @@
//----------------------------------------------------------------------
// CompilerDecl override functions
//----------------------------------------------------------------------
-lldb::VariableSP
-ClangASTContext::DeclGetVariable (void *opaque_decl)
-{
- if (llvm::dyn_cast<clang::VarDecl>((clang::Decl *)opaque_decl))
- {
- auto decl_search_it = m_decl_objects.find(opaque_decl);
- if (decl_search_it != m_decl_objects.end())
- return std::static_pointer_cast<Variable>(decl_search_it->second);
- }
- return VariableSP();
-}
-void
-ClangASTContext::DeclLinkToObject (void *opaque_decl, std::shared_ptr<void> object)
-{
- if (m_decl_objects.find(opaque_decl) == m_decl_objects.end())
- m_decl_objects.insert(std::make_pair(opaque_decl, object));
-}
-
ConstString
ClangASTContext::DeclGetName (void *opaque_decl)
{
Index: source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===================================================================
--- source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -3607,6 +3607,14 @@
m_decl_to_die[decl].insert(die.GetDIE());
return decl;
}
+
+ if (DWARFDIE abstract_origin_die = die.GetReferencedDIE(DW_AT_abstract_origin))
+ {
+ clang::Decl *decl = GetClangDeclForDIE(abstract_origin_die);
+ m_die_to_decl[die.GetDIE()] = decl;
+ m_decl_to_die[decl].insert(die.GetDIE());
+ return decl;
+ }
clang::Decl *decl = nullptr;
switch (die.Tag())
Index: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
===================================================================
--- source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -1260,7 +1260,16 @@
bool variable_found = false;
for (CompilerDecl decl : found_decls)
{
- var = decl.GetAsVariable();
+ for (size_t vi = 0, ve = vars->GetSize(); vi != ve; ++vi)
+ {
+ VariableSP candidate_var = vars->GetVariableAtIndex(vi);
+ if (candidate_var->GetDecl() == decl)
+ {
+ var = candidate_var;
+ break;
+ }
+ }
+
if (var)
{
variable_found = true;
Index: packages/Python/lldbsuite/test/lang/c/inlines/main.c
===================================================================
--- packages/Python/lldbsuite/test/lang/c/inlines/main.c
+++ packages/Python/lldbsuite/test/lang/c/inlines/main.c
@@ -0,0 +1,19 @@
+#include <stdio.h>
+
+void test1(int) __attribute__ ((always_inline));
+void test2(int) __attribute__ ((always_inline));
+
+void test2(int b) {
+ printf("test2(%d)\n", b); //% self.expect("expression b", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["42"])
+}
+
+void test1(int a) {
+ printf("test1(%d)\n", a);
+ test2(a+1);//% self.dbg.HandleCommand("step")
+ //% self.expect("expression b", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["24"])
+}
+
+int main() {
+ test2(42);
+ test1(23);
+}
Index: packages/Python/lldbsuite/test/lang/c/inlines/TestInlines.py
===================================================================
--- packages/Python/lldbsuite/test/lang/c/inlines/TestInlines.py
+++ packages/Python/lldbsuite/test/lang/c/inlines/TestInlines.py
@@ -0,0 +1,4 @@
+from lldbsuite.test import lldbinline
+from lldbsuite.test import decorators
+
+lldbinline.MakeInlineTest(__file__, globals(), [])
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits