[llvm-branch-commits] [clang-tools-extra] [clang-doc] Use LangOpts when printing types (PR #120308)

Paul Kirth via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Dec 17 14:16:03 PST 2024


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

>From ac3ce2e8bacdf6b2e7f7d812b16b2854d5ca34f2 Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulkirth at google.com>
Date: Tue, 17 Dec 2024 13:58:09 -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]
---
 clang-tools-extra/test/clang-doc/basic.cpp | 136 +++++++++++++++++++++
 1 file changed, 136 insertions(+)
 create mode 100644 clang-tools-extra/test/clang-doc/basic.cpp

diff --git a/clang-tools-extra/test/clang-doc/basic.cpp b/clang-tools-extra/test/clang-doc/basic.cpp
new file mode 100644
index 00000000000000..318a271a9af04e
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/basic.cpp
@@ -0,0 +1,136 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+
+// RUN: clang-doc --doxygen --executor=standalone %s -output=%t/docs
+// RUN: cat %t/docs/index.yaml | FileCheck %s --check-prefix=YAML
+
+// RUN: clang-doc --doxygen --executor=standalone %s -output=%t/docs --format=md
+// RUN: cat %t/docs/GlobalNamespace/index.md | FileCheck %s --check-prefix=MD
+
+//      YAML: ---
+// YAML-NEXT: USR:             '0000000000000000000000000000000000000000'
+// YAML-NEXT: ChildFunctions:
+
+// MD: # Global Namespace
+// MD: ## Functions
+
+extern bool b();
+
+// YAML-NEXT:   - USR:             '88A104C263241E354ECF5B55B04AE8CEAD625B71'
+// YAML-NEXT:     Name:            'b'
+// YAML-NEXT:     Location:
+// YAML-NEXT:       - LineNumber:      [[# @LINE-5]]
+// YAML-NEXT:         Filename:        '{{.*}}'
+// YAML-NEXT:     ReturnType:
+// YAML-NEXT:       Type:
+// YAML-NEXT:         Name:            '_Bool'
+// YAML-NEXT:         QualName:        '_Bool'
+
+// MD: ### b
+// MD: *_Bool b()*
+
+char c();
+
+// YAML-NEXT:   - USR:             'EA3287837B3F175C8DB154406B4DAD2924F479B5'
+// YAML-NEXT:     Name:            'c'
+// YAML-NEXT:     Location:
+// YAML-NEXT:       - LineNumber:      [[# @LINE-5]]
+// YAML-NEXT:         Filename:        '{{.*}}'
+// YAML-NEXT:     ReturnType:
+// YAML-NEXT:       Type:
+// YAML-NEXT:         Name:            'char'
+// YAML-NEXT:         QualName:        'char'
+
+// MD: ### c
+// MD: *char c()*
+
+double d();
+
+// YAML-NEXT:   - USR:             '60A47E4696CEFC411AB2E1EEFA2DD914E2A7E450'
+// YAML-NEXT:     Name:            'd'
+// YAML-NEXT:     Location:
+// YAML-NEXT:       - LineNumber:      [[# @LINE-5]]
+// YAML-NEXT:         Filename:        '{{.*}}'
+// YAML-NEXT:     ReturnType:
+// YAML-NEXT:       Type:
+// YAML-NEXT:         Name:            'double'
+// YAML-NEXT:         QualName:        'double'
+
+// MD: ### d
+// MD: *double d()*
+
+float f();
+
+// YAML-NEXT:   - USR:             'B3A9EC6BECD5869CF3ACDFB25153CFE6BBDD5EAB'
+// YAML-NEXT:     Name:            'f'
+// YAML-NEXT:     Location:
+// YAML-NEXT:       - LineNumber:      [[# @LINE-5]]
+// YAML-NEXT:         Filename:        '{{.*}}'
+// YAML-NEXT:     ReturnType:
+// YAML-NEXT:       Type:
+// YAML-NEXT:         Name:            'float'
+// YAML-NEXT:         QualName:        'float'
+
+// MD: ### f
+// MD: *float f()*
+
+int i();
+
+// YAML-NEXT:   - USR:             '307041280A81EB46F949A94AD52587C659FD801C'
+// YAML-NEXT:     Name:            'i'
+// YAML-NEXT:     Location:
+// YAML-NEXT:       - LineNumber:      [[# @LINE-5]]
+// YAML-NEXT:         Filename:        '{{.*}}'
+// YAML-NEXT:     ReturnType:
+// YAML-NEXT:       Type:
+// YAML-NEXT:         Name:            'int'
+// YAML-NEXT:         QualName:        'int'
+
+// MD: ### i
+// MD: *int i()*
+
+long l();
+
+// YAML-NEXT:   - USR:             'A1CE9AB0064C412F857592E01332C641C1A06F37'
+// YAML-NEXT:     Name:            'l'
+// YAML-NEXT:     Location:
+// YAML-NEXT:       - LineNumber:      [[# @LINE-5]]
+// YAML-NEXT:         Filename:        '{{.*}}'
+// YAML-NEXT:     ReturnType:
+// YAML-NEXT:       Type:
+// YAML-NEXT:         Name:            'long'
+// YAML-NEXT:         QualName:        'long'
+
+// MD: ### l
+// MD: *long l()*
+
+long long ll();
+
+// YAML-NEXT:   - USR:             '5C2C44ED4825C066EF6ED796863586F343C8BCA9'
+// YAML-NEXT:     Name:            'll'
+// YAML-NEXT:     Location:
+// YAML-NEXT:       - LineNumber:      [[# @LINE-5]]
+// YAML-NEXT:         Filename:        '{{.*}}'
+// YAML-NEXT:     ReturnType:
+// YAML-NEXT:       Type:
+// YAML-NEXT:         Name:            'long long'
+// YAML-NEXT:         QualName:        'long long'
+
+// MD: ### ll
+// MD: *long long ll()*
+
+short s();
+
+// YAML-NEXT:   - USR:             '412341570FD3AD2C3A1E9A1DE7B3C01C07BEACFE'
+// YAML-NEXT:     Name:            's'
+// YAML-NEXT:     Location:
+// YAML-NEXT:       - LineNumber:      [[# @LINE-5]]
+// YAML-NEXT:         Filename:        '{{.*}}'
+// YAML-NEXT:     ReturnType:
+// YAML-NEXT:       Type:
+// YAML-NEXT:         Name:            'short'
+// YAML-NEXT:         QualName:        'short'
+// YAML-NEXT: ...
+
+// MD: ### s
+// MD: *short s()*

