diff options
author | Daniel Grumberg <dgrumberg@apple.com> | 2024-08-19 16:06:25 +0100 |
---|---|---|
committer | Daniel Grumberg <dgrumberg@apple.com> | 2024-08-19 16:06:43 +0100 |
commit | b18b4547f1bfaf6da37b29440a96176e807c2e6c (patch) | |
tree | 46fff4f9bd6d8c90d3cd737bbdf526640bebd3a8 /clang/lib/ExtractAPI/API.cpp | |
parent | 7dd6340bdadf86bd0facdea89d1876a5c36dc33b (diff) | |
download | llvm-b18b4547f1bfaf6da37b29440a96176e807c2e6c.zip llvm-b18b4547f1bfaf6da37b29440a96176e807c2e6c.tar.gz llvm-b18b4547f1bfaf6da37b29440a96176e807c2e6c.tar.bz2 |
Revert "[clang][ExtractAPI] Stop dropping fields of nested anonymous record types when they aren't attached to variable declaration (#104600)"
This reverts commit c60da1a271a6bb271e7703b2f7c71fbece67ab78.
Diffstat (limited to 'clang/lib/ExtractAPI/API.cpp')
-rw-r--r-- | clang/lib/ExtractAPI/API.cpp | 53 |
1 files changed, 2 insertions, 51 deletions
diff --git a/clang/lib/ExtractAPI/API.cpp b/clang/lib/ExtractAPI/API.cpp index 9dbc023..ab1108f 100644 --- a/clang/lib/ExtractAPI/API.cpp +++ b/clang/lib/ExtractAPI/API.cpp @@ -13,6 +13,8 @@ //===----------------------------------------------------------------------===// #include "clang/ExtractAPI/API.h" +#include "clang/AST/RawCommentList.h" +#include "clang/Index/USRGeneration.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/ErrorHandling.h" #include <memory> @@ -58,10 +60,6 @@ bool RecordContext::IsWellFormed() const { void RecordContext::stealRecordChain(RecordContext &Other) { assert(IsWellFormed()); - // Other's record chain is empty, nothing to do - if (Other.First == nullptr && Other.Last == nullptr) - return; - // If we don't have an empty chain append Other's chain into ours. if (First) Last->NextInContext = Other.First; @@ -70,10 +68,6 @@ void RecordContext::stealRecordChain(RecordContext &Other) { Last = Other.Last; - for (auto *StolenRecord = Other.First; StolenRecord != nullptr; - StolenRecord = StolenRecord->getNextInContext()) - StolenRecord->Parent = SymbolReference(cast<APIRecord>(this)); - // Delete Other's chain to ensure we don't accidentally traverse it. Other.First = nullptr; Other.Last = nullptr; @@ -91,22 +85,6 @@ void RecordContext::addToRecordChain(APIRecord *Record) const { Last = Record; } -void RecordContext::removeFromRecordChain(APIRecord *Record) { - APIRecord *Prev = nullptr; - for (APIRecord *Curr = First; Curr != Record; Curr = Curr->NextInContext) - Prev = Curr; - - if (Prev) - Prev->NextInContext = Record->NextInContext; - else - First = Record->NextInContext; - - if (Last == Record) - Last = Prev; - - Record->NextInContext = nullptr; -} - APIRecord *APISet::findRecordForUSR(StringRef USR) const { if (USR.empty()) return nullptr; @@ -136,33 +114,6 @@ SymbolReference APISet::createSymbolReference(StringRef Name, StringRef USR, return SymbolReference(copyString(Name), copyString(USR), copyString(Source)); } -void APISet::removeRecord(StringRef USR) { - auto Result = USRBasedLookupTable.find(USR); - if (Result != USRBasedLookupTable.end()) { - auto *Record = Result->getSecond().get(); - auto &ParentReference = Record->Parent; - auto *ParentRecord = const_cast<APIRecord *>(ParentReference.Record); - if (!ParentRecord) - ParentRecord = findRecordForUSR(ParentReference.USR); - - if (auto *ParentCtx = llvm::cast_if_present<RecordContext>(ParentRecord)) { - ParentCtx->removeFromRecordChain(Record); - if (auto *RecordAsCtx = llvm::dyn_cast<RecordContext>(Record)) - ParentCtx->stealRecordChain(*RecordAsCtx); - } else { - TopLevelRecords.erase(Record); - if (auto *RecordAsCtx = llvm::dyn_cast<RecordContext>(Record)) { - for (const auto *Child = RecordAsCtx->First; Child != nullptr; - Child = Child->getNextInContext()) - TopLevelRecords.insert(Child); - } - } - USRBasedLookupTable.erase(Result); - } -} - -void APISet::removeRecord(APIRecord *Record) { removeRecord(Record->USR); } - APIRecord::~APIRecord() {} TagRecord::~TagRecord() {} RecordRecord::~RecordRecord() {} |