2015-08-24 23:46:31 +00:00
|
|
|
//===-- CompilerDeclContext.cpp ---------------------------------*- C++ -*-===//
|
|
|
|
|
//
|
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
|
//
|
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
|
//
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
|
|
#include "lldb/Symbol/CompilerDeclContext.h"
|
2015-09-15 23:44:17 +00:00
|
|
|
#include "lldb/Symbol/CompilerDecl.h"
|
2015-08-24 23:46:31 +00:00
|
|
|
#include "lldb/Symbol/TypeSystem.h"
|
2015-09-15 23:44:17 +00:00
|
|
|
#include <vector>
|
2015-08-24 23:46:31 +00:00
|
|
|
|
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
2015-09-15 23:44:17 +00:00
|
|
|
std::vector<CompilerDecl>
|
2016-02-05 19:10:04 +00:00
|
|
|
CompilerDeclContext::FindDeclByName (ConstString name, const bool ignore_using_decls)
|
2015-09-15 23:44:17 +00:00
|
|
|
{
|
|
|
|
|
if (IsValid())
|
2016-02-05 19:10:04 +00:00
|
|
|
return m_type_system->DeclContextFindDeclByName(
|
|
|
|
|
m_opaque_decl_ctx, name, ignore_using_decls);
|
2015-12-08 18:39:50 +00:00
|
|
|
else
|
|
|
|
|
return std::vector<CompilerDecl>();
|
2015-09-15 23:44:17 +00:00
|
|
|
}
|
|
|
|
|
|
2015-08-24 23:46:31 +00:00
|
|
|
bool
|
|
|
|
|
CompilerDeclContext::IsClang () const
|
|
|
|
|
{
|
2015-09-08 18:15:05 +00:00
|
|
|
return IsValid() && m_type_system->getKind() == TypeSystem::eKindClang;
|
2015-08-24 23:46:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ConstString
|
|
|
|
|
CompilerDeclContext::GetName () const
|
|
|
|
|
{
|
|
|
|
|
if (IsValid())
|
|
|
|
|
return m_type_system->DeclContextGetName(m_opaque_decl_ctx);
|
|
|
|
|
else
|
|
|
|
|
return ConstString();
|
|
|
|
|
}
|
|
|
|
|
|
Better scheme to lookup alternate mangled name when looking up function address.
Summary:
This change is relevant for inferiors compiled with GCC. GCC does not
emit complete debug info for std::basic_string<...>, and consequently, Clang
(the LLDB compiler) does not generate correct mangled names for certain
functions.
This change removes the hard-coded alternate names in
ItaniumABILanguageRuntime.cpp.
Before the hard-coded names were put in ItaniumABILanguageRuntime.cpp, one could
not evaluate std::string methods (ex. std::string::length). After putting in
the hard-coded names, one could evaluate them. However, it did not still
enable one to call methods on, say for example, std::vector<string>.
This change makes that possible.
There is some amount of incompleteness in this change. Consider the
following example:
std::string hello("hello"), world("world");
std::map<std::string, std::string> m;
m[hello] = world;
One can still not evaluate the expression "m[hello]" in LLDB. Will
address this issue in another pass.
Reviewers: jingham, vharron, evgeny777, spyffe, dawn
Subscribers: clayborg, dawn, lldb-commits
Differential Revision: http://reviews.llvm.org/D12809
llvm-svn: 257113
2016-01-07 23:32:34 +00:00
|
|
|
ConstString
|
|
|
|
|
CompilerDeclContext::GetScopeQualifiedName () const
|
|
|
|
|
{
|
|
|
|
|
if (IsValid())
|
|
|
|
|
return m_type_system->DeclContextGetScopeQualifiedName(m_opaque_decl_ctx);
|
|
|
|
|
else
|
|
|
|
|
return ConstString();
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-24 23:46:31 +00:00
|
|
|
bool
|
|
|
|
|
CompilerDeclContext::IsStructUnionOrClass () const
|
|
|
|
|
{
|
|
|
|
|
if (IsValid())
|
|
|
|
|
return m_type_system->DeclContextIsStructUnionOrClass(m_opaque_decl_ctx);
|
|
|
|
|
else
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
CompilerDeclContext::IsClassMethod (lldb::LanguageType *language_ptr,
|
|
|
|
|
bool *is_instance_method_ptr,
|
|
|
|
|
ConstString *language_object_name_ptr)
|
|
|
|
|
{
|
|
|
|
|
if (IsValid())
|
|
|
|
|
return m_type_system->DeclContextIsClassMethod (m_opaque_decl_ctx,
|
|
|
|
|
language_ptr,
|
|
|
|
|
is_instance_method_ptr,
|
|
|
|
|
language_object_name_ptr);
|
|
|
|
|
else
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
lldb_private::operator == (const lldb_private::CompilerDeclContext &lhs, const lldb_private::CompilerDeclContext &rhs)
|
|
|
|
|
{
|
|
|
|
|
return lhs.GetTypeSystem() == rhs.GetTypeSystem() && lhs.GetOpaqueDeclContext() == rhs.GetOpaqueDeclContext();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
lldb_private::operator != (const lldb_private::CompilerDeclContext &lhs, const lldb_private::CompilerDeclContext &rhs)
|
|
|
|
|
{
|
|
|
|
|
return lhs.GetTypeSystem() != rhs.GetTypeSystem() || lhs.GetOpaqueDeclContext() != rhs.GetOpaqueDeclContext();
|
|
|
|
|
}
|