[clang] [clang][Modules] Add explicit PrivateModuleFragmentDecl AST node (PR #223044)
Yanzuo Liu via cfe-commits
cfe-commits at lists.llvm.org
Sun Sep 13 06:38:10 PDT 2026
================
@@ -5309,6 +5309,49 @@ class ExportDecl final : public Decl, public DeclContext {
}
};
+/// Represents the private module fragment of a module unit.
+///
+/// For example:
+/// \code
+/// export module A;
+/// ...
+/// module :private; // <- this fragment
+/// int internal_only();
+/// \endcode
+class PrivateModuleFragmentDecl final : public Decl {
+ Module *Fragment;
+ SourceLocation PrivateLoc;
+
+ PrivateModuleFragmentDecl(DeclContext *DC, SourceLocation ModuleLoc,
+ SourceLocation PrivateLoc, Module *Fragment)
+ : Decl(PrivateModuleFragment, DC, ModuleLoc), Fragment(Fragment),
+ PrivateLoc(PrivateLoc) {}
+ PrivateModuleFragmentDecl(EmptyShell Empty)
+ : Decl(PrivateModuleFragment, Empty) {}
+
+public:
+ static PrivateModuleFragmentDecl *Create(ASTContext &C, DeclContext *DC,
----------------
zwuis wrote:
Generally we add `Create` if the class has a base class `TrailingObjects`.
https://github.com/llvm/llvm-project/pull/223044
More information about the cfe-commits
mailing list