-
Notifications
You must be signed in to change notification settings - Fork 7
/
decls.tex
1433 lines (1243 loc) · 57.6 KB
/
decls.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\label{sec:ifc-decls}
Declarations are indicated by abstract declaration references. This document
uses \type{DeclIndex} to designate a typed abstract reference to a
declaration. Like all abstract references, it is a 32-bit value
\begin{figure}[htbp]
\centering
\absref{5}{DeclSort}
\caption{\type{DeclIndex}: Abstract reference of declaration}
\label{fig:ifc-decl-index}
\end{figure}
\begin{SortEnum}{DeclSort}
\enumerator{VendorExtension}
\enumerator{Enumerator}
\enumerator{Variable}
\enumerator{Parameter}
\enumerator{Field}
\enumerator{Bitfield}
\enumerator{Scope}
\enumerator{Enumeration}
\enumerator{Alias}
\enumerator{Temploid}
\enumerator{Template}
\enumerator{PartialSpecialization}
\enumerator{Specialization}
\enumerator{DefaultArgument}
\enumerator{Concept}
\enumerator{Function}
\enumerator{Method}
\enumerator{Constructor}
\enumerator{InheritedConstructor}
\enumerator{Destructor}
\enumerator{Reference}
\enumerator{UsingDeclaration}
\enumerator{UsingDirective}
\enumerator{Friend}
\enumerator{Expansion}
\enumerator{DeductionGuide}
\enumerator{Barren}
\enumerator{Tuple}
\enumerator{SyntaxTree}
\enumerator{Intrinsic}
\enumerator{Property}
\enumerator{OutputSegment}
\end{SortEnum}
\paragraph{Note:}
The individual values a \type{DeclSort} enumerator is subject to change
at any moment until the design stabilizes.
\section{Declaration vocabulary types}
\label{sec:ifc-decl-support-types}
The description of declarations uses a set of common types values as described below.
\subsection{Access specifiers}
\label{sec:ifc-access-specifier}
Every non-local declaration has an access specifier, of type:
\begin{typedef}{Access}{}
enum class Access : uint8_t {
None, // No access specifier
Private, // "private" for scope member
Protected, // "protected" for scope member
Public, // "public" for scope member
};
\end{typedef}
\subsection{Basic specifiers}
\label{sec:ifc-basic-specifiers}
Certain cumulative properties common to all declarations are described by the bitmask type \type{BasicSpecifiers}:
%
\begin{typedef}{BasicSpecifiers}{}
enum class BasicSpecifiers : uint8_t {
Cxx = 0, // C++ language linkage
C = 1 << 0, // C language linkage
Internal = 1 << 1, //
Vague = 1 << 2, // Vague linkage, e.g. COMDAT, still external
External = 1 << 3, // External linkage.
Deprecated = 1 << 4, // [[deprecated("foo")]]
InitializedInClass = 1 << 5, // defined or initialized in a class
NonExported = 1 << 6, // Not explicitly exported
IsMemberOfGlobalModule = 1 << 7 // member of the global module
};
\end{typedef}
%
\note{The definition of \type{BasicSpecifiers} may change in the future, and may in fact be part of \type{Declaration} (\secref{sec:ifc-scope-member}).
The numerical values assigned to these symbolic constants are subject to change.
}
\subsection{Reachable semantic properties}
\label{sec:ifc-reachable-properties}
In certain circumstances, the IFC stores more information than the bare minimum
required by the ISO C++ Modules specification. In such cases, it is necessary to know
which semantic properties are reachable, outside the owning module, to the importers.
In other circumstances, known such additional information is useful in performing
additional checks such as ODR violation detection. The availability of such
supplementary information is indicated by the bitmask \type{ReachableProperties}
\begin{typedef}{ReachableProperties}{}
enum class ReachableProperties : uint8_t {
None = 0, // nothing beyond name, type, scope.
Initializer = 1 << 0, // IPR-initializer exported.
DefaultArguments = 1 << 1, // function or template default arguments exported
Attributes = 1 << 2, // standard attributes exported.
All = 0xff, // Everything.
};
\end{typedef}
%
\subsection{Object traits}
\label{sec:ifc-object-traits}
Certain cumulative properties common to all data/object declarations are described by the bitmask type \type{ObjectTraits}
%
\begin{typedef}{ObjectTraits}{}
enum class ObjectTraits : uint8_t {
None = 0,
Constexpr = 1 << 0,
Mutable = 1 << 1,
ThreadLocal = 1 << 2,
Inline = 1 << 3,
InitializerExported = 1 << 4,
Vendor = 1 << 7,
};
\end{typedef}
%
\note{The definition of \type{ObjectTraits} is subject to change.
The numerical values assigned to these symbolic constants are subject to change.}
\subsection{Vendor traits}
\label{sec:ifc-msvc-trait-bitset}
Declarations of certain entities may be endowed with vendor-specific traits.
The MSVC-specific traits are defined by the following enumeration
\begin{typedef}{MsvcTraits}{}
enum class MsvcTraits : uint32_t {
None = 0,
ForceInline = 1 << 0,
Naked = 1 << 1,
NoAlias = 1 << 2,
NoInline = 1 << 3,
Restrict = 1 << 4,
SafeBuffers = 1 << 5,
DllExport = 1 << 6,
DllImport = 1 << 7,
CodeSegment = 1 << 8,
Novtable = 1 << 9,
IntrinsicType = 1 << 10,
EmptyBases = 1 << 11,
Process = 1 << 12,
Allocate = 1 << 13,
SelectAny = 1 << 14,
Comdat = 1 << 15,
Uuid = 1 << 16,
};
\end{typedef}
\subsection{Parameter Level}
A template declaration can have many nesting levels. This is the case of member templates of class templates; that is a member of a class template, that is itself a template.
Parameter nesting level starts from 1. The nesting level is given by a value of type \type{ParameterLevel} defined as
\newtype{ParameterLevel}{32}
\subsection{Parameter Position}
A parameter at a given level can be identified by its position in its enclosing parameter list. The position of a template parameter is given by a value of type \type{ParameterPosition}, defined as \newtype{ParameterPosition}{32}
\section{Declaration structures}
\label{sec:ifc:decl-structures}
\subsection{\valueTag{DeclSort::VendorExtension}}
\label{sec:ifc:DeclSort:VendorExtension}
A \type{DeclIndex} value with tag \valueTag{DeclSort::VendorExtension} represents an abstract reference to a vendor-specific declaration.
This tag value is reserved for encoding vendor-specific extensions.
\partition{decl.vendor-extension}
\subsection{\valueTag{DeclSort::Enumerator}}
\label{sec:ifc:DeclSort:Enumerator}
A \type{DeclIndex} value with tag \valueTag{DeclSort::Enumerator} represents
an abstract reference to an enumerator declaration.
The \field{index} field is an index into the enumerator declaration partition.
Each entry in that partition is a structure with the following components:
a \field{name} field, a \field{locus} field, a \field{type} field, an \field{initializer} field,
a \field{specifier} field, and an \field{access} field.
%
\begin{figure}[H]
\centering
\structure{
\DeclareMember{name}{TextOffset} \\
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{initializer}{ExprIndex} \\
\DeclareMember{specifier}{BasicSpecifiers} \\
\DeclareMember{access}{Access} \\
}
\caption{Structure of an enumerator declaration}
\label{fig:ifc-enumerator-decl-structure}
\end{figure}
%
The \field{name} field denotes the C++ source-level name of the enumerator.
The \field{locus} field denotes the source location.
The \field{type} field denotes the type of the enumerator.
The \field{initializer} field denotes the value or the initializer of the enumerator.
The \field{specifier} field denotes the specifiers of the enumerator.
The \field{access} field denotes the C++ source-level access specifier of the enumerator.
\partition{decl.enumerator}
\subsection{\valueTag{DeclSort::Variable}}
\label{sec:ifc:DeclSort:Variable}
A \type{DeclIndex} value with tag \valueTag{DeclSort::Variable} represents an abstract
reference to a variable declaration. Note that static data members are also
semantically variables and are represented as such.
The \field{index} field is an index into the variable declaration partition.
Each entry in that partition is a structure with the following components:
a \field{name} field, a \field{locus} field, a \type{field}, a \field{home\_scope} field,
an \field{initializer} field, an \field{alignment} field, a \field{specifier} field, a \field{traits}
field, and an \field{access} field.
%
\begin{figure}[H]
\centering
\structure[text width = 14em]{
\DeclareMember{name}{NameIndex} \\
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{home\_scope}{DeclIndex} \\
\DeclareMember{initializer}{ExprIndex} \\
\DeclareMember{alignment}{ExprIndex} \\
\DeclareMember{traits}{ObjectTraits} \\
\DeclareMember{specifier}{BasicSpecifiers} \\
\DeclareMember{access}{Access} \\
\DeclareMember{properties}{ReachableProperties} \\
}
\caption{Structure of a variable declaration}
\label{fig:ifc-variable-decl-structure}
\end{figure}
%
The \field{name} field denotes the name of the variable. Note that it can be a plain identifier (a \type{TextOffset} into the string table), or something
as elaborated as a template-id (for specializations of variable templates).
The \field{locus} field denotes the source location.
The \field{type} field denotes the C++ source-level type of the variable.
The \field{home\_scope} field denotes the scope declaration that holds the object the variable designates. The \field{home\_scope}
is not necessarily the lexical scope of a variable: for instance, a block-scope 'extern' declaration of a variable names a variable whose
home scope in the nearest enclosing namespace scope.
The \field{initializer} field denotes the initializer expression in the variable declaration.
The \field{alignment} field denotes the alignment of the variable.
The \field{specifier} field denotes the declarations specifiers of the variable.
The \field{traits} field denotes additional traits associated with the variable.
The \field{properties} field indicates which semantic properties are reachable
to the importers.
\partition{decl.variable}
\subsection{\valueTag{DeclSort::Parameter}}
\label{sec:ifc:DeclSort:Parameter}
A \type{DeclIndex} value with \field{tag} \valueTag{DeclSort::Parameter} is an abstract reference to
either a function parameter or a template parameter declaration.
The \field{index} field is an index into the parameter declaration partition.
Each entry in that partition is a structure with the following layout
%
\begin{figure}[H]
\centering
\structure[text width = 14em]{
\DeclareMember{name}{TextOffset} \\
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{constraint}{ExprIndex} \\
\DeclareMember{initializer}{ExprIndex} \\
\DeclareMember{level}{ParameterLevel} \\
\DeclareMember{position}{ParameterPosition} \\
\DeclareMember{sort}{ParameterSort} \\
\DeclareMember{properties}{ReachableProperties} \\
}
\caption{Structure of a template parameter declaration}
\label{fig:ifc-template-parameter-structure}
\end{figure}
%
and these meanings of the fields:
\begin{itemize}
\item \field{name} denotes the name of the template parameter. If null, the template parameter was unnamed in the source input.
\item \field{locus} denotes the location of the template parameter.
\item \field{type} designates the type of the parameter.
\item \field{constaint} designates the concept predicate used to declare this parameter, if the abbreviated form was used at the input source level.
\item \field{initializer} designates the corresponding default argument, if any.
\item \field{level} denotes the nesting level of this parameter
\item \field{position} denotes the position of this parameter in the parameter list
\item \field{sort} denotes the sort of parameter (function-parameter vs template-parameter)
\item \field{properties} denotes the set of reachable properties of this parameter.
\end{itemize}
If the parameter declaration was that of a pack, then its type is denoted by a pack expansion (\sortref{Expansion}{TypeSort}).
\note{This representation will change in the future as it is currently too irregular and too tightly coupled with VC++ internal representation oddities.}
\partition{decl.parameter}
\subsubsection{Parameter sort}
\label{sec:ifc-parameter-sort}
The various notions of parameters (function parameter, type template parameter, non-type template parameter, template template parameter) are described by:
\begin{typedef}{ParameterSort}{}
enum class ParameterSort : uint8_t {
Object, // Function parameter
Type, // Type template parameter
NonType, // Non-type template parameter
Template, // Template template parameter
};
\end{typedef}
\subsection{\valueTag{DeclSort::Field}}
\label{sec:ifc:DeclSort:Field}
A \type{DeclIndex} value with tag \valueTag{DeclSort::Field} represents
an abstract reference to the representation of a non-static data member declaration.
The \field{index} field is an index into the field declaration partition.
Each entry in that partition is a structure with the following components:
a \field{name} field, a \field{locus} field, a \field{type} field, a \field{home\_scope} field,
an \field{initializer} field, an \field{alignment} field, a \field{specifier} field,
a \field{traits} field, and an \field{access} field.
%
\begin{figure}[H]
\centering
\structure[text width = 14em]{
\DeclareMember{name}{TextOffset} \\
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{home\_scope}{DeclIndex} \\
\DeclareMember{initializer}{ExprIndex} \\
\DeclareMember{alignment}{ExprIndex} \\
\DeclareMember{traits}{ObjectTraits} \\
\DeclareMember{specifier}{BasicSpecifiers} \\
\DeclareMember{access}{Access} \\
\DeclareMember{properties}{ReachableProperties} \\
}
\caption{Structure of a field declaration}
\label{fig:ifc-field-decl-structure}
\end{figure}
%
The \field{name} field denotes the name of the non-static data member.
The \field{locus} field denotes the source location.
The \field{type} field denotes the C++ source-level type of the non-static data member.
The \field{home\_scope} field denotes the scope declaration that holds the member declaration.
The \field{initializer} field denotes the initializer expression in the member declaration.
The \field{alignment} field denotes the alignment of the non-static data member.
The \field{specifier} field denotes the declarations specifiers of the non-static data member.
The \field{traits} fields denotes additional traits associated with the non-static data member.
\partition{decl.field}
\subsection{\valueTag{DeclSort::Bitfield}}
\label{sec:ifc:DeclSort:Bitfield}
A \type{DeclIndex} value with tag \valueTag{DeclSort::Bitfield} represents
an abstract reference to the representation of a bitfield declaration.
The \field{index} field is an index into the bitfield declaration partition.
Each entry in that partition is a structure with the following components:
a \field{name} field, a \field{locus} field, a \field{type} field, a \field{home\_scope} field,
a \field{width} field,
an \field{initializer} field, a \field{specifier} field,
a \field{traits} field, and an \field{access} field.
%
\begin{figure}[H]
\centering
\structure[text width = 14em]{
\DeclareMember{name}{TextOffset} \\
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{home\_scope}{DeclIndex} \\
\DeclareMember{width}{ExprIndex} \\
\DeclareMember{initializer}{ExprIndex} \\
\DeclareMember{traits}{ObjectTraits} \\
\DeclareMember{specifier}{BasicSpecifiers} \\
\DeclareMember{access}{Access} \\
\DeclareMember{properties}{ReachableProperties} \\
}
\caption{Structure of a bitfield declaration}
\label{fig:ifc-bitfield-decl-structure}
\end{figure}
%
The \field{name} field denotes the name of the bitfield.
The \field{locus} field denotes the source location.
The \field{type} field denotes the C++ source-level type of the bitfield.
The \field{home\_scope} field denotes the scope declaration that holds the bitfield declaration.
The \field{width} field denotes the number bits specified in the bitfield declaration.
The \field{initializer} field denotes the initializer expression in the bitfield declaration.
The \field{specifier} field denotes the declarations specifiers of the bitfield.
The \field{traits} fields denotes additional traits associated with the bitfield.
\partition{decl.bitfield}
\subsection{\valueTag{DeclSort::Scope}}
\label{sec:ifc:DeclSort:Scope}
A \type{DeclIndex} abstract reference with tag \valueTag{DeclSort::Scope} designates a class-type or a namespace definition.
The \field{index} field of that abstract reference is an index into the scope declaration partition.
Each entry in that partition is a structure with the following components:
%
\begin{figure}[H]
\centering
\structure[text width = 14em]{
\DeclareMember{name}{NameIndex} \\
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{base}{TypeIndex} \\
\DeclareMember{initializer}{ScopeIndex} \\
\DeclareMember{home\_scope}{DeclIndex} \\
\DeclareMember{alignment}{ExprIndex} \\
\DeclareMember{pack\_size}{PackSize} \\
\DeclareMember{specifiers}{BasicSpecifiers} \\
\DeclareMember{traits}{ScopeTraits} \\
\DeclareMember{access}{Access} \\
\DeclareMember{properties}{ReachableProperties} \\
}
\caption{Structure of a scope declaration}
\label{fig:ifc-scope-decl-structure}
\end{figure}
\noindent
The \field{name} field designates the name of the scope.
The \field{locus} field designates the source location.
The \field{type} field indicates the kind (\secref{sec:ifc:TypeSort:Fundamental}) of scope:
\begin{itemize}
\item \code{TypeBasis::Struct} means the scope was declared as "\code{struct}"
\item \code{TypeBasis::Class} means the scope was declared as "\code{class}"
\item \code{TypeBasis::Union} means the scope was declared as "\code{union}"
\item \code{TypeBasis::Namespace} means the scope was declared as "\code{namespace}"
\item \code{TypeBasis::Interface} means the scope was declared as "\code{\_\_interface}"
\end{itemize}
Any other value is invalid.
\noindent
The \field{base} field designates the base class(es) in case of inheritance.
The \field{initializer} field designates the body of the scope definition, e.g. the sequence of declarations.
Note that valid \type{ScopeIndex} values start from 1, and 0 indicates absence of scope, e.g. an incomplete class type.
The \field{home\_scope} field designates the declaration of the enclosing scope.
The \field{alignment} field designates the alignment value of the scope, in case of class-type.
The \field{pack\_size} field designates the packing value applied to the layout of the scope, in case of class-type.
The \field{specifiers} field indicates the (cumulative) basic declaration specifiers that hold for the scope.
The \field{traits} field designates scope-specific properties of the scope.
The \field{access} field designates the access specifier of the scope declaration.
The \field{properties} field designates the set of reachable semantic properties.
\partition{decl.scope}
\subsubsection{Scope traits}
\label{sec:ifc-scope-traits}
Properties specific to scope entities are described by values of the bitmask type \type{ScopeTraits}:
%
\begin{typedef}{ScopeTraits}{}
enum class ScopeTraits : uint8_t {
None = 0,
Unnamed = 1 << 0,
Inline = 1 << 1,
InitializerExported = 1 << 2,
ClosureType = 1 << 3,
Final = 1 << 4,
Vendor = 1 << 7,
};
\end{typedef}
%
with the following meaning:
\begin{itemize}
\item \code{ScopeTraits::None}: No scope traits.
\item \code{ScopeTraits::Unnamed}: the scope is unnamed in the input source code.
\item \code{ScopeTraits::Inline}: valid only for namespaces. The namespace is declared \code{inline}.
\item \code{ScopeTraits::InitializedExported}: valid only if the definition of this scope entity is lexically exported, in particular this indicates whether completeness of types is exported.
\item \code{ScopeTraits::ClosureType}: valid only for class types. This trait indicates that the scope represents a closure type.
\item \code{ScopeTraits::Final}: valid only for class types. This trait indicates that the scope is defined \code{final}.
\item \code{ScopeTraits::Vendor}: valid only if the scope entity has vendor-defined traits.
\end{itemize}
\subsubsection{Class-type layout packing}
\label{sec:ifc-class-layout-packing}
A value of class layout packing is expressed as value of type \type{PackSize} defined as \newtype{PackSize}{16}
\subsection{\valueTag{DeclSort::Enumeration}}
\label{sec:ifc:DeclSort:Enumeration}
A \type{DeclIndex} abstract reference with tag \valueTag{DeclSort::Enumeration} designates an enumeration declaration.
The \field{index} of that abstract reference is an index into the enumeration declaration partition.
Each entry in that partition is a structure with the following components:
%
\begin{figure}[H]
\centering
\structure[text width = 14em]{
\DeclareMember{name}{TextOffset} \\
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{base}{TypeIndex} \\
\DeclareMember{initializer}{Sequence} \\
\DeclareMember{home\_scope}{DeclIndex} \\
\DeclareMember{alignment}{ExprIndex} \\
\DeclareMember{specifiers}{BasicSpecifiers} \\
\DeclareMember{access}{Access} \\
\DeclareMember{properties}{ReachableProperties} \\
}
\caption{Structure of an enumeration declaration}
\label{fig:ifc-enumeration-decl-structure}
\end{figure}
%
The \field{name} field designates the name of the enumeration type.
The \field{locus} field designates the source location.
The \field{type} field designates the kind of enumeration, with:
\begin{itemize}
\item \code{TypeBasis::Enum} meaning a classic enumeration
\item \code{TypeBasis::Class} or \code{TypeBasis::Struct} meaning a scoped enumeration
\end{itemize}
The \field{base} field designates the underlying type of the enumeration.
The \field{initializer} is a slice (\secref{sec:ifc-sequence}) of the enumerator partition (\secref{sec:ifc:DeclSort:Enumerator}).
It designates the sequence of enumerators (if any) declared as part
of the enumeration declaration.
The \field{home\_scope} field designates the declaration of the enclosing scope of the enumeration.
The \field{alignment} designates the alignment specified in the declaration. A non-zero value indicates an explicit alignment specification
in the input source code.
The \field{specifiers} designates the basic generic declaration specifiers of the enumeration.
The \field{access} designates the access specifier.
The \field{properties} designates the set of reachable semantic properties.
\partition{decl.enum}
\subsection{\valueTag{DeclSort::Alias}}
\label{sec:ifc:DeclSort:Alias}
A \type{DeclIndex} abstract reference with tag \valueTag{DeclSort::Alias} designates a type alias declaration.
The \field{index} field of that reference is an index into the type alias declaration partition.
Each entry in that partition is a structure with the following components:
%
\begin{figure}[H]
\centering
\structure{
\DeclareMember{name}{TextOffset} \\
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{home\_scope}{DeclIndex} \\
\DeclareMember{aliasee}{TypeIndex} \\
\DeclareMember{specifiers}{BasicSpecifiers} \\
\DeclareMember{access}{Access} \\
}
\caption{Structure of a type alias declaration}
\label{fig:ifc-type-alias-decl-structure}
\end{figure}
%
\begin{itemize}
\item The \field{name} field designates the name of the alias.
\item The \field{locus} field designates the source location.
\item The \field{type} field denotes the kind of alias: it denotes \code{TypeBasis::Typename} for type aliases; it will be \code{TypeBasis::Namespace} for namespace aliases; it is abstract reference of sort \valueTag{TypeSort::Forall} for template aliases.
\item The \field{home\_scope} field designates the declaration of the enclosing scope.
\item The \field{aliasee} field designates the type the alias is declared for.
\item The \field{specifiers} field designates the basic declaration specifiers for the alias.
\item The \field{access} field designates the access specifier for the alias.
\end{itemize}
This structure is also used to represent template aliases -- mistakenly called alias templates in the ISO C++ document. For template aliases,
the \field{aliasee} field denotes a \valueTag{TypeSort::Forall} type (\sortref{Forall}{TypeSort}), which is the representation of the \grammar{template-parameter} list followed by the \grammar{type-id}
that would syntactically appear on the right hand side of the source-level \grammar{using-declaration}.
\partition{decl.alias}
\subsection{\valueTag{DeclSort::Temploid}}
\label{sec:ifc:DeclSort:Temploid}
A member of a parameterized scope -- does not have template parameters of its own.
%
\begin{figure}[H]
\centering
\structure[text width = 14em]{
\DeclareMember{entity}{ParameterizedEntity}\\
\DeclareMember{chart}{ChartIndex}\\
\DeclareMember{properties}{ReachableProperties} \\
}
\caption{Structure of a templated declaration}
\label{fig:ifc-type-temploid-structure}
\end{figure}
%
The \field{entity} field represents the declaration being parameterized.
The \field{chart} field designates the set of template parameter lists of the enclosing scope.
The \field{properties} field designates the set of reachable semantics properties.
\partition{decl.temploid}
\subsubsection{Parameterized Entity}
\label{sec:ifc-parameterized-entity}
The structure \type{ParameterizedEntity} has the following layout
%
\begin{figure}[H]
\centering
\structure{
\DeclareMember{decl}{DeclIndex} \\
\DeclareMember{head}{SentenceIndex} \\
\DeclareMember{body}{SentenceIndex} \\
\DeclareMember{attributes}{SentenceIndex} \\
}
\caption{Structure of a declaration parameterized by a template}
\label{fig:ifc-parameterized-decl-structure}
\end{figure}
%
The \field{decl} field denotes the declaration that is being
parameterized either directly or indirectly by a set of template parameter lists.
The \field{head} field designates the sentence (\secref{sec:ifc-sentence}) that makes up the
non-defining declarative part of the current instantiation.
That sentence is no longer meaningful in recent releases of MSVC since
any semantics information can be obtained from the entity denoted
by \field{decl}.
The \field{body} field denotes the sentence of the defining ("body") part
of the current instantiation. This field is meaningful only
for templated functions.
\subsection{\valueTag{DeclSort::Template}}
\label{sec:ifc:DeclSort:Template}
A template declaration: class, function, constructor, type alias, variable.
\begin{figure}[H]
\centering
\structure[text width = 14em]{
\DeclareMember{name}{NameIndex} \\
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{home\_scope}{DeclIndex} \\
\DeclareMember{chart}{ChartIndex} \\
\DeclareMember{entity}{ParameterizedEntity} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{specifiers}{BasicSpecifiers} \\
\DeclareMember{access}{Access} \\
\DeclareMember{properties}{ReachableProperties} \\
}
\caption{Structure of a template declaration}
\label{fig:ifc-template-decl-structure}
\end{figure}
The \field{name} field denotes the name of this template.
The \field{locus} field denotes the source location of this declaration.
The \field{home\_scope} field designate the home scope of this template.
The \field{chart} field denotes the set of parameter list to this template.
The \field{entity} field describes the declaration being parameterized by this template. Its structure is defined below.
The \field{type} field denotes the type of this template declaration.
The \field{specifiers} field denotes declaration specifiers for this template.
The \field{access} field denotes the access level of this declaration.
The \field{properties} field designates the set of reachable semantic properties.
\partition{decl.template}
\subsection{\valueTag{DeclSort::PartialSpecialization}}
\label{sec:ifc:DeclSort:PartialSpecialization}
A partial specialization of a
template (class-type or function).
%
\begin{figure}[H]
\centering
\structure[text width = 14em]{
\DeclareMember{name}{NameIndex} \\
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{home\_scope}{DeclIndex} \\
\DeclareMember{chart}{ChartIndex} \\
\DeclareMember{entity}{ParameterizedEntity} \\
\DeclareMember{form}{Index} \\
\DeclareMember{specifiers}{BasicSpecifiers} \\
\DeclareMember{access}{Access} \\
\DeclareMember{properties}{ReachableProperties} \\
}
\caption{Structure of a partial specialization declaration}
\label{fig:ifc-partial-specialization-decl-structure}
\end{figure}
The \field{name} field denotes the name of the current instantiation of the partial specialization.
The \field{locus} field denotes the source location.
The \field{home\_scope} field denotes the parent declaration of this partial specialization.
The \field{chart} field denotes the set of template-parameter lists of this partial specialization.
The \field{entity} field describes the current instantiation of this partial specialization.
The \field{form} field is an index into the partition of specialization form (template and template-argument list) named \code{"form.spec"}.
The \field{specifiers} field denotes the declaration specifiers of this partial specialization.
The \field{access} field denotes the access level of this partial specialization.
The \field{properties} field denotes the set of reachable semantic properties.
\partition{decl.partial-specialization}
\subsection{\valueTag{DeclSort::Specialization}}
\label{sec:ifc:DeclSort:Specialization}
A \type{DeclIndex} value with tag \valueTag{DeclSort::Specialization} designates a specialization of template declaration.
The \field{index} field of that abstract reference is an index into the specialization partition.
Each entry in that partition is a structure with the following layout
%
\begin{figure}[H]
\centering
\structure[text width = 14em]{
\DeclareMember{form}{Index} \\
\DeclareMember{decl}{DeclIndex} \\
\DeclareMember{sort}{SpecializationSort} \\
}
\caption{Structure of a template declaration specialization}
\label{fig:ifc-specialization-declaration}
\end{figure}
%
and meanings of the fields
\begin{itemize}
\item The value of \field{form} is an index into the specialization form partition (named "form.spec").
\item \field{decl}, when non null, denotes the declaration produced by the specialization.
\item \field{sort} designates how the specialization is obtained (\secref{sec:ifc-SpecializationSort}).
\end{itemize}
\partition{decl.specialization}
\subsubsection{How to specialize a template}
\label{sec:ifc-SpecializationSort}
The method by which the declaration for a template specialization is produced can be indicated by a value of type
%
\begin{typedef}{SpecializationSort}{}
enum class SpecializationSort : uint8_t {
Implicit = 0x0,
Explicit = 0x1,
Instantiation = 0x2,
};
\end{typedef}
%
with the following meaning
\begin{itemize}
\item \valueTag{SpecializationSort::Implicit}: the declaration is an implicit specialization.
\item \valueTag{Specialization::Explicit}: the declaration is an explicit specialization.
\item \valueTag{Specialization::Instantiation}: the declaration is an explicit instantiation.
\end{itemize}
\subsection{\valueTag{DeclSort::DefaultArgument}}
\label{sec:ifc:DeclSort:DefaultArgument}
A \type{DeclIndex} value with tag \valueTag{DeclSort::DefaultArgument} represents an abstract reference
to a default argument for a function parameter or a template parameter. For all practical purposes (ODR),
a default argument is modelled as a declaration.
The \field{index} of that abstract reference is an index into the default argument
definition partition. Each entry in that partition is a structure with the following layout
%
\begin{figure}[H]
\centering
\structure{
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{home\_scope}{DeclIndex} \\
\DeclareMember{initializer}{ExprIndex} \\
\DeclareMember{specifiers}{BasicSpecifiers} \\
\DeclareMember{access}{Access} \\
\DeclareMember{properties}{ReachableProperties} \\
}
\end{figure}
%
with the following meanings of the fields:
\begin{itemize}
\item \field{locus} designates the source location of the default argument
\item \field{type} designates the type of the parameter corresponding to the default argument
\item \field{home\_scope} designates the scope where the default parameter is specified
\item \field{initializer} designates the expression specified in the default argument
\item \field{specifiers} denotes the basic specifiers of the default arguments
\item \field{access} denotes the control access of this default argument
\item \field{properties} denotes the reachable properties associated with the default argument
\end{itemize}
\note{The \field{home\_scope} field is currently null in the current IFC produced by the MSVC toolset.}
\partition{decl.default-arg}
\subsection{\valueTag{DeclSort::Concept}}
\label{sec:ifc:DeclSort:Concept}
A \type{DeclIndex} value with tag \valueTag{DeclSort::Concept} represents an abstract reference
to a concept declaration. The \field{index} of that abstract reference is an index into the concept
definition partition. Each entry in that partition is a structure with the following layout
%
\begin{figure}[H]
\centering
\structure{
\DeclareMember{name}{TextOffset} \\
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{home\_scope}{DeclIndex} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{chart}{ChartIndex} \\
\DeclareMember{constraint}{ExprIndex} \\
\DeclareMember{specifiers}{BasicSpecifiers} \\
\DeclareMember{access}{Access} \\
\DeclareMember{head}{SentenceIndex} \\
\DeclareMember{body}{SentenceIndex} \\
}
\caption{Structure of a concept declaration}
\label{fig:ifc-concept-decl-structure}
\end{figure}
%
and meaning of the fields:
\begin{itemize}
\item \field{name} designates the name of the concept
\item \field{locus} designates the source location of the concept definition
\item \field{home\_scope} designates the declaration of the enclosing scope
\item \field{type} designates the full type of the concept definition
\item \field{chart} is the parameter list list to the concept
\item \field{constraint} is the body of predicate defining the concept
\item \field{specifiers} is the set of basic declaration specifiers
\item \field{access} is the access specifier for the concept definition
\item \field{head} is the sequence of words making up the declarative part of the concept
\item \field{body} is the sequence of words making up the body of the concept definition
\end{itemize}
\partition{decl.concept}
\note{This representation is subject to change in future releases.}
\subsection{\valueTag{DeclSort::Function}}
\label{sec:ifc:DeclSort:Function}
A \type{DeclIndex} value with tag \valueTag{DeclSort::Function} represents
an abstract reference to a function declaration. Note that a static member function is represented as a function.
The \field{index} field is an index into the function declaration partition.
Each entry in that partition is a structure with the following components:
%
\begin{figure}[H]
\centering
\structure [text width = 15em] {
\DeclareMember{name}{NameIndex} \\
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{home\_scope}{DeclIndex} \\
\DeclareMember{chart}{ChartIndex} \\
\DeclareMember{traits}{FunctionTraits} \\
\DeclareMember{specifiers}{BasicSpecifiers} \\
\DeclareMember{access}{Access} \\
\DeclareMember{properties}{ReachableProperties} \\
}
\caption{Structure of a function declaration}
\label{fig:ifc-function-decl-structure}
\end{figure}
%
The \field{name} field designates the name of the function.
The \field{locus} field designates the source location.
The \field{type} field designates the type of the function, including the noexcept-specification (which is now part of the type of a function in C++17).
The \field{home\_scope} denotes the enclosing scope of the function. This may not be the lexical scope of the declaration.
The \field{chart} denotes the chart (\secref{sec:ifc-charts}) of the function parameter list along with their default arguments. These parameters may be unnamed.
The \field{specifier} denotes basic declaration specifiers; the \field{traits} field adds additional function traits.
Finally, the \field{access} denotes the access specifier for the function.
\note{The set of parameter declarations in a function definition is listed in a separate trait (\secref{sec:ifc-msvc-fun-parms}). That representation is subject to removal in future MSVC releases.}
\partition{decl.function}
\subsubsection{Function traits}
\label{sec:ifc-function-traits}
Certain function-specific cumulative properties are expressed as values of the bitmask type \type{FunctionTraits} defined as
%
\begin{typedef}{FunctionTraits}{}
enum class FunctionTraits : uint16_t {
None = 0,
Inline = 1 << 0,
Constexpr = 1 << 1,
Explicit = 1 << 2,
Virtual = 1 << 3,
NoReturn = 1 << 4,
PureVirtual = 1 << 5,
HiddenFriend = 1 << 6,
Defaulted = 1 << 7,
Deleted = 1 << 8,
Constrained = 1 << 9,
Immediate = 1 << 10,
Vendor = 1 << 15,
};
\end{typedef}
%
with the following meaning
\begin{description}
\item \code{FunctionTraits::None}: no property
\item \code{FunctionTraits::Inline}: the function is declared \code{inline}
\item \code{FunctionTraits::Constexpr}: the function is declared \code{constexpr}
\item \code{FunctionTraits::Explicit}: the function is declared \code{explicit}
\item \code{FunctionTraits::Virtual}: the function is declared \code{virtual}
\item \code{FunctionTraits::NoReturn}: the function is declared \code{[[noreturn]]} or \code{\_\_declspec(noreturn)}
\item \code{FunctionTraits::PureVirtual}: the function is pure virtual, e.g. with \code{ = 0}
\item \code{FunctionTraits::HiddenFriend}: the function is a hidden friend
\item \code{FunctionTraits::Constrained} : the function has requires-constraints
\item \code{FunctionTraits::Immediate}: the function is a \code{consteval}, or an immediate function.
\item \code{FunctionTraits::Vendor}: the function has vendor-defined traits stored in the
MSVC vendor-specific traits (\secref{sec:ifc-msvc-vendor-specific-trait}).
\end{description}
\subsection{\valueTag{DeclSort::Method}}
\label{sec:ifc:DeclSort:Method}
A \type{DeclIndex} abstract reference with tag \code{DeclSort::Method} designates a non-static member function (which is neither a constructor nor a destructor) declaration.
The \field{index} of that abstract reference is an index into the non-static member function declaration partition.
Each entry in that partition is a structure with the following components
%
\begin{figure}[H]
\centering
\structure[text width = 15em]{
\DeclareMember{name}{NameIndex} \\
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{home\_scope}{DeclIndex} \\
\DeclareMember{chart}{ChartIndex} \\
\DeclareMember{traits}{FunctionTraits} \\
\DeclareMember{specifiers}{BasicSpecifiers} \\
\DeclareMember{access}{Access} \\
\DeclareMember{properties}{ReachableProperties} \\
}
\caption{Structure of a non-static member function declaration}
\label{fig:ifc-method-decl-structure}
\end{figure}
%
The \field{name} field designates the name of the non-static member function.
The \field{locus} field designates the source location of this declaration.
The \field{type} field designates the type of this non-static member function. Note that the type also includes the calling convention.
The \field{home\_scope} designates the enclosing type declaration.
The \field{chart} designates the function parameter list along with their default arguments.
The \field{traits} indicates any additional function-specific traits (\secref{sec:ifc-function-traits}).
The \field{access} designates the access specifier for this function.
\partition{decl.method}
\subsection{\valueTag{DeclSort::Constructor}}
\label{sec:ifc:DeclSort:Constructor}
A \type{DeclIndex} abstract reference with tag \valueTag{DeclSort::Constructor} designates a constructor declaration.
The \field{index} field of that abstract reference is an index into the constructor declaration partition.
Each entry in that partition is a structure with the following components.
%
\begin{figure}[H]
\centering
\structure[text width = 15em]{
\DeclareMember{name}{TextOffset} \\
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{home\_scope}{DeclIndex} \\
\DeclareMember{chart}{ChartIndex} \\
\DeclareMember{traits}{FunctionTraits} \\
\DeclareMember{specifiers}{BasicSpecifiers} \\
\DeclareMember{access}{Access} \\
\DeclareMember{properties}{ReachableProperties} \\
}
\caption{Structure of a constructor declaration}
\label{fig:ifc-constructor-decl-structure}
\end{figure}
%
The meaning of the fields is as follows:
\begin{itemize}
\item \field{name} designates the name of the constructor.
\item \field{locus} denotes the source location of the constructor.
\item \field{type} denotes the type of this constructor, a type described in \sortref{Tor}{TypeSort}.
\item \field{home\_scope} denotes the declaration of the enclosing type.
\item \field{chart} denotes the function parameter list along with their default argument expressions.
\item \field{traits} designates function-specific traits (\secref{sec:ifc-function-traits}).
\item \field{specifiers} designate the usual basic declaration specifiers.
\item \field{access} designates the access specifier of the constructor.
\item \field{properties} denotes the set of reachable semantic properties of this constructor declaration.
\end{itemize}
\partition{decl.constructor}
\note{The \field{name} field is subject of further design modification}
The structure \type{NoexceptSpecification} has the following layout
%
\begin{figure}[H]
\centering
\structure[text width = 15em]{
\DeclareMember{words}{SentenceIndex} \\
\DeclareMember{sort}{NoexceptSort} \\
}
\caption{Structure of a \code{noexcept}-specification}
\label{fig:ifc-noexcept-specification-structure}
\end{figure}
%
The \field{words} field denotes the sentence making up the syntax of the noexcept-specification.
This field is meaningful only for templated functions for which the noexcept-specification is a dependent expression.
The \field{sort} field describes the computed semantics, if not dependent.
It has type
\begin{typedef}{NoexceptSort}{}
enum class NoexceptSort : uint8_t {
None,
False,