[clang] [clang-tools-extra] [Clang] support friend declarations with a dependent nested-name-specifier (PR #191268)

Oleksandr Tarasiuk via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 11 00:18:23 PDT 2026


================
@@ -2471,45 +2472,51 @@ class ClassTemplateDecl : public RedeclarableTemplateDecl {
 ///   template \<typename U> friend class Foo<T>::Nested; // friend template
 /// };
 /// \endcode
-///
-/// \note This class is not currently in use.  All of the above
-/// will yield a FriendDecl, not a FriendTemplateDecl.
-class FriendTemplateDecl : public Decl {
-  virtual void anchor();
-
-public:
-  using FriendUnion = llvm::PointerUnion<NamedDecl *,TypeSourceInfo *>;
+class FriendTemplateDecl final
+    : public FriendDecl,
+      private llvm::TrailingObjects<FriendTemplateDecl,
+                                    TemplateParameterList *> {
+  void anchor() override;
 
 private:
-  // The number of template parameters;  always non-zero.
-  unsigned NumParams = 0;
+  unsigned NumTPLists : 31;
----------------
a-tarasyuk wrote:

@zwuis, thanks for the feedback. I've added requested changes 

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


More information about the cfe-commits mailing list