From d0cab22654ab69a6930a5ce8882fd4f68c866df1 Mon Sep 17 00:00:00 2001 From: PeterChou1 Date: Thu, 11 Jul 2024 18:31:56 -0400 Subject: [PATCH] [clang-doc] clang-format + addressing pr comments --- clang-tools-extra/clang-doc/Mapper.cpp | 17 +++++++---------- clang-tools-extra/clang-doc/Mapper.h | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/clang-tools-extra/clang-doc/Mapper.cpp b/clang-tools-extra/clang-doc/Mapper.cpp index 0cbf94e16691ac7..eda6113626a271b 100644 --- a/clang-tools-extra/clang-doc/Mapper.cpp +++ b/clang-tools-extra/clang-doc/Mapper.cpp @@ -21,12 +21,9 @@ namespace doc { static llvm::StringSet USRVisited; static llvm::sys::Mutex USRVisitedGuard; - -template bool isTypedefAnonRecord(const T* D) { +template bool isTypedefAnonRecord(const T *D) { if (const auto *C = dyn_cast(D)) { - if (const TypedefNameDecl *TD = C->getTypedefNameForAnonDecl()) { - return true; - } + return C->getTypedefNameForAnonDecl(); } return false; } @@ -35,8 +32,8 @@ void MapASTVisitor::HandleTranslationUnit(ASTContext &Context) { TraverseDecl(Context.getTranslationUnitDecl()); } -template bool MapASTVisitor::mapDecl(const T *D, - bool IsDefinition) { +template +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; @@ -80,7 +77,7 @@ template 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) { @@ -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 * diff --git a/clang-tools-extra/clang-doc/Mapper.h b/clang-tools-extra/clang-doc/Mapper.h index c1315b93786c02a..75c8e947c8f9036 100644 --- a/clang-tools-extra/clang-doc/Mapper.h +++ b/clang-tools-extra/clang-doc/Mapper.h @@ -43,7 +43,7 @@ class MapASTVisitor : public clang::RecursiveASTVisitor, bool VisitTypeAliasDecl(const TypeAliasDecl *D); private: - template bool mapDecl(const T *D, bool isDefinition); + template 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,