-
Notifications
You must be signed in to change notification settings - Fork 341
[lldb] Introduce an ImportedDeclaration and [lldb] Handle @_originallyDefinedIn #9657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
#include "lldb/Core/Address.h" | ||
#include "lldb/Core/ModuleList.h" | ||
#include "lldb/Core/ModuleSpec.h" | ||
#include "lldb/Symbol/ImportedDeclaration.h" | ||
#include "lldb/Symbol/ObjectFile.h" | ||
#include "lldb/Symbol/SymbolContextScope.h" | ||
#include "lldb/Symbol/TypeSystem.h" | ||
|
@@ -437,6 +438,21 @@ class Module : public std::enable_shared_from_this<Module>, | |
/// TypeMap::InsertUnique(...). | ||
void FindTypes(const TypeQuery &query, TypeResults &results); | ||
|
||
/// Finds imported declarations whose name match \p name. | ||
/// | ||
/// \param[in] name | ||
/// The name to search the imported declaration by. | ||
/// | ||
/// \param[in] results | ||
/// Any matching types will be populated into the \a results object. | ||
/// | ||
/// \param[in] find_one | ||
/// If set to true, the search will stop after the first imported | ||
/// declaration is found. | ||
void FindImportedDeclarations(ConstString name, | ||
std::vector<ImportedDeclaration> &results, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unless you need to append to the same vector multiple times, it should probably be a return type. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You do append to the vector multiple times as part of the implementation (for example on |
||
bool find_one); | ||
|
||
/// Get const accessor for the module architecture. | ||
/// | ||
/// \return | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
//===-- ImportedDeclaration.h -----------------------------------*- C++ -*-===// | ||
// | ||
// 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLDB_SYMBOL_IMPORTED_DECLARATION_H | ||
#define LLDB_SYMBOL_IMPORTED_DECLARATION_H | ||
|
||
#include "lldb/Utility/ConstString.h" | ||
#include "lldb/Utility/UserID.h" | ||
|
||
namespace lldb_private { | ||
|
||
struct ImportedDeclaration : public UserID { | ||
|
||
ImportedDeclaration(lldb::user_id_t uid, ConstString name, | ||
SymbolFile *symbol_file) | ||
: UserID(uid), m_name(name), m_symbol_file(symbol_file) {} | ||
|
||
ConstString GetName() const { return m_name; } | ||
|
||
std::vector<lldb_private::CompilerContext> GetDeclContext() const; | ||
|
||
private: | ||
ConstString m_name; | ||
SymbolFile *m_symbol_file = nullptr; | ||
}; | ||
|
||
} // namespace lldb_private | ||
|
||
#endif // LLDB_SYMBOL_IMPORTED_DECLARATION_H |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This API should probably exist upstream, too.