-
Notifications
You must be signed in to change notification settings - Fork 14.6k
[clang-doc] Pre-commit tests for static members and functions #135456
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
Issue #59813 mentions that static members are not included in the documentation generated by clang-doc. This patch adds some basic testing for that property, with the current incorrect behavior. Follow up patches will address the missing documentation.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
@llvm/pr-subscribers-clang-tools-extra Author: Paul Kirth (ilovepi) ChangesIssue #59813 mentions that static members are not included in Full diff: https://github.com/llvm/llvm-project/pull/135456.diff 3 Files Affected:
diff --git a/clang-tools-extra/test/clang-doc/Inputs/basic-project/include/Calculator.h b/clang-tools-extra/test/clang-doc/Inputs/basic-project/include/Calculator.h
index 6811834bc0159..195721d56fff6 100644
--- a/clang-tools-extra/test/clang-doc/Inputs/basic-project/include/Calculator.h
+++ b/clang-tools-extra/test/clang-doc/Inputs/basic-project/include/Calculator.h
@@ -43,4 +43,25 @@ class Calculator {
* @throw std::invalid_argument if b is zero.
*/
double divide(int a, int b);
-};
\ No newline at end of file
+
+ /**
+ * @brief Performs the mod operation on integers.
+ *
+ * @param a First integer.
+ * @param b Second integer.
+ * @return The result of a % b.
+ */
+ static int mod(int a, int b) {
+ return a % b;
+ }
+
+ /**
+ * @brief A static value.
+ */
+ static constexpr int static_val = 10;
+
+ /**
+ * @brief Holds a public value.
+ */
+ int public_val = -1;
+};
diff --git a/clang-tools-extra/test/clang-doc/Inputs/basic-project/src/Calculator.cpp b/clang-tools-extra/test/clang-doc/Inputs/basic-project/src/Calculator.cpp
index 258ea22e46184..483d050e3225a 100644
--- a/clang-tools-extra/test/clang-doc/Inputs/basic-project/src/Calculator.cpp
+++ b/clang-tools-extra/test/clang-doc/Inputs/basic-project/src/Calculator.cpp
@@ -15,3 +15,4 @@ int Calculator::multiply(int a, int b) {
double Calculator::divide(int a, int b) {
return static_cast<double>(a) / b;
}
+
diff --git a/clang-tools-extra/test/clang-doc/basic-project.test b/clang-tools-extra/test/clang-doc/basic-project.test
index ef26e5b8916b4..822c93a4b2fc0 100644
--- a/clang-tools-extra/test/clang-doc/basic-project.test
+++ b/clang-tools-extra/test/clang-doc/basic-project.test
@@ -129,6 +129,12 @@
// HTML-CALC: <div>brief</div>
// HTML-CALC: <p> A simple calculator class.</p>
// HTML-CALC: <p> Provides basic arithmetic operations.</p>
+
+// HTML-CALC: <h2 id="Members">Members</h2>
+// HTML-CALC: <div>brief</div>
+// HTML-CALC: <p> Holds a public value.</p>
+// HTML-CALC: <div>public int public_val</div>
+
// HTML-CALC: <h2 id="Functions">Functions</h2>
// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">add</h3>
// HTML-CALC: <p>public int add(int a, int b)</p>
@@ -185,6 +191,18 @@
// HTML-CALC: <div>throw</div>
// HTML-CALC: <p>if b is zero.</p>
+// HTML-CALC: <p>public int mod(int a, int b)</p>
+// CALC-NO-REPOSITORY: Defined at line 20 of file .{{.}}src{{.}}Calculator.cpp
+// CALC-REPOSITORY: Defined at line
+// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./src/Calculator.cpp#20">20</a>
+// CALC-LINE-PREFIX: <a href="https://repository.com/./src/Calculator.cpp#L20">20</a>
+// CALC-REPOSITORY-NEXT: of file
+// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./src/Calculator.cpp">Calculator.cpp</a>
+// HTML-CALC: <div>brief</div>
+// HTML-CALC: <p> Performs the mod operation on integers.</p>
+// HTML-CALC: <div>return</div>
+// HTML-CALC: <p> The result of a % b.</p>
+
// HTML-RECTANGLE: <h1>class Rectangle</h1>
// RECTANGLE-NO-REPOSITORY: <p>Defined at line 10 of file .{{.}}include{{.}}Rectangle.h</p>
// RECTANGLE-REPOSITORY: <p>
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/24/builds/7295 Here is the relevant piece of the build log for the reference
|
…35456) Issue llvm#59813 mentions that static members are not included in the documentation generated by clang-doc. This patch adds some basic testing for that property, with the current incorrect behavior. Follow up patches will address the missing documentation.
Issue #59813 mentions that static members are not included in
the documentation generated by clang-doc. This patch adds
some basic testing for that property, with the current incorrect
behavior. Follow up patches will address the missing documentation.