Skip to content

Commit 158a431

Browse files
Revert ExtractAPI from https://reviews.llvm.org/D146656
1 parent 767aee1 commit 158a431

File tree

10 files changed

+696
-832
lines changed

10 files changed

+696
-832
lines changed

clang/include/clang/ExtractAPI/ExtractAPIVisitor.h

Lines changed: 12 additions & 592 deletions
Large diffs are not rendered by default.

clang/lib/ExtractAPI/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ add_clang_library(clangExtractAPI
88
APIIgnoresList.cpp
99
AvailabilityInfo.cpp
1010
ExtractAPIConsumer.cpp
11+
ExtractAPIVisitor.cpp
1112
DeclarationFragments.cpp
1213
Serialization/SerializerBase.cpp
1314
Serialization/SymbolGraphSerializer.cpp

clang/lib/ExtractAPI/DeclarationFragments.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//===----------------------------------------------------------------------===//
1313

1414
#include "clang/ExtractAPI/DeclarationFragments.h"
15-
#include "clang/ExtractAPI/TypedefUnderlyingTypeResolver.h"
15+
#include "TypedefUnderlyingTypeResolver.h"
1616
#include "clang/Index/USRGeneration.h"
1717
#include "llvm/ADT/StringSwitch.h"
1818

clang/lib/ExtractAPI/ExtractAPIConsumer.cpp

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@
1212
///
1313
//===----------------------------------------------------------------------===//
1414

15-
#include "clang/AST/ASTConcept.h"
1615
#include "clang/AST/ASTConsumer.h"
1716
#include "clang/AST/ASTContext.h"
18-
#include "clang/AST/DeclObjC.h"
1917
#include "clang/Basic/DiagnosticFrontend.h"
2018
#include "clang/Basic/SourceLocation.h"
2119
#include "clang/Basic/SourceManager.h"
@@ -35,7 +33,6 @@
3533
#include "llvm/ADT/DenseSet.h"
3634
#include "llvm/ADT/STLExtras.h"
3735
#include "llvm/ADT/SmallVector.h"
38-
#include "llvm/Support/Casting.h"
3936
#include "llvm/Support/Error.h"
4037
#include "llvm/Support/FileSystem.h"
4138
#include "llvm/Support/MemoryBuffer.h"
@@ -222,42 +219,19 @@ struct LocationFileChecker {
222219
llvm::DenseSet<const FileEntry *> ExternalFileEntries;
223220
};
224221

225-
struct BatchExtractAPIVisitor : ExtractAPIVisitor<BatchExtractAPIVisitor> {
226-
bool shouldDeclBeIncluded(const Decl *D) const {
227-
bool ShouldBeIncluded = true;
228-
// Check that we have the definition for redeclarable types.
229-
if (auto *TD = llvm::dyn_cast<TagDecl>(D))
230-
ShouldBeIncluded = TD->isThisDeclarationADefinition();
231-
else if (auto *Interface = llvm::dyn_cast<ObjCInterfaceDecl>(D))
232-
ShouldBeIncluded = Interface->isThisDeclarationADefinition();
233-
else if (auto *Protocol = llvm::dyn_cast<ObjCProtocolDecl>(D))
234-
ShouldBeIncluded = Protocol->isThisDeclarationADefinition();
235-
236-
ShouldBeIncluded = ShouldBeIncluded && LCF(D->getLocation());
237-
return ShouldBeIncluded;
238-
}
239-
240-
BatchExtractAPIVisitor(LocationFileChecker &LCF, ASTContext &Context,
241-
APISet &API)
242-
: ExtractAPIVisitor<BatchExtractAPIVisitor>(Context, API), LCF(LCF) {}
243-
244-
private:
245-
LocationFileChecker &LCF;
246-
};
247-
248222
class ExtractAPIConsumer : public ASTConsumer {
249223
public:
250224
ExtractAPIConsumer(ASTContext &Context,
251225
std::unique_ptr<LocationFileChecker> LCF, APISet &API)
252-
: Visitor(*LCF, Context, API), LCF(std::move(LCF)) {}
226+
: Visitor(Context, *LCF, API), LCF(std::move(LCF)) {}
253227

254228
void HandleTranslationUnit(ASTContext &Context) override {
255229
// Use ExtractAPIVisitor to traverse symbol declarations in the context.
256230
Visitor.TraverseDecl(Context.getTranslationUnitDecl());
257231
}
258232

259233
private:
260-
BatchExtractAPIVisitor Visitor;
234+
ExtractAPIVisitor Visitor;
261235
std::unique_ptr<LocationFileChecker> LCF;
262236
};
263237

0 commit comments

Comments
 (0)