Skip to content

[WIP][lldb] Use forward decls with redeclared definitions instead of minimal import for records #95100

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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#define LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_ASTUTILS_H

#include "clang/Basic/ASTSourceDescriptor.h"
#include "Plugins/TypeSystem/Clang/ImporterBackedASTSource.h"
#include "clang/Basic/Module.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/MultiplexExternalSemaSource.h"
#include "clang/Sema/Sema.h"
Expand All @@ -26,7 +28,7 @@ namespace lldb_private {

/// Wraps an ExternalASTSource into an ExternalSemaSource. Doesn't take
/// ownership of the provided source.
class ExternalASTSourceWrapper : public clang::ExternalSemaSource {
class ExternalASTSourceWrapper : public ImporterBackedASTSource {
ExternalASTSource *m_Source;

public:
Expand Down Expand Up @@ -246,7 +248,7 @@ class ASTConsumerForwarder : public clang::SemaConsumer {
/// provide more accurate replies to the requests, but might not be able to
/// answer all requests. The debug information will be used as a fallback then
/// to provide information that is not in the C++ module.
class SemaSourceWithPriorities : public clang::ExternalSemaSource {
class SemaSourceWithPriorities : public ImporterBackedASTSource {

private:
/// The sources ordered in decreasing priority.
Expand Down Expand Up @@ -279,9 +281,16 @@ class SemaSourceWithPriorities : public clang::ExternalSemaSource {
return nullptr;
}

/// Call ExternalASTSource::CompleteRedeclChain(D)
/// on each AST source. Returns as soon as we got
/// a definition for D.
void CompleteRedeclChain(const clang::Decl *D) override {
for (size_t i = 0; i < Sources.size(); ++i)
for (size_t i = 0; i < Sources.size(); ++i) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while we're here: for (auto source : Sources)?

Sources[i]->CompleteRedeclChain(D);
if (auto *td = llvm::dyn_cast<clang::TagDecl>(D))
if (td->getDefinition())
return;
}
}

clang::Selector GetExternalSelector(uint32_t ID) override {
Expand Down
Loading
Loading