template <typename Derived>
class ExtractAPIVisitorBase : public RecursiveASTVisitor<Derived> {
-public:
+protected:
ExtractAPIVisitorBase(ASTContext &Context, APISet &API)
: Context(Context), API(API) {}
+public:
const APISet &getAPI() const { return API; }
bool VisitVarDecl(const VarDecl *Decl);
}
private:
- Derived &getConcrete() { return *static_cast<Derived *>(this); }
+ Derived &getDerivedExtractAPIVisitor() {
+ return *static_cast<Derived *>(this);
+ }
};
template <typename Derived>
Decl->getTemplateSpecializationKind() == TSK_Undeclared)
return true;
- if (!getConcrete().shouldDeclBeIncluded(Decl))
+ if (!getDerivedExtractAPIVisitor().shouldDeclBeIncluded(Decl))
return true;
// Collect symbol information.
Context.getSourceManager().getPresumedLoc(Decl->getLocation());
LinkageInfo Linkage = Decl->getLinkageAndVisibility();
DocComment Comment;
- if (auto *RawComment = getConcrete().fetchRawCommentForDecl(Decl))
+ if (auto *RawComment =
+ getDerivedExtractAPIVisitor().fetchRawCommentForDecl(Decl))
Comment = RawComment->getFormattedLines(Context.getSourceManager(),
Context.getDiagnostics());
return true;
}
- if (!getConcrete().shouldDeclBeIncluded(Decl))
+ if (!getDerivedExtractAPIVisitor().shouldDeclBeIncluded(Decl))
return true;
// Collect symbol information.
Context.getSourceManager().getPresumedLoc(Decl->getLocation());
LinkageInfo Linkage = Decl->getLinkageAndVisibility();
DocComment Comment;
- if (auto *RawComment = getConcrete().fetchRawCommentForDecl(Decl))
+ if (auto *RawComment =
+ getDerivedExtractAPIVisitor().fetchRawCommentForDecl(Decl))
Comment = RawComment->getFormattedLines(Context.getSourceManager(),
Context.getDiagnostics());
template <typename Derived>
bool ExtractAPIVisitorBase<Derived>::VisitEnumDecl(const EnumDecl *Decl) {
- if (!getConcrete().shouldDeclBeIncluded(Decl))
+ if (!getDerivedExtractAPIVisitor().shouldDeclBeIncluded(Decl))
return true;
SmallString<128> QualifiedNameBuffer;
PresumedLoc Loc =
Context.getSourceManager().getPresumedLoc(Decl->getLocation());
DocComment Comment;
- if (auto *RawComment = getConcrete().fetchRawCommentForDecl(Decl))
+ if (auto *RawComment =
+ getDerivedExtractAPIVisitor().fetchRawCommentForDecl(Decl))
Comment = RawComment->getFormattedLines(Context.getSourceManager(),
Context.getDiagnostics());
Comment, Declaration, SubHeading, isInSystemHeader(Decl));
// Now collect information about the enumerators in this enum.
- getConcrete().recordEnumConstants(EnumRecord, Decl->enumerators());
+ getDerivedExtractAPIVisitor().recordEnumConstants(EnumRecord,
+ Decl->enumerators());
return true;
}
if (isa<CXXRecordDecl>(Decl))
return true;
- if (!getConcrete().shouldDeclBeIncluded(Decl))
+ if (!getDerivedExtractAPIVisitor().shouldDeclBeIncluded(Decl))
return true;
// Collect symbol information.
PresumedLoc Loc =
Context.getSourceManager().getPresumedLoc(Decl->getLocation());
DocComment Comment;
- if (auto *RawComment = getConcrete().fetchRawCommentForDecl(Decl))
+ if (auto *RawComment =
+ getDerivedExtractAPIVisitor().fetchRawCommentForDecl(Decl))
Comment = RawComment->getFormattedLines(Context.getSourceManager(),
Context.getDiagnostics());
SubHeading, isInSystemHeader(Decl));
// Now collect information about the fields in this struct.
- getConcrete().recordStructFields(StructRecord, Decl->fields());
+ getDerivedExtractAPIVisitor().recordStructFields(StructRecord,
+ Decl->fields());
return true;
}
template <typename Derived>
bool ExtractAPIVisitorBase<Derived>::VisitObjCInterfaceDecl(
const ObjCInterfaceDecl *Decl) {
- if (!getConcrete().shouldDeclBeIncluded(Decl))
+ if (!getDerivedExtractAPIVisitor().shouldDeclBeIncluded(Decl))
return true;
// Collect symbol information.
Context.getSourceManager().getPresumedLoc(Decl->getLocation());
LinkageInfo Linkage = Decl->getLinkageAndVisibility();
DocComment Comment;
- if (auto *RawComment = getConcrete().fetchRawCommentForDecl(Decl))
+ if (auto *RawComment =
+ getDerivedExtractAPIVisitor().fetchRawCommentForDecl(Decl))
Comment = RawComment->getFormattedLines(Context.getSourceManager(),
Context.getDiagnostics());
// Record all methods (selectors). This doesn't include automatically
// synthesized property methods.
- getConcrete().recordObjCMethods(ObjCInterfaceRecord, Decl->methods());
- getConcrete().recordObjCProperties(ObjCInterfaceRecord, Decl->properties());
- getConcrete().recordObjCInstanceVariables(ObjCInterfaceRecord, Decl->ivars());
- getConcrete().recordObjCProtocols(ObjCInterfaceRecord, Decl->protocols());
+ getDerivedExtractAPIVisitor().recordObjCMethods(ObjCInterfaceRecord,
+ Decl->methods());
+ getDerivedExtractAPIVisitor().recordObjCProperties(ObjCInterfaceRecord,
+ Decl->properties());
+ getDerivedExtractAPIVisitor().recordObjCInstanceVariables(ObjCInterfaceRecord,
+ Decl->ivars());
+ getDerivedExtractAPIVisitor().recordObjCProtocols(ObjCInterfaceRecord,
+ Decl->protocols());
return true;
}
template <typename Derived>
bool ExtractAPIVisitorBase<Derived>::VisitObjCProtocolDecl(
const ObjCProtocolDecl *Decl) {
- if (!getConcrete().shouldDeclBeIncluded(Decl))
+ if (!getDerivedExtractAPIVisitor().shouldDeclBeIncluded(Decl))
return true;
// Collect symbol information.
PresumedLoc Loc =
Context.getSourceManager().getPresumedLoc(Decl->getLocation());
DocComment Comment;
- if (auto *RawComment = getConcrete().fetchRawCommentForDecl(Decl))
+ if (auto *RawComment =
+ getDerivedExtractAPIVisitor().fetchRawCommentForDecl(Decl))
Comment = RawComment->getFormattedLines(Context.getSourceManager(),
Context.getDiagnostics());
API.addObjCProtocol(Name, USR, Loc, AvailabilitySet(Decl), Comment,
Declaration, SubHeading, isInSystemHeader(Decl));
- getConcrete().recordObjCMethods(ObjCProtocolRecord, Decl->methods());
- getConcrete().recordObjCProperties(ObjCProtocolRecord, Decl->properties());
- getConcrete().recordObjCProtocols(ObjCProtocolRecord, Decl->protocols());
+ getDerivedExtractAPIVisitor().recordObjCMethods(ObjCProtocolRecord,
+ Decl->methods());
+ getDerivedExtractAPIVisitor().recordObjCProperties(ObjCProtocolRecord,
+ Decl->properties());
+ getDerivedExtractAPIVisitor().recordObjCProtocols(ObjCProtocolRecord,
+ Decl->protocols());
return true;
}
if (!Decl->isDefinedOutsideFunctionOrMethod())
return true;
- if (!getConcrete().shouldDeclBeIncluded(Decl))
+ if (!getDerivedExtractAPIVisitor().shouldDeclBeIncluded(Decl))
return true;
PresumedLoc Loc =
StringRef Name = Decl->getName();
StringRef USR = API.recordUSR(Decl);
DocComment Comment;
- if (auto *RawComment = getConcrete().fetchRawCommentForDecl(Decl))
+ if (auto *RawComment =
+ getDerivedExtractAPIVisitor().fetchRawCommentForDecl(Decl))
Comment = RawComment->getFormattedLines(Context.getSourceManager(),
Context.getDiagnostics());
template <typename Derived>
bool ExtractAPIVisitorBase<Derived>::VisitObjCCategoryDecl(
const ObjCCategoryDecl *Decl) {
- if (!getConcrete().shouldDeclBeIncluded(Decl))
+ if (!getDerivedExtractAPIVisitor().shouldDeclBeIncluded(Decl))
return true;
StringRef Name = Decl->getName();
PresumedLoc Loc =
Context.getSourceManager().getPresumedLoc(Decl->getLocation());
DocComment Comment;
- if (auto *RawComment = getConcrete().fetchRawCommentForDecl(Decl))
+ if (auto *RawComment =
+ getDerivedExtractAPIVisitor().fetchRawCommentForDecl(Decl))
Comment = RawComment->getFormattedLines(Context.getSourceManager(),
Context.getDiagnostics());
// Build declaration fragments and sub-heading for the category.
Name, USR, Loc, AvailabilitySet(Decl), Comment, Declaration, SubHeading,
Interface, isInSystemHeader(Decl));
- getConcrete().recordObjCMethods(ObjCCategoryRecord, Decl->methods());
- getConcrete().recordObjCProperties(ObjCCategoryRecord, Decl->properties());
- getConcrete().recordObjCInstanceVariables(ObjCCategoryRecord, Decl->ivars());
- getConcrete().recordObjCProtocols(ObjCCategoryRecord, Decl->protocols());
+ getDerivedExtractAPIVisitor().recordObjCMethods(ObjCCategoryRecord,
+ Decl->methods());
+ getDerivedExtractAPIVisitor().recordObjCProperties(ObjCCategoryRecord,
+ Decl->properties());
+ getDerivedExtractAPIVisitor().recordObjCInstanceVariables(ObjCCategoryRecord,
+ Decl->ivars());
+ getDerivedExtractAPIVisitor().recordObjCProtocols(ObjCCategoryRecord,
+ Decl->protocols());
return true;
}
PresumedLoc Loc =
Context.getSourceManager().getPresumedLoc(Constant->getLocation());
DocComment Comment;
- if (auto *RawComment = getConcrete().fetchRawCommentForDecl(Constant))
+ if (auto *RawComment =
+ getDerivedExtractAPIVisitor().fetchRawCommentForDecl(Constant))
Comment = RawComment->getFormattedLines(Context.getSourceManager(),
Context.getDiagnostics());
PresumedLoc Loc =
Context.getSourceManager().getPresumedLoc(Field->getLocation());
DocComment Comment;
- if (auto *RawComment = getConcrete().fetchRawCommentForDecl(Field))
+ if (auto *RawComment =
+ getDerivedExtractAPIVisitor().fetchRawCommentForDecl(Field))
Comment = RawComment->getFormattedLines(Context.getSourceManager(),
Context.getDiagnostics());
PresumedLoc Loc =
Context.getSourceManager().getPresumedLoc(Method->getLocation());
DocComment Comment;
- if (auto *RawComment = getConcrete().fetchRawCommentForDecl(Method))
+ if (auto *RawComment =
+ getDerivedExtractAPIVisitor().fetchRawCommentForDecl(Method))
Comment = RawComment->getFormattedLines(Context.getSourceManager(),
Context.getDiagnostics());
PresumedLoc Loc =
Context.getSourceManager().getPresumedLoc(Property->getLocation());
DocComment Comment;
- if (auto *RawComment = getConcrete().fetchRawCommentForDecl(Property))
+ if (auto *RawComment =
+ getDerivedExtractAPIVisitor().fetchRawCommentForDecl(Property))
Comment = RawComment->getFormattedLines(Context.getSourceManager(),
Context.getDiagnostics());
PresumedLoc Loc =
Context.getSourceManager().getPresumedLoc(Ivar->getLocation());
DocComment Comment;
- if (auto *RawComment = getConcrete().fetchRawCommentForDecl(Ivar))
+ if (auto *RawComment =
+ getDerivedExtractAPIVisitor().fetchRawCommentForDecl(Ivar))
Comment = RawComment->getFormattedLines(Context.getSourceManager(),
Context.getDiagnostics());