|
12 | 12 | ///
|
13 | 13 | //===----------------------------------------------------------------------===//
|
14 | 14 |
|
15 |
| -#include "clang/AST/ASTConcept.h" |
16 | 15 | #include "clang/AST/ASTConsumer.h"
|
17 | 16 | #include "clang/AST/ASTContext.h"
|
18 |
| -#include "clang/AST/DeclObjC.h" |
19 | 17 | #include "clang/Basic/DiagnosticFrontend.h"
|
20 | 18 | #include "clang/Basic/SourceLocation.h"
|
21 | 19 | #include "clang/Basic/SourceManager.h"
|
|
35 | 33 | #include "llvm/ADT/DenseSet.h"
|
36 | 34 | #include "llvm/ADT/STLExtras.h"
|
37 | 35 | #include "llvm/ADT/SmallVector.h"
|
38 |
| -#include "llvm/Support/Casting.h" |
39 | 36 | #include "llvm/Support/Error.h"
|
40 | 37 | #include "llvm/Support/FileSystem.h"
|
41 | 38 | #include "llvm/Support/MemoryBuffer.h"
|
@@ -222,42 +219,19 @@ struct LocationFileChecker {
|
222 | 219 | llvm::DenseSet<const FileEntry *> ExternalFileEntries;
|
223 | 220 | };
|
224 | 221 |
|
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 |
| - |
248 | 222 | class ExtractAPIConsumer : public ASTConsumer {
|
249 | 223 | public:
|
250 | 224 | ExtractAPIConsumer(ASTContext &Context,
|
251 | 225 | 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)) {} |
253 | 227 |
|
254 | 228 | void HandleTranslationUnit(ASTContext &Context) override {
|
255 | 229 | // Use ExtractAPIVisitor to traverse symbol declarations in the context.
|
256 | 230 | Visitor.TraverseDecl(Context.getTranslationUnitDecl());
|
257 | 231 | }
|
258 | 232 |
|
259 | 233 | private:
|
260 |
| - BatchExtractAPIVisitor Visitor; |
| 234 | + ExtractAPIVisitor Visitor; |
261 | 235 | std::unique_ptr<LocationFileChecker> LCF;
|
262 | 236 | };
|
263 | 237 |
|
|
0 commit comments