Skip to content

[clang-doc] Precommit test for correct conversion function names #141168

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

Merged
merged 2 commits into from
May 23, 2025

Conversation

evelez7
Copy link
Member

@evelez7 evelez7 commented May 23, 2025

No description provided.

@llvmbot
Copy link
Member

llvmbot commented May 23, 2025

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

Author: Erick Velez (evelez7)

Changes

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

1 Files Affected:

  • (added) clang-tools-extra/test/clang-doc/conversion_function.cpp (+18)
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 0000000000000..ad321a45b1ed5
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/conversion_function.cpp
@@ -0,0 +1,18 @@
+// 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 <typename T>
+struct MyStruct {
+  operator T();
+};
+
+// Output incorrect conversion names.
+// CHECK-YAML-NOT:     Name:            'operator T'
+
+// CHECK-HTML-NOT: <h3 id='{{[0-9A-F]*}}'>operator T</h3>
+// CHECK-HTML-NOT: <p>public T operator T()</p>

Copy link
Contributor

@ilovepi ilovepi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect. LGTM.

@evelez7 evelez7 merged commit 8268794 into llvm:main May 23, 2025
9 of 10 checks passed
@evelez7 evelez7 deleted the clang-doc-operator-names-test branch May 24, 2025 02:39
sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Jun 3, 2025
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