[llvm-branch-commits] [clang-tools-extra] [clang-doc] Add tests for Markdown output with C++ templates (PR #119813)

Paul Kirth via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Dec 13 09:48:32 PST 2024


https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/119813

>From e83d6d47cc414860bbb991e023e70a1071ca27eb Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulkirth at google.com>
Date: Thu, 12 Dec 2024 20:26:53 -0800
Subject: [PATCH 1/2] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?=
 =?UTF-8?q?anges=20to=20main=20this=20commit=20is=20based=20on?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.6-beta.1

[skip ci]
---
 .../test/clang-doc/templates.cpp              | 133 +++++++++---------
 1 file changed, 67 insertions(+), 66 deletions(-)

diff --git a/clang-tools-extra/test/clang-doc/templates.cpp b/clang-tools-extra/test/clang-doc/templates.cpp
index 4d4a25b8d3b820..05a3dab71f48a1 100644
--- a/clang-tools-extra/test/clang-doc/templates.cpp
+++ b/clang-tools-extra/test/clang-doc/templates.cpp
@@ -1,76 +1,77 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
-// RUN: echo "" > %t/compile_flags.txt
-// RUN: cp "%s" "%t/test.cpp"
-// RUN: clang-doc --doxygen --executor=standalone -p %t %t/test.cpp -output=%t/docs
-// RUN: cat %t/docs/index.yaml | FileCheck %s --check-prefix=CHECK
-// RUN: rm -rf %t
+// RUN: clang-doc --doxygen --executor=standalone %s -output=%t/docs
+// RUN: cat %t/docs/index.yaml | FileCheck %s --check-prefix=YAML
+
+// YAML: ---
+// YAML-NEXT: USR:             '{{([0-9A-F]{40})}}'
+
+template<class... T>
+void ParamPackFunction(T... args);
+
+// YAML-NEXT: ChildFunctions:
+// YAML-NEXT:  - USR:             '{{([0-9A-F]{40})}}'
+// YAML-NEXT:    Name:            'ParamPackFunction'
+// YAML-NEXT:    Location:
+// YAML-NEXT:      - LineNumber:      [[# @LINE - 6]]
+// YAML-NEXT:        Filename:        '{{.*}}'
+// YAML-NEXT:    Params:
+// YAML-NEXT:      - Type:
+// YAML-NEXT:          Name:            'T...'
+// YAML-NEXT:          QualName:        'T...'
+// YAML-NEXT:        Name:            'args'
+// YAML-NEXT:    ReturnType:
+// YAML-NEXT:      Type:
+// YAML-NEXT:        Name:            'void'
+// YAML-NEXT:        QualName:        'void'
+// YAML-NEXT:    Template:
+// YAML-NEXT:      Params:
+// YAML-NEXT:        - Contents:        'class... T'
 
 template<typename T, int U = 1>
 void function(T x) {}
 
+// YAML-NEXT:   - USR:             '{{([0-9A-F]{40})}}'
+// YAML-NEXT:     Name:            'function'
+// YAML-NEXT:     DefLocation:
+// YAML-NEXT:       LineNumber:      [[# @LINE - 5]]
+// YAML-NEXT:       Filename:        '{{.*}}'
+// YAML-NEXT:     Params:
+// YAML-NEXT:       - Type:
+// YAML-NEXT:           Name:            'T'
+// YAML-NEXT:           QualName:        'T'
+// YAML-NEXT:         Name:            'x'
+// YAML-NEXT:     ReturnType:
+// YAML-NEXT:       Type:
+// YAML-NEXT:         Name:            'void'
+// YAML-NEXT:         QualName:        'void'
+// YAML-NEXT:     Template:
+// YAML-NEXT:       Params:
+// YAML-NEXT:         - Contents:        'typename T'
+// YAML-NEXT:         - Contents:        'int U = 1'
+
 template<>
 void function<bool, 0>(bool x) {}
 
-template<class... T>
-void ParamPackFunction(T... args);
+// YAML-NEXT:   - USR:             '{{([0-9A-F]{40})}}'
+// YAML-NEXT:     Name:            'function'
+// YAML-NEXT:     DefLocation:
+// YAML-NEXT:       LineNumber:      [[# @LINE - 6]]
+// YAML-NEXT:       Filename:        '{{.*}}'
+// YAML-NEXT:     Params:
+// YAML-NEXT:       - Type:
+// YAML-NEXT:           Name:            '_Bool'
+// YAML-NEXT:           QualName:        '_Bool'
+// YAML-NEXT:         Name:            'x'
+// YAML-NEXT:     ReturnType:
+// YAML-NEXT:       Type:
+// YAML-NEXT:         Name:            'void'
+// YAML-NEXT:         QualName:        'void'
+// YAML-NEXT:     Template:
+// YAML-NEXT:       Specialization:
+// YAML-NEXT:         SpecializationOf: '{{([0-9A-F]{40})}}'
+// YAML-NEXT:         Params:
+// YAML-NEXT:           - Contents:        'bool'
+// YAML-NEXT:           - Contents:        '0'
+// YAML-NEXT: ...
 
-// CHECK: ---
-// CHECK-NEXT: USR:             '{{([0-9A-F]{40})}}'
-// CHECK-NEXT: ChildFunctions:
-// CHECK-NEXT:  - USR:             '{{([0-9A-F]{40})}}'
-// CHECK-NEXT:    Name:            'ParamPackFunction'
-// CHECK-NEXT:    Location:
-// CHECK-NEXT:      - LineNumber:      16
-// CHECK-NEXT:        Filename:        '{{.*}}'
-// CHECK-NEXT:    Params:
-// CHECK-NEXT:      - Type:
-// CHECK-NEXT:          Name:            'T...'
-// CHECK-NEXT:          QualName:        'T...'
-// CHECK-NEXT:        Name:            'args'
-// CHECK-NEXT:    ReturnType:
-// CHECK-NEXT:      Type:
-// CHECK-NEXT:        Name:            'void'
-// CHECK-NEXT:        QualName:        'void'
-// CHECK-NEXT:    Template:
-// CHECK-NEXT:      Params:
-// CHECK-NEXT:        - Contents:        'class... T'
-// CHECK-NEXT:   - USR:             '{{([0-9A-F]{40})}}'
-// CHECK-NEXT:     Name:            'function'
-// CHECK-NEXT:     DefLocation:
-// CHECK-NEXT:       LineNumber:      10
-// CHECK-NEXT:       Filename:        '{{.*}}'
-// CHECK-NEXT:     Params:
-// CHECK-NEXT:       - Type:
-// CHECK-NEXT:           Name:            'T'
-// CHECK-NEXT:           QualName:        'T'
-// CHECK-NEXT:         Name:            'x'
-// CHECK-NEXT:     ReturnType:
-// CHECK-NEXT:       Type:
-// CHECK-NEXT:         Name:            'void'
-// CHECK-NEXT:         QualName:        'void'
-// CHECK-NEXT:     Template:
-// CHECK-NEXT:       Params:
-// CHECK-NEXT:         - Contents:        'typename T'
-// CHECK-NEXT:         - Contents:        'int U = 1'
-// CHECK-NEXT:   - USR:             '{{([0-9A-F]{40})}}'
-// CHECK-NEXT:     Name:            'function'
-// CHECK-NEXT:     DefLocation:
-// CHECK-NEXT:       LineNumber:      12
-// CHECK-NEXT:       Filename:        '{{.*}}'
-// CHECK-NEXT:     Params:
-// CHECK-NEXT:       - Type:
-// CHECK-NEXT:           Name:            '_Bool'
-// CHECK-NEXT:           QualName:        '_Bool'
-// CHECK-NEXT:         Name:            'x'
-// CHECK-NEXT:     ReturnType:
-// CHECK-NEXT:       Type:
-// CHECK-NEXT:         Name:            'void'
-// CHECK-NEXT:         QualName:        'void'
-// CHECK-NEXT:     Template:
-// CHECK-NEXT:       Specialization:
-// CHECK-NEXT:         SpecializationOf: '{{([0-9A-F]{40})}}'
-// CHECK-NEXT:         Params:
-// CHECK-NEXT:           - Contents:        'bool'
-// CHECK-NEXT:           - Contents:        '0'
-// CHECK-NEXT: ...

>From e06d241a608bca23fce277b0a0a6138ea83d296f Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulkirth at google.com>
Date: Fri, 13 Dec 2024 09:33:35 -0800
Subject: [PATCH 2/2] Remove extra newline

Created using spr 1.3.6-beta.1
---
 clang-tools-extra/test/clang-doc/templates.cpp | 1 -
 1 file changed, 1 deletion(-)

diff --git a/clang-tools-extra/test/clang-doc/templates.cpp b/clang-tools-extra/test/clang-doc/templates.cpp
index 536b24161990aa..5ca8768cbdc43c 100644
--- a/clang-tools-extra/test/clang-doc/templates.cpp
+++ b/clang-tools-extra/test/clang-doc/templates.cpp
@@ -93,4 +93,3 @@ void function<bool, 0>(bool x) {}
 // MD: *void function(_Bool x)*
 // MD: *Defined at {{.*}}templates.cpp#[[# @LINE - 27]]*
 
-



More information about the llvm-branch-commits mailing list