Skip to content

[clang-doc] Precommit test case for functions with templated parameters and return #119814

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

ilovepi
Copy link
Contributor

@ilovepi ilovepi commented Dec 13, 2024

To address #67549 we need a test case that will show up in the markdown
output for functions.

Created using spr 1.3.6-beta.1

[skip ci]
Created using spr 1.3.6-beta.1
@llvmbot
Copy link
Member

llvmbot commented Dec 13, 2024

@llvm/pr-subscribers-clang-tools-extra

Author: Paul Kirth (ilovepi)

Changes

To address #67549 we need a test case that will show up in the markdown
output for functions.


Full diff: https://github.com/llvm/llvm-project/pull/119814.diff

1 Files Affected:

  • (modified) clang-tools-extra/test/clang-doc/templates.cpp (+62-2)
diff --git a/clang-tools-extra/test/clang-doc/templates.cpp b/clang-tools-extra/test/clang-doc/templates.cpp
index 536b24161990aa..bf6528437b6ba9 100644
--- a/clang-tools-extra/test/clang-doc/templates.cpp
+++ b/clang-tools-extra/test/clang-doc/templates.cpp
@@ -9,6 +9,12 @@
 
 // YAML: ---
 // YAML-NEXT: USR:             '{{([0-9A-F]{40})}}'
+// YAML-NEXT: ChildRecords:
+// YAML-NEXT:   - Type:            Record
+// YAML-NEXT:     Name:            'tuple'
+// YAML-NEXT:     QualName:        'tuple'
+// YAML-NEXT:     USR:             '{{([0-9A-F]{40})}}'
+// YAML-NEXT:     Path:            'GlobalNamespace'
 
 // MD: # Global Namespace
 // MD: ## Functions
@@ -87,10 +93,64 @@ void function<bool, 0>(bool x) {}
 // YAML-NEXT:         Params:
 // YAML-NEXT:           - Contents:        'bool'
 // YAML-NEXT:           - Contents:        '0'
-// YAML-NEXT: ...
 
 // MD: ### function
 // MD: *void function(_Bool x)*
-// MD: *Defined at {{.*}}templates.cpp#[[# @LINE - 27]]*
+// MD: *Defined at {{.*}}templates.cpp#[[# @LINE - 26]]*
+
+/// A Tuple type
+///
+/// Does nothing.
+template<typename ...Tys>
+struct tuple{};
+
+/// A function with a tuple parameter
+///
+/// \param t The input to func_with_tuple_param
+tuple<int,int,bool> func_with_tuple_param(tuple<int,int,bool> t){ return t;}
 
+// YAML-NEXT:   - USR:             '{{([0-9A-F]{40})}}'
+// YAML-NEXT:    Name:            'func_with_tuple_param'
+// YAML-NEXT:    Description:
+// YAML-NEXT:      - Kind:            'FullComment'
+// YAML-NEXT:        Children:
+// YAML-NEXT:          - Kind:            'ParagraphComment'
+// YAML-NEXT:            Children:
+// YAML-NEXT:              - Kind:            'TextComment'
+// YAML-NEXT:                Text:            ' A function with a tuple parameter'
+// YAML-NEXT:          - Kind:            'ParagraphComment'
+// YAML-NEXT:            Children:
+// YAML-NEXT:              - Kind:            'TextComment'
+// YAML-NEXT:          - Kind:            'ParamCommandComment'
+// YAML-NEXT:            Direction:       '[in]'
+// YAML-NEXT:            ParamName:       't'
+// YAML-NEXT:            Children:
+// YAML-NEXT:              - Kind:            'ParagraphComment'
+// YAML-NEXT:                Children:
+// YAML-NEXT:                  - Kind:            'TextComment'
+// YAML-NEXT:                    Text:            ' The input to func_with_tuple_param'
+// YAML-NEXT:    DefLocation:
+// YAML-NEXT:      LineNumber:      [[# @LINE - 23]]
+// YAML-NEXT:      Filename:
+// YAML-NEXT:    Params:
+// YAML-NEXT:      - Type:
+// YAML-NEXT:          Type:            Record
+// YAML-NEXT:          Name:            'tuple'
+// YAML-NEXT:          QualName:        'tuple<int, int, _Bool>'
+// YAML-NEXT:          USR:             '{{([0-9A-F]{40})}}'
+// YAML-NEXT:          Path:            'GlobalNamespace'
+// YAML-NEXT:        Name:            't'
+// YAML-NEXT:    ReturnType:
+// YAML-NEXT:      Type:
+// YAML-NEXT:        Type:            Record
+// YAML-NEXT:        Name:            'tuple'
+// YAML-NEXT:        QualName:        'tuple<int, int, _Bool>'
+// YAML-NEXT:        USR:             '{{([0-9A-F]{40})}}'
+// YAML-NEXT:        Path:            'GlobalNamespace'
+// YAML-NEXT: ...
 
+// MD: ### func_with_tuple_param
+// MD: *tuple func_with_tuple_param(tuple t)*
+// MD: *Defined at {{.*}}templates.cpp#[[# @LINE - 44]]*
+// MD:  A function with a tuple parameter
+// MD: **t** The input to func_with_tuple_param

Created using spr 1.3.6-beta.1

[skip ci]
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1

[skip ci]
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1

[skip ci]
Created using spr 1.3.6-beta.1
@ilovepi ilovepi force-pushed the users/ilovepi/spr/clang-doc-precommit-test-case-for-functions-with-templated-parameters-and-return branch from 3f57207 to 7fb8e62 Compare December 13, 2024 17:52
Created using spr 1.3.6-beta.1

[skip ci]
Created using spr 1.3.6-beta.1
@ilovepi ilovepi changed the base branch from users/ilovepi/spr/main.clang-doc-precommit-test-case-for-functions-with-templated-parameters-and-return to main December 13, 2024 17:56
@ilovepi ilovepi merged commit e113a72 into main Dec 13, 2024
6 of 9 checks passed
@ilovepi ilovepi deleted the users/ilovepi/spr/clang-doc-precommit-test-case-for-functions-with-templated-parameters-and-return branch December 13, 2024 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants