Skip to content

[lldb] Remove redecl-completion setting #9977

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

Merged
merged 2 commits into from
Feb 12, 2025
Merged
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
3 changes: 0 additions & 3 deletions clang/include/clang/AST/ASTImporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ class TypeSourceInfo;

/// Whether to perform a minimal import.
bool Minimal;
bool LLDBRedeclCompletion = false;

ODRHandlingType ODRHandling;

Expand Down Expand Up @@ -297,10 +296,8 @@ class TypeSourceInfo;
/// Whether the importer will perform a minimal import, creating
/// to-be-completed forward declarations when possible.
bool isMinimalImport() const { return Minimal; }
bool hasLLDBRedeclCompletion() const { return LLDBRedeclCompletion; }

void setODRHandling(ODRHandlingType T) { ODRHandling = T; }
void setLLDBRedeclCompletion(bool Val) { LLDBRedeclCompletion = Val; }

/// \brief Import the given object, returns the result.
///
Expand Down
5 changes: 0 additions & 5 deletions clang/include/clang/AST/ExternalASTSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,6 @@ class ExternalASTSource : public RefCountedBase<ExternalASTSource> {
virtual bool
FindExternalVisibleDeclsByName(const DeclContext *DC, DeclarationName Name);

virtual bool FindExternalVisibleMethodsByName(const DeclContext *DC,
DeclarationName Name) {
return false;
}

/// Ensures that the table of all visible declarations inside this
/// context is up to date.
///
Expand Down
44 changes: 15 additions & 29 deletions clang/lib/AST/ASTImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1026,8 +1026,7 @@ Expected<LambdaCapture> ASTNodeImporter::import(const LambdaCapture &From) {

template <typename T>
bool ASTNodeImporter::hasSameVisibilityContextAndLinkage(T *Found, T *From) {
if (!Importer.hasLLDBRedeclCompletion() &&
Found->getLinkageInternal() != From->getLinkageInternal())
if (Found->getLinkageInternal() != From->getLinkageInternal())
return false;

if (From->hasExternalFormalLinkage())
Expand Down Expand Up @@ -1972,8 +1971,7 @@ Error ASTNodeImporter::ImportDefinitionIfNeeded(Decl *FromD, Decl *ToD) {
if (RecordDecl *FromRecord = dyn_cast<RecordDecl>(FromD)) {
if (RecordDecl *ToRecord = cast<RecordDecl>(ToD)) {
if (FromRecord->getDefinition() && !ToRecord->getDefinition() &&
(Importer.hasLLDBRedeclCompletion() ||
FromRecord->isCompleteDefinition())) {
FromRecord->isCompleteDefinition()) {
if (Error Err = ImportDefinition(FromRecord, ToRecord))
return Err;
}
Expand Down Expand Up @@ -2075,14 +2073,12 @@ ASTNodeImporter::ImportDeclContext(DeclContext *FromDC, bool ForceImport) {
continue;
}

if (!Importer.hasLLDBRedeclCompletion()) {
FieldDecl *FieldFrom = dyn_cast_or_null<FieldDecl>(From);
Decl *ImportedDecl = *ImportedOrErr;
FieldDecl *FieldTo = dyn_cast_or_null<FieldDecl>(ImportedDecl);
if (FieldFrom && FieldTo) {
Error Err = ImportFieldDeclDefinition(FieldFrom, FieldTo);
HandleChildErrors.handleChildImportResult(ChildErrors, std::move(Err));
}
FieldDecl *FieldFrom = dyn_cast_or_null<FieldDecl>(From);
Decl *ImportedDecl = *ImportedOrErr;
FieldDecl *FieldTo = dyn_cast_or_null<FieldDecl>(ImportedDecl);
if (FieldFrom && FieldTo) {
Error Err = ImportFieldDeclDefinition(FieldFrom, FieldTo);
HandleChildErrors.handleChildImportResult(ChildErrors, std::move(Err));
}
}

Expand Down Expand Up @@ -2243,11 +2239,7 @@ Error ASTNodeImporter::ImportDefinition(
To->completeDefinition();
};

bool hasDef = (Importer.hasLLDBRedeclCompletion() &&
To->isThisDeclarationADefinition()) ||
To->getDefinition();

if (hasDef || To->isBeingDefined()) {
if (To->getDefinition() || To->isBeingDefined()) {
if (Kind == IDK_Everything ||
// In case of lambdas, the class already has a definition ptr set, but
// the contained decls are not imported yet. Also, isBeingDefined was
Expand Down Expand Up @@ -2769,7 +2761,7 @@ ASTNodeImporter::VisitTypedefNameDecl(TypedefNameDecl *D, bool IsAlias) {
continue;
}

if (Importer.hasLLDBRedeclCompletion() && Importer.isMinimalImport())
if (Importer.isMinimalImport())
return Importer.MapImported(D, FoundTypedef);
// If the "From" context has a complete underlying type but we
// already have a complete underlying type then return with that.
Expand Down Expand Up @@ -3042,11 +3034,9 @@ ExpectedDecl ASTNodeImporter::VisitEnumDecl(EnumDecl *D) {
return POIOrErr.takeError();
}

auto Kind = Importer.hasLLDBRedeclCompletion() ? IDK_Everything : IDK_Default;

// Import the definition
if (D->isCompleteDefinition())
if (Error Err = ImportDefinition(D, D2, Kind))
if (Error Err = ImportDefinition(D, D2, IDK_Default))
return std::move(Err);

return D2;
Expand Down Expand Up @@ -3128,8 +3118,7 @@ ExpectedDecl ASTNodeImporter::VisitRecordDecl(RecordDecl *D) {

if (IsStructuralMatch(D, FoundRecord)) {
RecordDecl *FoundDef = FoundRecord->getDefinition();
if (!Importer.hasLLDBRedeclCompletion() &&
D->isThisDeclarationADefinition() && FoundDef) {
if (D->isThisDeclarationADefinition() && FoundDef) {
// FIXME: Structural equivalence check should check for same
// user-defined methods.
Importer.MapImported(D, FoundDef);
Expand Down Expand Up @@ -3300,9 +3289,8 @@ ExpectedDecl ASTNodeImporter::VisitRecordDecl(RecordDecl *D) {
if (D->isAnonymousStructOrUnion())
D2->setAnonymousStructOrUnion(true);

auto Kind = Importer.hasLLDBRedeclCompletion() ? IDK_Everything : IDK_Default;
if (D->isCompleteDefinition())
if (Error Err = ImportDefinition(D, D2, Kind))
if (Error Err = ImportDefinition(D, D2, IDK_Default))
return std::move(Err);

return D2;
Expand Down Expand Up @@ -5486,8 +5474,7 @@ Error ASTNodeImporter::ImportDefinition(
diag::note_odr_objc_missing_superclass);
}

if (Importer.hasLLDBRedeclCompletion() ||
shouldForceImportDeclContext(Kind))
if (shouldForceImportDeclContext(Kind))
if (Error Err = ImportDeclContext(From))
return Err;
return Error::success();
Expand Down Expand Up @@ -6379,9 +6366,8 @@ ExpectedDecl ASTNodeImporter::VisitClassTemplateSpecializationDecl(
}
}

auto Kind = Importer.hasLLDBRedeclCompletion() ? IDK_Everything : IDK_Default;
if (D->isCompleteDefinition())
if (Error Err = ImportDefinition(D, D2, Kind))
if (Error Err = ImportDefinition(D, D2, IDK_Default))
return std::move(Err);

return D2;
Expand Down
7 changes: 0 additions & 7 deletions clang/lib/Sema/SemaExprMember.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -735,13 +735,6 @@ static bool LookupMemberExprInRecord(Sema &SemaRef, LookupResult &R,
DeclContext *DC = SS.isSet() ? SemaRef.computeDeclContext(SS)
: SemaRef.computeDeclContext(RTy);

if (ExternalASTSource *Source =
DC->getParentASTContext().getExternalSource()) {
if (auto LookupName = R.getLookupName()) {
Source->FindExternalVisibleMethodsByName(DC, LookupName);
}
}

struct QueryState {
Sema &SemaRef;
DeclarationNameInfo NameInfo;
Expand Down
8 changes: 0 additions & 8 deletions lldb/include/lldb/Core/PluginManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,6 @@ class PluginManager {
// TypeSystem
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
TypeSystemCreateInstance create_callback,
DebuggerInitializeCallback debugger_callback,
LanguageSet supported_languages_for_types,
LanguageSet supported_languages_for_expressions);

Expand Down Expand Up @@ -558,13 +557,6 @@ class PluginManager {
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
llvm::StringRef description, bool is_global_property);

static lldb::OptionValuePropertiesSP
GetSettingForTypeSystemPlugin(Debugger &debugger, ConstString setting_name);

static bool CreateSettingForTypeSystemPlugin(
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
ConstString description, bool is_global_property);

static bool CreateSettingForTracePlugin(
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
llvm::StringRef description, bool is_global_property);
Expand Down
27 changes: 4 additions & 23 deletions lldb/source/Core/PluginManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1455,11 +1455,10 @@ PluginManager::GetInstrumentationRuntimeCreateCallbackAtIndex(uint32_t idx) {
struct TypeSystemInstance : public PluginInstance<TypeSystemCreateInstance> {
TypeSystemInstance(llvm::StringRef name, llvm::StringRef description,
CallbackType create_callback,
DebuggerInitializeCallback debugger_init_callback,
LanguageSet supported_languages_for_types,
LanguageSet supported_languages_for_expressions)
: PluginInstance<TypeSystemCreateInstance>(
name, description, create_callback, debugger_init_callback),
: PluginInstance<TypeSystemCreateInstance>(name, description,
create_callback),
supported_languages_for_types(supported_languages_for_types),
supported_languages_for_expressions(
supported_languages_for_expressions) {}
Expand All @@ -1478,12 +1477,11 @@ static TypeSystemInstances &GetTypeSystemInstances() {
bool PluginManager::RegisterPlugin(
llvm::StringRef name, llvm::StringRef description,
TypeSystemCreateInstance create_callback,
DebuggerInitializeCallback debugger_init_callback,
LanguageSet supported_languages_for_types,
LanguageSet supported_languages_for_expressions) {
return GetTypeSystemInstances().RegisterPlugin(
name, description, create_callback, debugger_init_callback,
supported_languages_for_types, supported_languages_for_expressions);
name, description, create_callback, supported_languages_for_types,
supported_languages_for_expressions);
}

bool PluginManager::UnregisterPlugin(TypeSystemCreateInstance create_callback) {
Expand Down Expand Up @@ -1762,7 +1760,6 @@ static constexpr llvm::StringLiteral kTracePluginName("trace");
static constexpr llvm::StringLiteral kObjectFilePluginName("object-file");
static constexpr llvm::StringLiteral kSymbolFilePluginName("symbol-file");
static constexpr llvm::StringLiteral kSymbolLocatorPluginName("symbol-locator");
static constexpr llvm::StringLiteral kTypeSystemPluginName("typesystem");
static constexpr llvm::StringLiteral kJITLoaderPluginName("jit-loader");
static constexpr llvm::StringLiteral
kStructuredDataPluginName("structured-data");
Expand Down Expand Up @@ -1861,22 +1858,6 @@ bool PluginManager::CreateSettingForSymbolFilePlugin(
properties_sp, description, is_global_property);
}

lldb::OptionValuePropertiesSP
PluginManager::GetSettingForTypeSystemPlugin(Debugger &debugger,
ConstString setting_name) {
return GetSettingForPlugin(debugger, setting_name,
ConstString(kTypeSystemPluginName));
}

bool PluginManager::CreateSettingForTypeSystemPlugin(
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
ConstString description, bool is_global_property) {
return CreateSettingForPlugin(
debugger, ConstString(kTypeSystemPluginName),
ConstString("Settings for type system plug-ins"), properties_sp,
description, is_global_property);
}

lldb::OptionValuePropertiesSP
PluginManager::GetSettingForJITLoaderPlugin(Debugger &debugger,
llvm::StringRef setting_name) {
Expand Down
Loading