@@ -81,8 +81,9 @@ namespace ipr {
8181#include < ipr/node-category>
8282 };
8383
84- // -- General structural utility types.
84+ // -- General structural utility types and functions .
8585
86+ // -- General node category class.
8687 template <Category_code Cat, class T = Expr>
8788 struct Category : T {
8889 protected:
@@ -102,6 +103,33 @@ namespace ipr {
102103 virtual const T& result () const = 0;
103104 };
104105
106+ // -- DeclSpecifiers --
107+ enum class DeclSpecifiers : std::uint32_t {
108+ None = 0 ,
109+ Register = 1 << 0 , // Banned from C++17.
110+ Static = 1 << 1 ,
111+ Extern = 1 << 2 ,
112+ Mutable = 1 << 3 ,
113+ Thread = 1 << 4 ,
114+ StorageClass = Register | Static | Extern | Mutable | Thread,
115+
116+ Inline = 1 << 5 ,
117+ Virtual = 1 << 6 , // also used as storage class specifier
118+ // for virtual base subobjects
119+ Explicit = 1 << 7 ,
120+
121+ Friend = 1 << 9 ,
122+ Typedef = 1 << 10 ,
123+
124+ Public = 1 << 11 ,
125+ Protected = 1 << 12 ,
126+ Private = 1 << 13 ,
127+ AccessProtection = Public | Protected | Private,
128+
129+ Export = 1 << 14 , // For exported declarations.
130+ Constexpr = 1 << 15 , // C++ 11
131+ };
132+
105133 // -- Logogram --
106134 // A class of words (from a C++ input source) standing for themselves, with no particular elaboration.
107135 struct Logogram : Basic_unary<const String&> {
@@ -245,12 +273,13 @@ namespace ipr {
245273 }
246274
247275 // -- Lambda_specifiers --
248- // Declaration specifiers that can appear on a lambda expression.
276+ // Declaration specifiers that can appear in a lambda expression.
249277 enum class Lambda_specifiers : std::uint32_t {
250278 None = 0 ,
251- Mutable = 1 << 0 ,
252- Constexpr = 1 << 1 ,
253- Consteval = 1 << 2 ,
279+ Mutable = 1 << 0 , // `mutable` lambda
280+ Constexpr = 1 << 1 , // `constexpr` lambda
281+ Consteval = 1 << 2 , // `consteval` lambda
282+ ExplicitObject = 1 << 3 , // explicit object parameter `this`.
254283 };
255284
256285 // -- Module_name --
@@ -1841,15 +1870,33 @@ namespace ipr {
18411870 Optional<Expr> initializer () const final { return { }; }
18421871 };
18431872
1873+ // -- Semantic traits of a function declaration.
1874+ enum class FunctionTraits : std::uint32_t {
1875+ Nothing = 0x0 , // No particular traits
1876+ Pure = 1 << 0 , // pure virtual function
1877+ Virtual = 1 << 1 , // virtual function
1878+ Static = 1 << 2 , // static member-function, NOT linkage
1879+ Inline = 1 << 3 , // inline function
1880+ Explicit = 1 << 4 , // function declared `explicit`
1881+ Constexpr = 1 << 5 , // constexpr function
1882+ Consteval = 1 << 6 , // consteval function
1883+ ExplicitObject = 1 << 7 , // function with explicit object parameter.
1884+ };
1885+
18441886 // -- Fundecl --
18451887 // This node represents a function declaration. Notice that the
18461888 // exception specification is actually made part of the function type.
18471889 struct Fundecl : Category<Category_code::Fundecl, Decl> {
1890+ virtual FunctionTraits traits () const = 0;
18481891 virtual Optional<Mapping> mapping () const = 0;
18491892 virtual const Parameter_list& parameters () const = 0;
18501893 virtual Optional<Fundecl> definition () const = 0;
18511894 };
18521895
1896+ // -- Concept --
1897+ struct Concept : Category<Category_code::Concept, Decl>, Parameterization<Expr> {
1898+ };
1899+
18531900 // -- Var --
18541901 // This represents a variable declaration. It is also used to
18551902 // represent a static data member.
@@ -2152,6 +2199,7 @@ namespace ipr {
21522199 virtual void visit (const Field&);
21532200 virtual void visit (const Fundecl&);
21542201 virtual void visit (const Template&);
2202+ virtual void visit (const Concept&);
21552203 virtual void visit (const Parameter&);
21562204 virtual void visit (const Parameter_list&);
21572205 virtual void visit (const Typedecl&);
0 commit comments