[lldb][NFC] Fix all formatting errors in .cpp file headers
Summary:
A *.cpp file header in LLDB (and in LLDB) should like this:
```
//===-- TestUtilities.cpp -------------------------------------------------===//
```
However in LLDB most of our source files have arbitrary changes to this format and
these changes are spreading through LLDB as folks usually just use the existing
source files as templates for their new files (most notably the unnecessary
editor language indicator `-*- C++ -*-` is spreading and in every review
someone is pointing out that this is wrong, resulting in people pointing out that this
is done in the same way in other files).
This patch removes most of these inconsistencies including the editor language indicators,
all the different missing/additional '-' characters, files that center the file name, missing
trailing `===//` (mostly caused by clang-format breaking the line).
Reviewers: aprantl, espindola, jfb, shafik, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: dexonsmith, wuzish, emaste, sdardis, nemanjai, kbarton, MaskRay, atanasyan, arphaman, jfb, abidh, jsji, JDevlieghere, usaxena95, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D73258
2020-01-24 15:23:27 +08:00
|
|
|
//===-- CompilerDeclContext.cpp -------------------------------------------===//
|
2015-08-25 07:46:31 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2015-08-25 07:46:31 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/Symbol/CompilerDeclContext.h"
|
2015-09-16 07:44:17 +08:00
|
|
|
#include "lldb/Symbol/CompilerDecl.h"
|
2015-08-25 07:46:31 +08:00
|
|
|
#include "lldb/Symbol/TypeSystem.h"
|
2015-09-16 07:44:17 +08:00
|
|
|
#include <vector>
|
2015-08-25 07:46:31 +08:00
|
|
|
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
2015-09-16 07:44:17 +08:00
|
|
|
std::vector<CompilerDecl>
|
2016-02-06 03:10:04 +08:00
|
|
|
CompilerDeclContext::FindDeclByName(ConstString name,
|
|
|
|
const bool ignore_using_decls) {
|
2015-09-16 07:44:17 +08:00
|
|
|
if (IsValid())
|
2016-02-06 03:10:04 +08:00
|
|
|
return m_type_system->DeclContextFindDeclByName(m_opaque_decl_ctx, name,
|
|
|
|
ignore_using_decls);
|
2019-12-23 18:49:25 +08:00
|
|
|
return std::vector<CompilerDecl>();
|
2015-09-16 07:44:17 +08:00
|
|
|
}
|
|
|
|
|
2015-08-25 07:46:31 +08:00
|
|
|
ConstString CompilerDeclContext::GetName() const {
|
|
|
|
if (IsValid())
|
|
|
|
return m_type_system->DeclContextGetName(m_opaque_decl_ctx);
|
2019-12-23 18:49:25 +08:00
|
|
|
return ConstString();
|
2015-08-25 07:46:31 +08:00
|
|
|
}
|
|
|
|
|
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-08 07:32:34 +08:00
|
|
|
ConstString CompilerDeclContext::GetScopeQualifiedName() const {
|
|
|
|
if (IsValid())
|
|
|
|
return m_type_system->DeclContextGetScopeQualifiedName(m_opaque_decl_ctx);
|
2019-12-23 18:49:25 +08:00
|
|
|
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-08 07:32:34 +08:00
|
|
|
}
|
|
|
|
|
2015-08-25 07:46:31 +08:00
|
|
|
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);
|
2019-12-23 18:49:25 +08:00
|
|
|
return false;
|
2015-08-25 07:46:31 +08:00
|
|
|
}
|
|
|
|
|
2019-03-12 15:45:04 +08:00
|
|
|
bool CompilerDeclContext::IsContainedInLookup(CompilerDeclContext other) const {
|
|
|
|
if (!IsValid())
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// If the other context is just the current context, we don't need to go
|
|
|
|
// over the type system to know that the lookup is identical.
|
|
|
|
if (this == &other)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return m_type_system->DeclContextIsContainedInLookup(m_opaque_decl_ctx,
|
|
|
|
other.m_opaque_decl_ctx);
|
|
|
|
}
|
|
|
|
|
2015-08-25 07:46:31 +08:00
|
|
|
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();
|
|
|
|
}
|