[clang-tools-extra] [clang-doc] Improve performance by adding a short circuit (PR #96809)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 10 23:24:29 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 7b57a1b4018db0c987fb5a67effbef4d7559c4f1 f86063293b693f5635fc2dfb4347389ce70f90b4 --extensions cpp,h -- clang-tools-extra/clang-doc/Mapper.cpp clang-tools-extra/clang-doc/Mapper.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang-tools-extra/clang-doc/Mapper.cpp b/clang-tools-extra/clang-doc/Mapper.cpp
index 0cbf94e166..a1942ae7d5 100644
--- a/clang-tools-extra/clang-doc/Mapper.cpp
+++ b/clang-tools-extra/clang-doc/Mapper.cpp
@@ -21,8 +21,7 @@ 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;
@@ -35,8 +34,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;

``````````

</details>


https://github.com/llvm/llvm-project/pull/96809


More information about the cfe-commits mailing list