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

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 10 21:59:46 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;
----------------
zwuis wrote:

No need to use bit-fields now.

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


More information about the cfe-commits mailing list