-
Notifications
You must be signed in to change notification settings - Fork 16.1k
[clang-doc] Don't serialize non-existant locations in HTML #174887
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member
Author
Member
|
@llvm/pr-subscribers-clang-tools-extra Author: Erick Velez (evelez7) ChangesThe function template didn't check to see if a Full diff: https://github.com/llvm/llvm-project/pull/174887.diff 3 Files Affected:
diff --git a/clang-tools-extra/clang-doc/assets/function-template.mustache b/clang-tools-extra/clang-doc/assets/function-template.mustache
index 1e81f34196137..354e26b7b05b0 100644
--- a/clang-tools-extra/clang-doc/assets/function-template.mustache
+++ b/clang-tools-extra/clang-doc/assets/function-template.mustache
@@ -17,5 +17,7 @@
{{>Comments}}
</div>
{{/Description}}
- <p>Defined at line {{Location.LineNumber}} of file {{Location.Filename}}</p>
+ {{#Location}}
+ <p>Defined at line {{LineNumber}} of file {{Filename}}</p>
+ {{/Location}}
</div>
diff --git a/clang-tools-extra/test/clang-doc/json/class.cpp b/clang-tools-extra/test/clang-doc/json/class.cpp
index 5c63aa5ec45ef..c4f0b2166a3f8 100644
--- a/clang-tools-extra/test/clang-doc/json/class.cpp
+++ b/clang-tools-extra/test/clang-doc/json/class.cpp
@@ -335,7 +335,6 @@ struct MyClass {
// HTML-NEXT: <div>
// HTML-NEXT: <div id="{{([0-9A-F]{40})}}" class="delimiter-container">
// HTML-NEXT: <pre><code class="language-cpp code-clang-doc">int protectedMethod ()</code></pre>
-// HTML-NEXT: <p>Defined at line of file </p>
// HTML-NEXT: </div>
// HTML-NEXT: </div>
// HTML-NEXT: </section>
diff --git a/clang-tools-extra/test/clang-doc/templates.cpp b/clang-tools-extra/test/clang-doc/templates.cpp
index c9f1370a19e6e..27fff6ed5a09d 100644
--- a/clang-tools-extra/test/clang-doc/templates.cpp
+++ b/clang-tools-extra/test/clang-doc/templates.cpp
@@ -79,8 +79,6 @@ void ParamPackFunction(T... args);
// HTML: <pre><code class="language-cpp code-clang-doc">template <class... T></code></pre>
// HTML-NEXT: <pre><code class="language-cpp code-clang-doc">void ParamPackFunction (T... args)</code></pre>
-// COM: FIXME: Omit defined line if not defined, or emit declaration line.
-// HTML-NEXT: <p>Defined at line of file </p>
// HTML-NEXT: </div>
template <typename T, int U = 1>
|
Member
Author
ilovepi
approved these changes
Jan 8, 2026
9f8ecf5 to
2aa48a0
Compare
008f9df to
0c46055
Compare
Base automatically changed from
users/evelez7/clang-doc-protected-methods
to
main
January 9, 2026 01:01
The function template didn't check to see if a `Location` existed before emitting the definition location line.
0c46055 to
be256e4
Compare
Member
Author
kshitijvp
pushed a commit
to kshitijvp/llvm-project
that referenced
this pull request
Jan 9, 2026
The function template didn't check to see if a `Location` existed before emitting the definition location line.
Priyanshu3820
pushed a commit
to Priyanshu3820/llvm-project
that referenced
this pull request
Jan 18, 2026
The function template didn't check to see if a `Location` existed before emitting the definition location line.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

The function template didn't check to see if a
Locationexisted beforeemitting the definition location line.