Skip to content

Commit

Permalink
[clang-doc] clang-format + addressing pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterChou1 committed Jul 11, 2024
1 parent 74c7e08 commit d0cab22
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
17 changes: 7 additions & 10 deletions clang-tools-extra/clang-doc/Mapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,9 @@ namespace doc {
static llvm::StringSet USRVisited;
static llvm::sys::Mutex USRVisitedGuard;


template <typename T> bool isTypedefAnonRecord(const T* D) {
template <typename T> bool isTypedefAnonRecord(const T *D) {
if (const auto *C = dyn_cast<CXXRecordDecl>(D)) {
if (const TypedefNameDecl *TD = C->getTypedefNameForAnonDecl()) {
return true;
}
return C->getTypedefNameForAnonDecl();
}
return false;
}
Expand All @@ -35,8 +32,8 @@ void MapASTVisitor::HandleTranslationUnit(ASTContext &Context) {
TraverseDecl(Context.getTranslationUnitDecl());
}

template <typename T> bool MapASTVisitor::mapDecl(const T *D,
bool IsDefinition) {
template <typename T>
bool MapASTVisitor::mapDecl(const T *D, bool IsDefinition) {
// If we're looking a decl not in user files, skip this decl.
if (D->getASTContext().getSourceManager().isInSystemHeader(D->getLocation()))
return true;
Expand Down Expand Up @@ -80,7 +77,7 @@ template <typename T> bool MapASTVisitor::mapDecl(const T *D,
}

bool MapASTVisitor::VisitNamespaceDecl(const NamespaceDecl *D) {
return mapDecl(D, true);
return mapDecl(D, /*isDefinition=*/true);
}

bool MapASTVisitor::VisitRecordDecl(const RecordDecl *D) {
Expand All @@ -103,11 +100,11 @@ bool MapASTVisitor::VisitFunctionDecl(const FunctionDecl *D) {
}

bool MapASTVisitor::VisitTypedefDecl(const TypedefDecl *D) {
return mapDecl(D, true);
return mapDecl(D, /*isDefinition=*/true);
}

bool MapASTVisitor::VisitTypeAliasDecl(const TypeAliasDecl *D) {
return mapDecl(D, true);
return mapDecl(D, /*isDefinition=*/true);
}

comments::FullComment *
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clang-doc/Mapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class MapASTVisitor : public clang::RecursiveASTVisitor<MapASTVisitor>,
bool VisitTypeAliasDecl(const TypeAliasDecl *D);

private:
template <typename T> bool mapDecl(const T *D, bool isDefinition);
template <typename T> bool mapDecl(const T *D, bool IsDefinition);

int getLine(const NamedDecl *D, const ASTContext &Context) const;
llvm::SmallString<128> getFile(const NamedDecl *D, const ASTContext &Context,
Expand Down

0 comments on commit d0cab22

Please sign in to comment.