Skip to content

[clang-doc] Remove unused simple_ilist comparison operators (NFC) - #206309

Merged
vgvassilev merged 1 commit into
llvm:mainfrom
flash1729:wunused-template-clang-doc
Jun 29, 2026
Merged

vgvassilev merged 1 commit into
llvm:mainfrom
flash1729:wunused-template-clang-doc

Conversation

@flash1729

@flash1729 flash1729 commented Jun 28, 2026 •

Copy link
Copy Markdown
Member

These operator== and operator!= templates in YAMLGenerator.cpp were never called. They went in as infrastructure that never got wired up, and now a cleanup exposed them under -Wunused-template. Remove the dead code.

NFC. Part of #202945.

These operator== and operator!= templates were never called, so they trip
-Wunused-template. Remove the dead code.
@llvmorg-github-actions

Copy link
Copy Markdown

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

Author: Aditya Medhane (flash1729)

Changes

These operator== and operator!= templates in YAMLGenerator.cpp were never called. They went in as infrastructure that never got wired up, and a later static cleanup exposed them under -Wunused-template. Remove the dead code.

NFC. Part of #202945.


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

1 Files Affected:

  • (modified) clang-tools-extra/clang-doc/YAMLGenerator.cpp (-18)
diff --git a/clang-tools-extra/clang-doc/YAMLGenerator.cpp b/clang-tools-extra/clang-doc/YAMLGenerator.cpp
index 5a1d822526daa..7ccf526c59e22 100644
--- a/clang-tools-extra/clang-doc/YAMLGenerator.cpp
+++ b/clang-tools-extra/clang-doc/YAMLGenerator.cpp
@@ -32,24 +32,6 @@ LLVM_YAML_IS_SEQUENCE_VECTOR(BaseRecordInfo)
 
 namespace llvm {
 
-template <typename T>
-static bool operator==(const llvm::simple_ilist<T> &LHS,
-                       const llvm::simple_ilist<T> &RHS) {
-  auto LIt = LHS.begin(), LEnd = LHS.end();
-  auto RIt = RHS.begin(), REnd = RHS.end();
-  for (; LIt != LEnd && RIt != REnd; ++LIt, ++RIt) {
-    if (!(*LIt == *RIt))
-      return false;
-  }
-  return LIt == LEnd && RIt == REnd;
-}
-
-template <typename T>
-static bool operator!=(const llvm::simple_ilist<T> &LHS,
-                       const llvm::simple_ilist<T> &RHS) {
-  return !(LHS == RHS);
-}
-
 namespace yaml {
 
 // Provide SequenceTraits for ArrayRef<T*> since YAMLTraits only provides it for

@flash1729

Copy link
Copy Markdown
Member Author

@ilovepi @evelez7 ping for review

@ilovepi ilovepi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM if the bots are happy with this. Thanks for catching and fixing the issue.

@evelez7 any progress on dropping YAML/legacy MD implementation? The legacy implementations are becoming problematic, as we're not really maintaining them appropriately.

@vgvassilev
vgvassilev merged commit df4f247 into llvm:main Jun 29, 2026
11 checks passed
LouisLu060211 pushed a commit to LouisLu060211/llvm-project that referenced this pull request Jun 30, 2026
…vm#206309)

These operator== and operator!= templates in YAMLGenerator.cpp were
never called. They went in as infrastructure that never got wired up,
and now a cleanup exposed them under -Wunused-template. Remove the dead
code.

NFC. Part of llvm#202945.
maarcosrmz pushed a commit to maarcosrmz/llvm-project that referenced this pull request Jul 1, 2026
…vm#206309)

These operator== and operator!= templates in YAMLGenerator.cpp were
never called. They went in as infrastructure that never got wired up,
and now a cleanup exposed them under -Wunused-template. Remove the dead
code.

NFC. Part of llvm#202945.
vgvassilev pushed a commit that referenced this pull request Jul 6, 2026
Uncomment `UnusedTemplate` in the `Unused` diagnostic group so
`-Wunused-template` becomes part of `-Wall`.

`-Wunused-template` flags unused function and variable templates with
internal linkage. In a header, such a template gives every translation
unit its own internal-linkage copy, which is a latent ODR violation
(ill-formed, no diagnostic required), so enabling this surfaces a real
class of bugs and keeps the pattern from reappearing.

### Depends on

The in-tree occurrences were cleaned up first in a series of NFC PRs
tracked by #202945. This change only builds clean once those land, so CI
will be red on any area whose cleanup is not yet merged. Remaining
prerequisites:

Approved
- #202969
- #202971
- #202973
- #202974
- #206309
- #206312

Needs to be reviewed 
- #202988
- #206308

Closes #202945

cc @AaronBallman @vgvassilev
gandhi56 pushed a commit that referenced this pull request Jul 9, 2026
Uncomment `UnusedTemplate` in the `Unused` diagnostic group so
`-Wunused-template` becomes part of `-Wall`.

`-Wunused-template` flags unused function and variable templates with
internal linkage. In a header, such a template gives every translation
unit its own internal-linkage copy, which is a latent ODR violation
(ill-formed, no diagnostic required), so enabling this surfaces a real
class of bugs and keeps the pattern from reappearing.

### Depends on

The in-tree occurrences were cleaned up first in a series of NFC PRs
tracked by #202945. This change only builds clean once those land, so CI
will be red on any area whose cleanup is not yet merged. Remaining
prerequisites:

Approved
- #202969
- #202971
- #202973
- #202974
- #206309
- #206312

Needs to be reviewed 
- #202988
- #206308

Closes #202945

cc @AaronBallman @vgvassilev
@flash1729
flash1729 deleted the wunused-template-clang-doc branch August 7, 2026 08:47
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