[clang-tools-extra] [clang-doc] fix names of conversions for template parameters (PR #140856)

2025-05-23 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder 
`llvm-clang-x86_64-gcc-ubuntu` running on `sie-linux-worker3` while building 
`clang-tools-extra` at step 6 "test-build-unified-tree-check-all".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/174/builds/18265


Here is the relevant piece of the build log for the reference

```
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
 TEST 'AddressSanitizer-x86_64-linux :: 
TestCases/asan_lsan_deadlock.cpp' FAILED 
Exit Code: 1

Command Output (stderr):
--
/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/./bin/clang  
--driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer 
-fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only  -m64  
-O0 
/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp
 -o 
/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/runtimes/runtimes-bins/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/asan_lsan_deadlock.cpp.tmp
 # RUN: at line 4
+ /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/./bin/clang 
--driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer 
-fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -m64 -O0 
/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp
 -o 
/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/runtimes/runtimes-bins/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/asan_lsan_deadlock.cpp.tmp
env ASAN_OPTIONS=detect_leaks=1 not  
/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/runtimes/runtimes-bins/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/asan_lsan_deadlock.cpp.tmp
 2>&1 | FileCheck 
/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp
 # RUN: at line 5
+ env ASAN_OPTIONS=detect_leaks=1 not 
/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/runtimes/runtimes-bins/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/asan_lsan_deadlock.cpp.tmp
+ FileCheck 
/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp
/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp:58:12:
 error: CHECK: expected string not found in input
 // CHECK: SUMMARY: AddressSanitizer: stack-buffer-overflow
   ^
:1:1: note: scanning from here
=
^
:2:10: note: possible intended match here
==2934904==ERROR: AddressSanitizer: stack-buffer-overflow on address 
0x7b7d145de034 at pc 0x56352b2b6060 bp 0x7b7d127fdce0 sp 0x7b7d127fdcd8
 ^

Input file: 
Check file: 
/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp

-dump-input=help explains the following input dump.

Input was:
<<
1: 
=
 
check:58'0 
X~ error: no 
match found
2: ==2934904==ERROR: 
AddressSanitizer: stack-buffer-overflow on address 0x7b7d145de034 at pc 
0x56352b2b6060 bp 0x7b7d127fdce0 sp 0x7b7d127fdcd8 
check:58'0 
~
check:58'1  ?  

  possible intended match
3: WRITE of size 4 at 0x7b7d145de034 
thread T2 
check:58'0 
>>

--




```



https://github.com/llvm/llvm-project/pull/140856
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-doc] fix names of conversions for template parameters (PR #140856)

2025-05-23 Thread Erick Velez via cfe-commits

https://github.com/evelez7 closed 
https://github.com/llvm/llvm-project/pull/140856
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-doc] fix names of conversions for template parameters (PR #140856)

2025-05-22 Thread Paul Kirth via cfe-commits

ilovepi wrote:

stacked PRs are still not as nice as phabricator or gerrit, but Graphite is a 
lot more firendly than I found spr, or winging it w/ github PRs. For a 
precommit test, it isn't too hard to upload a patch for before and then rebase 
the "after" patch after it lands.

https://github.com/llvm/llvm-project/pull/140856
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-doc] fix names of conversions for template parameters (PR #140856)

2025-05-22 Thread Erick Velez via cfe-commits

https://github.com/evelez7 updated 
https://github.com/llvm/llvm-project/pull/140856

>From b1a07c3dd19f2aa15abc286fdde0a2cb439dd7b7 Mon Sep 17 00:00:00 2001
From: Erick Velez 
Date: Thu, 22 May 2025 17:08:59 -0700
Subject: [PATCH] separate test from code change

---
 clang-tools-extra/clang-doc/Serialize.cpp | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/clang-tools-extra/clang-doc/Serialize.cpp 
b/clang-tools-extra/clang-doc/Serialize.cpp
index 18db427b5239e..fe4ef9c50cc12 100644
--- a/clang-tools-extra/clang-doc/Serialize.cpp
+++ b/clang-tools-extra/clang-doc/Serialize.cpp
@@ -525,7 +525,13 @@ template 
 static void populateInfo(Info &I, const T *D, const FullComment *C,
  bool &IsInAnonymousNamespace) {
   I.USR = getUSRForDecl(D);
-  I.Name = D->getNameAsString();
+  if (auto ConversionDecl = dyn_cast_or_null(D);
+  ConversionDecl && ConversionDecl->getConversionType()
+.getTypePtr()
+->isTemplateTypeParmType())
+I.Name = "operator " + ConversionDecl->getConversionType().getAsString();
+  else
+I.Name = D->getNameAsString();
   populateParentNamespaces(I.Namespace, D, IsInAnonymousNamespace);
   if (C) {
 I.Description.emplace_back();

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-doc] fix names of conversions for template parameters (PR #140856)

2025-05-22 Thread Paul Kirth via cfe-commits

ilovepi wrote:

You can find a stack where I did that here: 
https://app.graphite.dev/github/pr/llvm/llvm-project/135705/%5Bllvm%5D%5Blto%5D-Precommit-test-for-libcall-internalization

Those aren't landed, since we're hashing out the proper way to fix things, but 
I added a test w/ the behavior today, and then in the next patch its very easy 
to see what changed.

https://github.com/llvm/llvm-project/pull/140856
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-doc] fix names of conversions for template parameters (PR #140856)

2025-05-22 Thread Paul Kirth via cfe-commits

ilovepi wrote:

Sorry, I mean committing a test w/ the current in-tree behavior, and then this 
patch would have your fix and a small delta to the test showing the new 
behavior. Some information on that can be found here: 
https://llvm.org/docs/TestingGuide.html#precommit-workflow-for-tests

https://github.com/llvm/llvm-project/pull/140856
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-doc] fix names of conversions for template parameters (PR #140856)

2025-05-22 Thread Erick Velez via cfe-commits

evelez7 wrote:

> would you mind pre-committing the test so its easy to see what's changing in 
> the output with this patch?

Could you explain what this means please? Do you mean reorganizing the PR so 
that the first commit is the test and then the second is the code change?

https://github.com/llvm/llvm-project/pull/140856
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-doc] fix names of conversions for template parameters (PR #140856)

2025-05-22 Thread Paul Kirth via cfe-commits

https://github.com/ilovepi approved this pull request.

LGTM, but would you mind pre-committing the test so its easy to see what's 
changing in the output with this patch? I've been trying to get more of that 
done when we're changing clang-doc output. Otherwise it's hard to know exactly 
what we're achieving with a particular patch. I can rubber stamp the pre-commit 
patch.

https://github.com/llvm/llvm-project/pull/140856
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-doc] fix names of conversions for template parameters (PR #140856)

2025-05-22 Thread Erick Velez via cfe-commits

https://github.com/evelez7 updated 
https://github.com/llvm/llvm-project/pull/140856

>From e25581d28ecda89fe4e550da71e668b6ae749804 Mon Sep 17 00:00:00 2001
From: Erick Velez 
Date: Tue, 20 May 2025 23:26:02 -0700
Subject: [PATCH 1/2] [clang-doc] fix conversion names of dependent types

Fixes #59812

The names of conversion functions of template type parameters were
being emitted as "type-parameter-N-M". Now we check if the conversion
type is a TemplateTypeParmType and reconstruct the source name.
---
 clang-tools-extra/clang-doc/Serialize.cpp | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/clang-tools-extra/clang-doc/Serialize.cpp 
b/clang-tools-extra/clang-doc/Serialize.cpp
index 18db427b5239e..585a46112d43d 100644
--- a/clang-tools-extra/clang-doc/Serialize.cpp
+++ b/clang-tools-extra/clang-doc/Serialize.cpp
@@ -525,7 +525,13 @@ template 
 static void populateInfo(Info &I, const T *D, const FullComment *C,
  bool &IsInAnonymousNamespace) {
   I.USR = getUSRForDecl(D);
-  I.Name = D->getNameAsString();
+  auto ConversionDecl = dyn_cast_or_null(D);
+  if (ConversionDecl && ConversionDecl->getConversionType()
+.getTypePtr()
+->isTemplateTypeParmType())
+I.Name = "operator " + ConversionDecl->getConversionType().getAsString();
+  else
+I.Name = D->getNameAsString();
   populateParentNamespaces(I.Namespace, D, IsInAnonymousNamespace);
   if (C) {
 I.Description.emplace_back();

>From a4d5ad45cad45f21505fdd8e88e2706dc3343e88 Mon Sep 17 00:00:00 2001
From: Erick Velez 
Date: Thu, 22 May 2025 14:14:26 -0700
Subject: [PATCH 2/2] address review feedback

---
 clang-tools-extra/clang-doc/Serialize.cpp   |  4 ++--
 .../test/clang-doc/conversion_function.cpp  | 17 +
 2 files changed, 19 insertions(+), 2 deletions(-)
 create mode 100644 clang-tools-extra/test/clang-doc/conversion_function.cpp

diff --git a/clang-tools-extra/clang-doc/Serialize.cpp 
b/clang-tools-extra/clang-doc/Serialize.cpp
index 585a46112d43d..fe4ef9c50cc12 100644
--- a/clang-tools-extra/clang-doc/Serialize.cpp
+++ b/clang-tools-extra/clang-doc/Serialize.cpp
@@ -525,8 +525,8 @@ template 
 static void populateInfo(Info &I, const T *D, const FullComment *C,
  bool &IsInAnonymousNamespace) {
   I.USR = getUSRForDecl(D);
-  auto ConversionDecl = dyn_cast_or_null(D);
-  if (ConversionDecl && ConversionDecl->getConversionType()
+  if (auto ConversionDecl = dyn_cast_or_null(D);
+  ConversionDecl && ConversionDecl->getConversionType()
 .getTypePtr()
 ->isTemplateTypeParmType())
 I.Name = "operator " + ConversionDecl->getConversionType().getAsString();
diff --git a/clang-tools-extra/test/clang-doc/conversion_function.cpp 
b/clang-tools-extra/test/clang-doc/conversion_function.cpp
new file mode 100644
index 0..fee86b356011e
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/conversion_function.cpp
@@ -0,0 +1,17 @@
+// RUN: rm -rf %t && mkdir -p %t
+
+// RUN: clang-doc --output=%t --executor=standalone %s 
+// RUN: find %t/ -regex ".*/[0-9A-F]*.yaml" -exec cat {} ";" | FileCheck %s 
--check-prefix=CHECK-YAML
+
+// RUN: clang-doc --format=html --output=%t --executor=standalone %s 
+// FileCheck %s --check-prefix=CHECK-HTML
+
+template 
+struct MyStruct {
+  operator T();
+};
+
+// CHECK-YAML: Name:'operator T'
+
+// CHECK-HTML: operator T
+// CHECK-HTML: public T operator T

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-doc] fix names of conversions for template parameters (PR #140856)

2025-05-21 Thread Erick Velez via cfe-commits

https://github.com/evelez7 created 
https://github.com/llvm/llvm-project/pull/140856

Fixes #59812

The names of conversion functions of template type parameters were being 
emitted as "type-parameter-N-M". Now we check if the conversion type is a 
TemplateTypeParmType and reconstruct the source name.

>From e25581d28ecda89fe4e550da71e668b6ae749804 Mon Sep 17 00:00:00 2001
From: Erick Velez 
Date: Tue, 20 May 2025 23:26:02 -0700
Subject: [PATCH] [clang-doc] fix conversion names of dependent types

Fixes #59812

The names of conversion functions of template type parameters were
being emitted as "type-parameter-N-M". Now we check if the conversion
type is a TemplateTypeParmType and reconstruct the source name.
---
 clang-tools-extra/clang-doc/Serialize.cpp | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/clang-tools-extra/clang-doc/Serialize.cpp 
b/clang-tools-extra/clang-doc/Serialize.cpp
index 18db427b5239e..585a46112d43d 100644
--- a/clang-tools-extra/clang-doc/Serialize.cpp
+++ b/clang-tools-extra/clang-doc/Serialize.cpp
@@ -525,7 +525,13 @@ template 
 static void populateInfo(Info &I, const T *D, const FullComment *C,
  bool &IsInAnonymousNamespace) {
   I.USR = getUSRForDecl(D);
-  I.Name = D->getNameAsString();
+  auto ConversionDecl = dyn_cast_or_null(D);
+  if (ConversionDecl && ConversionDecl->getConversionType()
+.getTypePtr()
+->isTemplateTypeParmType())
+I.Name = "operator " + ConversionDecl->getConversionType().getAsString();
+  else
+I.Name = D->getNameAsString();
   populateParentNamespaces(I.Namespace, D, IsInAnonymousNamespace);
   if (C) {
 I.Description.emplace_back();

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-doc] fix names of conversions for template parameters (PR #140856)

2025-05-21 Thread Erick Velez via cfe-commits

evelez7 wrote:

Should note that #59812 also mentions the `requires` clause being omitted but 
that should be addressed by a different issue/patch because that will be 
applicable to all function types.

https://github.com/llvm/llvm-project/pull/140856
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-doc] fix names of conversions for template parameters (PR #140856)

2025-05-20 Thread via cfe-commits

llvmbot wrote:




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

Author: Erick Velez (evelez7)


Changes

Fixes #59812

The names of conversion functions of template type parameters were being 
emitted as "type-parameter-N-M". Now we check if the conversion type is a 
TemplateTypeParmType and reconstruct the source name.

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


1 Files Affected:

- (modified) clang-tools-extra/clang-doc/Serialize.cpp (+7-1) 


``diff
diff --git a/clang-tools-extra/clang-doc/Serialize.cpp 
b/clang-tools-extra/clang-doc/Serialize.cpp
index 18db427b5239e..585a46112d43d 100644
--- a/clang-tools-extra/clang-doc/Serialize.cpp
+++ b/clang-tools-extra/clang-doc/Serialize.cpp
@@ -525,7 +525,13 @@ template 
 static void populateInfo(Info &I, const T *D, const FullComment *C,
  bool &IsInAnonymousNamespace) {
   I.USR = getUSRForDecl(D);
-  I.Name = D->getNameAsString();
+  auto ConversionDecl = dyn_cast_or_null(D);
+  if (ConversionDecl && ConversionDecl->getConversionType()
+.getTypePtr()
+->isTemplateTypeParmType())
+I.Name = "operator " + ConversionDecl->getConversionType().getAsString();
+  else
+I.Name = D->getNameAsString();
   populateParentNamespaces(I.Namespace, D, IsInAnonymousNamespace);
   if (C) {
 I.Description.emplace_back();

``




https://github.com/llvm/llvm-project/pull/140856
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits