summaryrefslogtreecommitdiffstats
path: root/lldb
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2016-05-23 18:30:59 +0000
committerSean Callanan <scallanan@apple.com>2016-05-23 18:30:59 +0000
commit5ba3215fe33aaac8d1065a78b1b1f29aa23721ac (patch)
tree518cd521cbf9c02659258bd2c0278f71d419a4c5 /lldb
parent86d5f8ad4cdd93a04b413cc649da247869666f88 (diff)
downloadbcm5719-llvm-5ba3215fe33aaac8d1065a78b1b1f29aa23721ac.tar.gz
bcm5719-llvm-5ba3215fe33aaac8d1065a78b1b1f29aa23721ac.zip
Removed the m_decl_objects map from ClangASTContext.
m_decl_objects is problematic because it assumes that each VarDecl has a unique variable associated with it. This is not the case in inline contexts. Also the information in this map can be reconstructed very easily without maintaining the map. The rest of the testsuite passes with this cange, and I've added a testcase covering the inline contexts affected by this. <rdar://problem/26278502> llvm-svn: 270474
Diffstat (limited to 'lldb')
-rw-r--r--lldb/include/lldb/Symbol/ClangASTContext.h7
-rw-r--r--lldb/include/lldb/Symbol/CompilerDecl.h6
-rw-r--r--lldb/include/lldb/Symbol/GoASTContext.h11
-rw-r--r--lldb/include/lldb/Symbol/JavaASTContext.h6
-rw-r--r--lldb/include/lldb/Symbol/TypeSystem.h6
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py4
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/c/inlines/main.c19
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp11
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp8
-rw-r--r--lldb/source/Symbol/ClangASTContext.cpp18
-rw-r--r--lldb/source/Symbol/CompilerDecl.cpp6
-rw-r--r--lldb/source/Symbol/JavaASTContext.cpp11
-rw-r--r--lldb/source/Symbol/Variable.cpp9
13 files changed, 42 insertions, 80 deletions
diff --git a/lldb/include/lldb/Symbol/ClangASTContext.h b/lldb/include/lldb/Symbol/ClangASTContext.h
index 593440cf0b9..e1d012b12e4 100644
--- a/lldb/include/lldb/Symbol/ClangASTContext.h
+++ b/lldb/include/lldb/Symbol/ClangASTContext.h
@@ -557,12 +557,6 @@ public:
//----------------------------------------------------------------------
// 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 @@ protected:
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:
//------------------------------------------------------------------
diff --git a/lldb/include/lldb/Symbol/CompilerDecl.h b/lldb/include/lldb/Symbol/CompilerDecl.h
index b749e79b459..19654ab165b 100644
--- a/lldb/include/lldb/Symbol/CompilerDecl.h
+++ b/lldb/include/lldb/Symbol/CompilerDecl.h
@@ -65,12 +65,6 @@ public:
IsClang () const;
//----------------------------------------------------------------------
- // Object linked to the decl
- //----------------------------------------------------------------------
- lldb::VariableSP
- GetAsVariable ();
-
- //----------------------------------------------------------------------
// Accessors
//----------------------------------------------------------------------
diff --git a/lldb/include/lldb/Symbol/GoASTContext.h b/lldb/include/lldb/Symbol/GoASTContext.h
index d37ddfa8ea9..ec0203bc322 100644
--- a/lldb/include/lldb/Symbol/GoASTContext.h
+++ b/lldb/include/lldb/Symbol/GoASTContext.h
@@ -85,17 +85,6 @@ class GoASTContext : public TypeSystem
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
//----------------------------------------------------------------------
diff --git a/lldb/include/lldb/Symbol/JavaASTContext.h b/lldb/include/lldb/Symbol/JavaASTContext.h
index 707b9299b1c..7d5a37649f6 100644
--- a/lldb/include/lldb/Symbol/JavaASTContext.h
+++ b/lldb/include/lldb/Symbol/JavaASTContext.h
@@ -70,12 +70,6 @@ public:
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
//----------------------------------------------------------------------
diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h
index 2fc7d13ecb5..6b0e73d4217 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -127,12 +127,6 @@ public:
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);
diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py b/lldb/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py
new file mode 100644
index 00000000000..f08c0dcbda9
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py
@@ -0,0 +1,4 @@
+from lldbsuite.test import lldbinline
+from lldbsuite.test import decorators
+
+lldbinline.MakeInlineTest(__file__, globals(), [])
diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/inlines/main.c b/lldb/packages/Python/lldbsuite/test/lang/c/inlines/main.c
new file mode 100644
index 00000000000..1bf4cdafdaa
--- /dev/null
+++ b/lldb/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);
+}
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index a0d33f70dee..7aeff6e964f 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -1260,7 +1260,16 @@ ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context,
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;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 2c7914ad593..45808902e5a 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -3607,6 +3607,14 @@ DWARFASTParserClang::GetClangDeclForDIE (const DWARFDIE &die)
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())
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index 44683e71c62..84116ce8301 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -9595,24 +9595,6 @@ ClangASTContext::LayoutRecordType(void *baton,
//----------------------------------------------------------------------
// 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)
diff --git a/lldb/source/Symbol/CompilerDecl.cpp b/lldb/source/Symbol/CompilerDecl.cpp
index 42e5fb08107..98eef060df0 100644
--- a/lldb/source/Symbol/CompilerDecl.cpp
+++ b/lldb/source/Symbol/CompilerDecl.cpp
@@ -31,12 +31,6 @@ CompilerDecl::GetMangledName () const
return m_type_system->DeclGetMangledName(m_opaque_decl);
}
-lldb::VariableSP
-CompilerDecl::GetAsVariable ()
-{
- return m_type_system->DeclGetVariable(m_opaque_decl);
-}
-
CompilerDeclContext
CompilerDecl::GetDeclContext() const
{
diff --git a/lldb/source/Symbol/JavaASTContext.cpp b/lldb/source/Symbol/JavaASTContext.cpp
index c0cc007a42a..45cda8d5112 100644
--- a/lldb/source/Symbol/JavaASTContext.cpp
+++ b/lldb/source/Symbol/JavaASTContext.cpp
@@ -535,17 +535,6 @@ JavaASTContext::DeclGetName(void *opaque_decl)
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)
{
diff --git a/lldb/source/Symbol/Variable.cpp b/lldb/source/Symbol/Variable.cpp
index 29fe4bbd262..7bac02d89f9 100644
--- a/lldb/source/Symbol/Variable.cpp
+++ b/lldb/source/Symbol/Variable.cpp
@@ -252,15 +252,8 @@ Variable::GetDeclContext ()
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
OpenPOWER on IntegriCloud