aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/ExtractAPI
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/ExtractAPI')
-rw-r--r--clang/lib/ExtractAPI/API.cpp53
-rw-r--r--clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp8
2 files changed, 10 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() {}
diff --git a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
index 1bce9c5..1f8029c 100644
--- a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
+++ b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
@@ -673,6 +673,14 @@ bool SymbolGraphSerializer::shouldSkip(const APIRecord *Record) const {
if (Record->Availability.isUnconditionallyUnavailable())
return true;
+ // Filter out symbols without a name as we can generate correct symbol graphs
+ // for them. In practice these are anonymous record types that aren't attached
+ // to a declaration.
+ if (auto *Tag = dyn_cast<TagRecord>(Record)) {
+ if (Tag->IsEmbeddedInVarDeclarator)
+ return true;
+ }
+
// Filter out symbols prefixed with an underscored as they are understood to
// be symbols clients should not use.
if (Record->Name.starts_with("_"))