[clang] [AST] Iterate redecls starting from the canonical one in getRawCommentsForAnyRedecl() (PR #108475)

Nathan Ridge via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 18 22:51:37 PDT 2024


================
@@ -444,7 +444,7 @@ const RawComment *ASTContext::getRawCommentForAnyRedecl(
     return CommentlessRedeclChains.lookup(CanonicalD);
   }();
 
-  for (const auto Redecl : D->redecls()) {
+  for (const auto Redecl : CanonicalD->redecls()) {
----------------
HighCommander4 wrote:

(The part that makes less sense to me is, why does the explicit specialization have a redeclaration at all in a case like

```c++
/// Aaa.
template<typename T, typename U>
void foo(T aaa, U bbb);

/// Bbb.
template<>
void foo(int aaa, int bbb);
```

There is only one declaration in the code.)

https://github.com/llvm/llvm-project/pull/108475


More information about the cfe-commits mailing list