[clang] [libclang] Visit function template instantiations (PR #67928)

via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 1 09:53:35 PDT 2023


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 632022e61c544280685763333685b4743f105f2e fa471bdf99b7d4e44f92c6e88af4f3d9876f6b95 -- clang/include/clang-c/Index.h clang/test/Index/index-templates.cpp clang/test/Index/print-display-names.cpp clang/tools/c-index-test/c-index-test.c clang/tools/libclang/CIndex.cpp clang/tools/libclang/CXCursor.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c
index 238c99512..b41aaf00c 100644
--- a/clang/tools/c-index-test/c-index-test.c
+++ b/clang/tools/c-index-test/c-index-test.c
@@ -1039,11 +1039,11 @@ static void PrintCursor(CXCursor Cursor, const char *CommentSchemaFile) {
              clang_getCString(Name), line, column);
       clang_disposeString(Name);
 
-      if (Cursor.kind == CXCursor_FunctionDecl
-          || Cursor.kind == CXCursor_CXXMethod
-          || Cursor.kind == CXCursor_StructDecl
-          || Cursor.kind == CXCursor_ClassDecl
-          || Cursor.kind == CXCursor_ClassTemplatePartialSpecialization) {
+      if (Cursor.kind == CXCursor_FunctionDecl ||
+          Cursor.kind == CXCursor_CXXMethod ||
+          Cursor.kind == CXCursor_StructDecl ||
+          Cursor.kind == CXCursor_ClassDecl ||
+          Cursor.kind == CXCursor_ClassTemplatePartialSpecialization) {
         /* Collect the template parameter kinds from the base template. */
         int NumTemplateArgs = clang_Cursor_getNumTemplateArguments(Cursor);
         int I;
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index aeb685694..7cb85ee61 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -967,8 +967,8 @@ bool CursorVisitor::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) {
 
   for (auto *Child : D->specializations())
     if (Visit(MakeCXCursor(Child, TU)))
-      return true; 
-  
+      return true;
+
   return false;
 }
 

``````````

</details>


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


More information about the cfe-commits mailing list