>From 67fbc41b7015c1730c325b7e4b4df6b782305eeb Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulkirth at google.com>
Date: Tue, 17 Dec 2024 14:03:47 -0800
Subject: [PATCH 2/2] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?=
 =?UTF-8?q?anges=20introduced=20through=20rebase?=
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]
---
 clang-tools-extra/test/clang-doc/basic.cpp | 136 +++++++++++++++++++++
 1 file changed, 136 insertions(+)
 create mode 100644 clang-tools-extra/test/clang-doc/basic.cpp

diff --git a/clang-tools-extra/test/clang-doc/basic.cpp b/clang-tools-extra/test/clang-doc/basic.cpp
new file mode 100644
index 00000000000000..318a271a9af04e
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/basic.cpp
@@ -0,0 +1,136 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+
+// RUN: clang-doc --doxygen --executor=standalone %s -output=%t/docs
+// RUN: cat %t/docs/index.yaml | FileCheck %s --check-prefix=YAML
+
+// RUN: clang-doc --doxygen --executor=standalone %s -output=%t/docs --format=md
+// RUN: cat %t/docs/GlobalNamespace/index.md | FileCheck %s --check-prefix=MD
+
+//      YAML: ---
+// YAML-NEXT: USR:             '0000000000000000000000000000000000000000'
+// YAML-NEXT: ChildFunctions:
+
+// MD: # Global Namespace
+// MD: ## Functions
+
+extern bool b();
+
+// YAML-NEXT:   - USR:             '88A104C263241E354ECF5B55B04AE8CEAD625B71'
+// YAML-NEXT:     Name:            'b'
+// YAML-NEXT:     Location:
+// YAML-NEXT:       - LineNumber:      [[# @LINE-5]]
+// YAML-NEXT:         Filename:        '{{.*}}'
+// YAML-NEXT:     ReturnType:
+// YAML-NEXT:       Type:
+// YAML-NEXT:         Name:            '_Bool'
+// YAML-NEXT:         QualName:        '_Bool'
+
+// MD: ### b
+// MD: *_Bool b()*
+
+char c();
+
+// YAML-NEXT:   - USR:             'EA3287837B3F175C8DB154406B4DAD2924F479B5'
+// YAML-NEXT:     Name:            'c'
+// YAML-NEXT:     Location:
+// YAML-NEXT:       - LineNumber:      [[# @LINE-5]]
+// YAML-NEXT:         Filename:        '{{.*}}'
+// YAML-NEXT:     ReturnType:
+// YAML-NEXT:       Type:
+// YAML-NEXT:         Name:            'char'
+// YAML-NEXT:         QualName:        'char'
+
+// MD: ### c
+// MD: *char c()*
+
+double d();
+
+// YAML-NEXT:   - USR:             '60A47E4696CEFC411AB2E1EEFA2DD914E2A7E450'
+// YAML-NEXT:     Name:            'd'
+// YAML-NEXT:     Location:
+// YAML-NEXT:       - LineNumber:      [[# @LINE-5]]
+// YAML-NEXT:         Filename:        '{{.*}}'
+// YAML-NEXT:     ReturnType:
+// YAML-NEXT:       Type:
+// YAML-NEXT:         Name:            'double'
+// YAML-NEXT:         QualName:        'double'
+
+// MD: ### d
+// MD: *double d()*
+
+float f();
+
+// YAML-NEXT:   - USR:             'B3A9EC6BECD5869CF3ACDFB25153CFE6BBDD5EAB'
+// YAML-NEXT:     Name:            'f'
+// YAML-NEXT:     Location:
+// YAML-NEXT:       - LineNumber:      [[# @LINE-5]]
+// YAML-NEXT:         Filename:        '{{.*}}'
+// YAML-NEXT:     ReturnType:
+// YAML-NEXT:       Type:
+// YAML-NEXT:         Name:            'float'
+// YAML-NEXT:         QualName:        'float'
+
+// MD: ### f
+// MD: *float f()*
+
+int i();
+
+// YAML-NEXT:   - USR:             '307041280A81EB46F949A94AD52587C659FD801C'
+// YAML-NEXT:     Name:            'i'
+// YAML-NEXT:     Location:
+// YAML-NEXT:       - LineNumber:      [[# @LINE-5]]
+// YAML-NEXT:         Filename:        '{{.*}}'
+// YAML-NEXT:     ReturnType:
+// YAML-NEXT:       Type:
+// YAML-NEXT:         Name:            'int'
+// YAML-NEXT:         QualName:        'int'
+
+// MD: ### i
+// MD: *int i()*
+
+long l();
+
+// YAML-NEXT:   - USR:             'A1CE9AB0064C412F857592E01332C641C1A06F37'
+// YAML-NEXT:     Name:            'l'
+// YAML-NEXT:     Location:
+// YAML-NEXT:       - LineNumber:      [[# @LINE-5]]
+// YAML-NEXT:         Filename:        '{{.*}}'
+// YAML-NEXT:     ReturnType:
+// YAML-NEXT:       Type:
+// YAML-NEXT:         Name:            'long'
+// YAML-NEXT:         QualName:        'long'
+
+// MD: ### l
+// MD: *long l()*
+
+long long ll();
+
+// YAML-NEXT:   - USR:             '5C2C44ED4825C066EF6ED796863586F343C8BCA9'
+// YAML-NEXT:     Name:            'll'
+// YAML-NEXT:     Location:
+// YAML-NEXT:       - LineNumber:      [[# @LINE-5]]
+// YAML-NEXT:         Filename:        '{{.*}}'
+// YAML-NEXT:     ReturnType:
+// YAML-NEXT:       Type:
+// YAML-NEXT:         Name:            'long long'
+// YAML-NEXT:         QualName:        'long long'
+
+// MD: ### ll
+// MD: *long long ll()*
+
+short s();
+
+// YAML-NEXT:   - USR:             '412341570FD3AD2C3A1E9A1DE7B3C01C07BEACFE'
+// YAML-NEXT:     Name:            's'
+// YAML-NEXT:     Location:
+// YAML-NEXT:       - LineNumber:      [[# @LINE-5]]
+// YAML-NEXT:         Filename:        '{{.*}}'
+// YAML-NEXT:     ReturnType:
+// YAML-NEXT:       Type:
+// YAML-NEXT:         Name:            'short'
+// YAML-NEXT:         QualName:        'short'
+// YAML-NEXT: ...
+
+// MD: ### s
+// MD: *short s()*



More information about the llvm-branch-commits mailing list