/
exprs.tex
2666 lines (2144 loc) · 95.9 KB
/
exprs.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
n \label{sec:ifc-exprs}
Expressions are indicated by abstract expression references.
They are values of type \type{ExprIndex}, with 32-bit precision and the
following layout
\begin{figure}[htbp]
\centering
\absref{6}{ExprSort}
\caption{\type{ExprIndex}: Abstract reference of expression}
\label{fig:ifc-expr-index}
\end{figure}
%
\begin{SortEnum}{ExprSort}
\enumerator{VendorExtension}
\enumerator{Empty}
\enumerator{Literal}
\enumerator{Lambda}
\enumerator{Type}
\enumerator{NamedDecl}
\enumerator{UnresolvedId}
\enumerator{TemplateId}
\enumerator{UnqualifiedId}
\enumerator{SimpleIdentifier}
\enumerator{Pointer}
\enumerator{QualifiedName}
\enumerator{Path}
\enumerator{Read}
\enumerator{Monad}
\enumerator{Dyad}
\enumerator{Triad}
\enumerator{String}
\enumerator{Temporary}
\enumerator{Call}
\enumerator{MemberInitializer}
\enumerator{MemberAccess}
\enumerator{InheritancePath}
\enumerator{InitializerList}
\enumerator{Cast}
\enumerator{Condition}
\enumerator{ExpressionList}
\enumerator{SizeofType}
\enumerator{Alignof}
\enumerator{Label}
\enumerator{Unused0}
\enumerator{Typeid}
\enumerator{DestructorCall}
\enumerator{SyntaxTree}
\enumerator{FunctionString}
\enumerator{CompoundString}
\enumerator{StringSequence}
\enumerator{Initializer}
\enumerator{Requires}
\enumerator{UnaryFold}
\enumerator{BinaryFold}
\enumerator{HierarchyConversion}
\enumerator{ProductTypeValue}
\enumerator{SumTypeValue}
\enumerator{SubobjectValue}
\enumerator{ArrayValue}
\enumerator{DynamicDispatch}
\enumerator{VirtualFunctionConversion}
\enumerator{Placeholder}
\enumerator{Expansion}
\enumerator{Generic}
\enumerator{Tuple}
\enumerator{Nullptr}
\enumerator{This}
\enumerator{TemplateReference}
\enumerator{Unused1}
\enumerator{TypeTraitIntrinsic}
\enumerator{DesignatedInitializer}
\enumerator{PackedTemplateArguments}
\enumerator{Tokens}
\enumerator{AssignInitializer}
\end{SortEnum}
\section{Expression structures}
\label{sec:ifc-expression-structures}
\subsection{\valueTag{ExprSort::VendorExtension}}
\label{sec:ifc:ExprSort:VendorExtension}
\partition{expr.vendor-extension}
\subsection{\valueTag{ExprtSort::Empty}}
\label{sec:ifc:ExprSort:Empty}
In certain circumstances, expressions are expected but missing, e.g. an empty-pack in a template-argument list.
An \type{ExprIndex} value with tag \valueTag{ExprSort::Empty} represents a reference to an empty expression.
The \field{index} field is an index into the empty expression partition.
Each entry in that partition has two components: a \field{type} field and a \field{locus} field.
%
\begin{figure}[H]
\centering
\structure{
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
}
\caption{Structure of an empty expression}
\label{fig:ifc-empty-expression-structure}
\end{figure}
%
The \field{type} field is a reference to the type of the expression.
The \field{locus} field is a reference to the source location.
\partition{expr.empty}
\subsection{\valueTag{ExprSort::Literal}}
\label{sec:ifc:ExprSort:Literal}
A \type{ExprIndex} value with tag \valueTag{ExprSort::Literal} represents a reference to a literal.
The \field{index} field is an index into the literal expression partition.
Each entry in that partition has three components: a \field{type} field, a \field{value} field, and a \field{locus} field.
%
\begin{figure}[H]
\centering
\structure{
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{value}{LitIndex} \\
}
\caption{Structure of a literal expression}
\label{fig:ifc-literal-expr-structure}
\end{figure}
%
The \field{type} field represents the type of the expression.
The \field{value} field represents the value of the expression.
The \field{locus} represents the source location of the expression.
\partition{expr.literal}
\subsubsection{Literal Values}
\label{sec:ifc-literal-values}
Literal values are represented by abstract references of type \type{LitIndex}, with the following layout
%
\begin{figure}[htbp]
\centering
\absref{2}{LiteralSort}
\caption{\type{LitIndex}: Abstract reference of literal constants}
\label{fig:ifc-lit-index}
\end{figure}
%
The possible values of the \field{tag} field are described by the type \type{LiteralSort} defined as follows
\begin{typedef}{LiteralSort}{}
enum class LiteralSort : uint8_t {
Immediate,
Integer,
FloatingPoint,
};
\end{typedef}
The meaning of these tags is as follows:
\begin{itemize}
\item \valueTag{LiteralSort::Immediate}: The \field{value} field of the abstract reference directly holds a 32-bit unsigned integer value.
\item \valueTag{LiteralSort::Integer}: The \field{value} field is an index into the \code{"const.i64"} partition. The value at that entry is a 64-bit unsigned integer value.
\item \valueTag{LiteralSort::FloatingPoint}: The \field{value} field is an index into the \code{"const.f64"} partition.
Each entry in that partition is a $12$-byte structure: The first $8$ bytes represent
a 64-bit floating point value, in IEEE 754 little endian format. The remaining $4$ bytes have indeterminate values.
\end{itemize}
\note{This representation is subject to change in future releases.}
\subsection{\valueTag{ExprSort::Lambda}}
\label{sec:ifc:ExprSort:Lambda}
An \type{ExprIndex} value with tag \valueTag{ExprSort::Lambda} designates a lambda expression in syntactic form (\secref{sec:ifc-syntax-tree-table}).
The \field{index} field of that abstract reference is an index into the lambda expression partition.
Each entry of that partition is a structure with the following structure:
%
\begin{figure}[H]
\centering
\structure[text width = 15em]{
\DeclareMember{introducer}{SyntaxIndex} \\
\DeclareMember{template\_parameters}{SyntaxIndex} \\
\DeclareMember{declarator}{SyntaxIndex} \\
\DeclareMember{constraint}{SyntaxIndex} \\
\DeclareMember{body}{SyntaxIndex} \\
}
\caption{Structure of a lambda expression}
\label{fig:ifc-lambda-structure}
\end{figure}
%
The \field{introducer} field designates the syntactic element for the lambda introducer.
The \field{template\_parameters} field designates the syntactic element for any possible template parameter list.
The \field{declarator} field designates the syntactic element for the declarator part of the lambda expression.
The \field{constraint} field designates the syntactic element for the requires-clause, if any.
Finally, the \field{body} field denotes the syntactic element for the body of the lambda expression.
\partition{expr.lambda}
\note{This representation is subject to change}
\subsection{\valueTag{ExprSort::Type}}
\label{sec:ifc:ExprSort:Type}
Certain C++ source-level contexts permit both value expressions and type expressions.
A \type{ExprIndex} value with tag \valueTag{ExprSort::Type} represents a reference to a type expression.
The \field{index} field is an index into the type expression partition.
Each entry in that partition has two components: a \field{type} field, and a \field{locus} field.
%
\begin{figure}[H]
\centering
\structure{
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{denotation}{TypeIndex} \\
}
\caption{Structure of a literal expression}
\label{fig:ifc-type-expr-structure}
\end{figure}
%
The \field{denotation} field is a reference to the type designated by this expression structure.
The \field{locus} field is the source location.
The \field{type} field designates the sort of type, typically \code{TypeBasis::Typename}.
\partition{expr.type}
\subsection{\valueTag{ExprSort::NamedDecl}}
\label{sec:ifc:ExprSort:NamedDecl}
A \type{ExprIndex} value with tag \valueTag{ExprSort::NamedDecl} denotes the use of a name of a declaration as an expression.
The \field{index} field is an index into the named declaration expression partition.
Each entry in that partition has three components: a \field{type} field, a \field{resolution} field, and a \field{locus} field.
%
\begin{figure}[H]
\centering
\structure{
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{resolution}{DeclIndex} \\
}
\caption{Structure of use of named declaration expression}
\label{fig:ifc-named-decl-expression-structure}
\end{figure}
%
The \field{type} field denotes the type of the expression.
The \field{resolution} field denotes the declaration the name resolved to, e.g. as indicated by the appropriate language rules.
The \field{locus} denotes the source location.
\partition{expr.decl}
\subsection{\valueTag{ExprtSort::UnresolvedId}}
\label{sec:ifc:ExprSort:UnresolvedId}
A \type{ExprIndex} value with tag \valueTag{ExprSort::UnresolveId} represents a C++ source-level dependent name, or an unresolve name.
The \field{index} field is an index into the unresolved name expression partition.
Each entry in that partition has two components: a \field{name} field, and a \field{locus} field.
%
\begin{figure}[H]
\centering
\structure{
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{name}{NameIndex} \\
}
\caption{Structure of an unresolved name expression}
\label{fig:ifc-unresolved-name-expression-structure}
\end{figure}
%
The \field{name} field denotes the name.
The \field{locus} field denotes the source location.
\partition{expr.unresolved}
\note{This structure is subject to removal in future releases.}
\subsection{\valueTag{ExprSort::TemplateId}}
\label{sec:ifc:ExprSort:TemplateId}
A \type{ExprIndex} value with tag \valueTag{ExprSort::TemplateId} represents a reference to a template-id.
The \field{index} field is an index into the template-id expression partition.
Each entry in that partition is a structure with three components: a \field{primary} field, an \field{arguments} field, and a \field{locus} field.
%
\begin{figure}[H]
\centering
\structure{
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{primary}{ExprIndex} \\
\DeclareMember{arguments}{ExprIndex} \\
}
\caption{Structure of a template-id expression}
\label{fig:ifc-template-id-expression-structure}
\end{figure}
%
The \field{primary} field denotes the primary template.
The \field{arguments} field denotes the template-argument list.
If that list is empty or is a singleton, \field{arguments} denotes that template-argument directly.
Otherwise, it denotes a tuple expression.
The \field{locus} denotes the source location.
\partition{expr.template-id}
\subsection{\valueTag{ExprSort::UnqualifiedId}}
\label{sec:ifc:ExprSort:UnqualifiedId}
A \type{ExprIndex} value with tag \valueTag{ExprSort::UnqualifiedId}
denotes the C++ grammar term \grammar{unqualified-id} or a component of \grammar{qualified-id} expression (\sortref{QualifiedName}{ExprSort}),
some of which might
not be bound to any declaration, or might be assumed to name a template by fiat (when preceded by the \code{template} keyword).
The \field{index} field is an index into the identifier expression partition. Each entry in that partition
is a structure with the following layout:
%
\begin{figure}[H]
\centering
\structure [text width = 15em]{
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{name}{NameIndex} \\
\DeclareMember{resolution}{ExprIndex} \\
\DeclareMember{template\_keyword}{SourceLocation} \\
}
\caption{Structure of an identifier used to form an expression}
\label{fig:ifc-identifier-expr-structure}
\end{figure}
%
The \field{name} denotes the name of that component in the \grammar{qualified-id} expression.
The \field{resolution} denotes the (possible set of) declaration the name refers to, if any.
The \field{template\_keyword}, if valid, designate the source location position of the \code{template} keyword.
The \field{locus} denotes the source location of this expression.
\partition{expr.unqualified-id}
\note{This structure is subject to change in future releases.}
\subsection{\valueTag{ExprSort::SimpleIdentifier}}
\label{sec:ifc:ExprSort:SimpleIdentifier}
A \type{ExprIndex} value with tag \valueTag{ExprSort::SimpleIdentifier} denotes the use of a simple name
in a templated code. Typically, these identifiers are used as label names. The \field{index} field is an index
into the simple identifier 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{name}{NameIndex} \\
}
\caption{Structure of a simple-identifier expression}
\label{fig:ifc-simple-identifier-structure}
\end{figure}
%
The \field{locus} field denotes the location of this expression. The \field{type}, if not null, denotes the
type of the expression. The \field{name} field designates the simple identifier.
\partition{expr.simple-identifier}
\note{This structure is subject to removal in future releases. }
\subsection{\valueTag{ExprSort::Pointer}}
\label{sec:ifc:ExprSort:Pointer}
An \type{ExprIndex} value with tag \valueTag{ExprSort::Pointer} designates the use of \code{*} in a
\grammar{ptr-declarator} as part of the a \grammar{declarator}. It is \emph{not} an expression.
The \field{index} field of that abstract reference designates an entry with the following layout
%
\begin{figure}[H]
\centering
\structure{
\DeclareMember{locus}{SourceLocation} \\
}
\label{fig:ifc-pointer-expr-structure}
\end{figure}
%
The \field{locus} designates the source location of the \code{*} in the input source code.
\partition{expr.pointer}
\note{This sort best belongs to the syntax tree hierarchy and has no bearing to expressions.
It is scheduled for removal in future releases of MSVC.}
\subsection{\valueTag{ExprSort::QualifiedName}}
\label{sec:ifc:ExprSort:QualifiedName}
An \type{ExprIndex} value with tag \valueTag{ExprSort::QualifiedName} designates a representation of
C++ input source level grammar term \grammar{qualified-id}, typically in templated code that is not
yet fully semantically analyzed. The \field{index} field of that abstract reference is an index into
the qualified name partition. Each entry of that partition has the following layout
%
\begin{figure}[H]
\centering
\structure[text width = 15em]{
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{elements}{ExprIndex} \\
\DeclareMember{typename\_keyword}{SourceLocation} \\
}
\caption{Structure of a qualified name expression}
\label{fig:ifc-qualified-name-structure}
\end{figure}
%
The \field{elements} field designates the sequence of unqualified names (\sortref{UnqualifiedId}{ExprSort})
in the source level construct. The \field{template\_keyword}, if not null, designates the presence of
the \code{typename} keyword in the input source program to indicate to the parser that the qualified name actually names a type.
\partition{expr.qualified-name}
\note{This structure is subject to change in future releases.}
\subsection{\valueTag{ExprSort::Path}}
\label{sec:ifc:ExprSort:Path}
A \type{ExprIndex} value with tag \valueTag{ExprSort::Path} represents
a reference to a qualified-id expression.
The \field{index} field is an index into the path expression partition.
Each entry in that partition has three components: a \field{scope} field, a \field{member} field, and a \field{locus} field.
%
\begin{figure}[H]
\centering
\structure{
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{scope}{ExprIndex} \\
\DeclareMember{member}{ExprIndex} \\
}
\caption{Structure of a path expression}
\label{fig:ifc-path-expression-structure}
\end{figure}
%
The \field{scope} field denotes the qualifying part of the expression.
The \field{member} field denotes the referenced member of the \field{scope}.
The \field{locus} field denotes the source location.
\partition{expr.path}
\subsection{\valueTag{ExprSort::Read}}
\label{sec:ifc:ExprSort:Read}
A \type{ExprIndex} value with tag \valueTag{ExprSort::Read} represents
a reference to an expression that reads from a given memory location.
It is also used to represents so-called lvalue-to-rvalue conversions.
The \field{index} field is an index into the read expression partition.
Each entry in that partition has three components: a \field{type} field, an \field{address} field, and a \field{locus} field.
%
\begin{figure}[H]
\centering
\structure{
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{address}{ExprIndex} \\
\DeclareMember{sort}{ReadConversionSort} \\
}
\caption{Structure of a read expression}
\label{fig:ifc-read-expression-structure}
\end{figure}
%
The \field{type} field denotes the type of the expression.
The \field{address} field denotes the memory location.
The \field{locus} denotes the source location.
The \field{sort} denotes the sort of conversion performed by this expression.
\partition{expr.read}
\note{This structure is subject to change in future releases.}
\subsubsection{\type{ReadConversionSort}}
An expression that reads from a memory location can also perform an implicit conversion either on the operand,
or on the result of the read. The sort of conversion performed is indicated by a value type \type{ReadConversionSort} defined as
\begin{typedef}{ReadConversionSort}{}
enum class ReadConversionSort : uint8_t {
Identity,
Indirection,
Dereference,
LvalueToRvalue,
IntegralConversion,
};
\end{typedef}
with the following semantics
\begin{itemize}
\item \valueTag{ReadConversionSort::Identity}: No special interpretation or conversion applied.
\item \valueTag{ReadConversionSort::Indirection}: This is an indirection via a pointer, or via the name of an entity treated as a pointer.
\item \valueTag{ReadConversionSort::Dereference}: The operand is a reference, and the result of the read is the address of the entity referred to.
\item \valueTag{ReadConversionSort::LvalueToRvalue}: This expression represents an lvalue-to-rvalue conversion
\item \valueTag{ReadConversionSort::IntegralConversion}: The result of the read operation is followed by an integral conversion.
\end{itemize}
\subsection{\valueTag{ExprtSort::Monad}}
\label{sec:ifc:ExprSort:Monad}
A \type{ExprIndex} value with tag \valueTag{ExprSort::Monad} represents the application of a (source-level) monadic operator to argument.
The \field{index} field is an index into the monadic expression 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{impl}{DeclIndex} \\
\DeclareMember{argument}{ExprIndex} \\
\DeclareMember{assoc}{MonadicOperator} \\
}
\caption{Structure of a monadic expression}
\label{fig:ifc-monadic-expression-structure}
\end{figure}
%
and meanings of the fields:
\begin{itemize}
\item \field{locus} denotes the source location.
\item \field{type} denotes the type of the expression.
\item \field{impl}, when non-null, designates the semantic resolution of the operator denoted by \code{assoc} if it is user-defined.
This semantic resolution can be an overload set (i.e. \valueTag{DeclSort::Tuple}) if the expression appears in a templated code,
accounting for the set of declarations found by applicable name lookup in the template definition context.
\item \field{argument} denotes the argument to the operator.
\item \field{assoc} field denotes the conceptual monadic operation, usually as written in the input C++ source code,
\secref{sec:ifc:OperatorSort:Monadic}.
\end{itemize}
\partition{expr.monad}
\subsection{\valueTag{ExprSort::Dyad}}
\label{sec:ifc:ExprSort:Dyad}
A \type{ExprIndex} value with tag \valueTag{ExprSort::Dyad} represents the application of a (source-level) dyadic operator (\secref{sec:ifc:OperatorSort:Dyadic}) to arguments.
The \field{index} field is an index into the dyadic expression 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{impl}{DeclIndex} \\
\DeclareMember{arguments}{ExprIndex[2]} \\
\DeclareMember{assoc}{DyadicOperator} \\
}
\caption{Structure of a dyadic expression}
\label{fig:ifc-dyadic-expression-structure}
\end{figure}
%
and meanings of the fields:
\begin{itemize}
\item The \field{locus} denotes the source location.
\item The \field{type} field denotes the type of the expression.
\item The \field{impl} field, when non-null, designates the semantic resolution of the operator denoted by \code{assoc}
if it is user-defined. This semantic resolution can be an overload set (\valueTag{DeclSort::Tuple}) if the expression
appears in a templated code, accounting for the set of declarations found by applicable name lookup in the template definition context.
\item The \field{arguments} field denotes the two arguments to the operator.
\item The \field{assoc} field denotes the conceptual dyadic operation, usually as written in the input C++ source code
(\secref{sec:ifc:OperatorSort:Dyadic}).
\end{itemize}
\partition{expr.dyad}
\subsection{\valueTag{ExprSort::Triad}}
\label{sec:ifc:ExprSort:Triad}
A \type{ExprIndex} value with tag \valueTag{ExprSort::Monad} represents the application of a (source-level) triadic operator (\secref{sec:ifc:OperatorSort:Triadic}) to arguments.
The \field{index} field is an index into the triadic expression 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{impl}{DeclIndex} \\
\DeclareMember{arguments}{ExprIndex[3]} \\
\DeclareMember{assoc}{TriadicOperator} \\
}
\caption{Structure of a triadic expression}
\label{fig:ifc-triadic-expression-structure}
\end{figure}
%
and meaning of the fields:
\begin{itemize}
\item \field{locus} denotes the source location.
\item \field{type} denotes the type of the expression.
\item \field{impl}, when non-null, designates the semantic resolution of the operator denoted by \code{assoc} if it is user-defined.
This semantic resolution can be an overload set (\valueTag{DeclSort::Tuple}) if the expression appears in a templated code,
accounting for the set of declarations found by applicable name lookup in the template definition context.
\item \field{arguments} denotes the three arguments to the operator.
\item \field{assoc} denotes the conceptual triadic operation, usually as written in the input C++ source code
(\secref{sec:ifc:OperatorSort:Triadic}).
\end{itemize}
\partition{expr.triad}
\subsection{\valueTag{ExprSort::String}}
\label{sec:ifc:ExprSort:String}
A \type{ExprIndex} value with tag \valueTag{ExprSort::String} represents a reference to a string literal
expression. The \field{index} field is an index into the string literal partition (not to be confused with the string table).
Each entry of that partition is a structure with the following components: a \field{string\_index} field, and a \field{locus} field.
%
\begin{figure}[H]
\centering
\structure{
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{string\_index}{StringIndex} \\
}
\caption{Structure of a string literal expression}
\label{fig:ifc-string-literal-expression-structure}
\end{figure}
%
The \field{string\_index} field is an index into the partition of the representations of string literals.
The \field{locus} denotes the source location.
The interpretation of each
string in that table is given by the abstract reference, a \type{StringIndex}, used to index into
the string table. A \type{StringIndex} value, like any abstract reference, is a 32-bit value:
\begin{figure}[H]
\centering
\absref{4}{StringSort}
\caption{\type{StringIndex}: Abstract reference of string constant}
\label{fig:ifc-string-index}
\end{figure}
In its current implementation, the tag of the \type{StringIndex} is given by the following declaration
\begin{lstlisting}
enum class StringSort : uint8_t {
Ordinary,
UTF8,
Char16,
Char32,
Wide,
};
\end{lstlisting}
The string table is always present, and non-empty. It is an array of bytes, the content of which is interpreted according to the abstract reference used to index it.
The first entry is the NUL byte, therefore a \type{StringIndex} with 0 \field{tag} and 0 \field{index} represents the empty string.
\partition{expr.strings}
\subsubsection{\valueTag{StringSort::Ordinary}}
A \type{StringIndex} with tag \valueTag{StringSort::Ordinary} represents an ordinary, narrow NUL-terminated string constant.
The \field{value} field is an index into the string table, pointing to the first byte of the string.
\subsubsection{\valueTag{StringSort::UTF8}}
A \type{StringIndex} with tag \valueTag{StringSort::UTF8} represents a UTF-8 narrow NUL-terminated string constant.
In terms of C++ source-level construct, it represents a string constant with \code{u8} prefix.
The \field{value} field is an index into the string table, pointing to the first byte of the string.
\subsubsection{\valueTag{StringSort::Char16}}
A \type{StringIndex} with tag \valueTag{StringSort::Char16} represents a \code{char16_t} string constant with \code{u} prefix.
The \field{value} field is an index into the string table, pointing to the first byte of the string.
\subsubsection{\valueTag{StringSort::Char32}}
A \type{StringIndex} with tag \valueTag{StringSort::Char32} represents a \code{char32_t} string constant with \code{u} prefix.
The \field{value} field is an index into the string table, pointing to the first byte of the string.
\subsubsection{\valueTag{StringSort::Wide}}
A \type{StringIndex} with tag \valueTag{StringSort::Wide} represents wide string constant with only the \code{L} prefix.
The \field{value} field is an index into the string table, pointing to the first byte of the string.
\subsubsection{String literal structure}
Each entry of the partition for string literal representation is a structure with the following components:
%
\begin{figure}[H]
\centering
\structure{
\DeclareMember{start}{TextOffset} \\
\DeclareMember{length}{Cardinality} \\
\DeclareMember{suffix}{TextOffset} \\
}
\caption{Structure of a string literal}
\label{fig:ifc-string-literal-structure}
\end{figure}
%
The \field{start} field is an index into the string table, representing the start of the string.
The \field{length} field denotes the number of bytes taken up by the string, not counting suffix, if any.
The \field{suffix} field is an index into the string table denoting the suffix, if any, of the string literal.
\partition{const.str}
\subsection{\valueTag{ExprSort::Temporary}}
\label{sec:ifc:ExprSort:Temporary}
A \type{ExprIndex} value with tag \valueTag{ExprSort::Temporary} represents a
reference to a C++ source-level expression designating a temporary object.
The \field{index} field is an index into the temporary expression partition.
Each entry in that partition is a structure with the following components: a \field{type} field, an \field{id} field, and a \field{locus} field.
%
\begin{figure}[H]
\centering
\structure{
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{id}{UniqueID} \\
}
\caption{Structure of a temporary object expression}
\label{fig:ifc-temporary-expression-structure}
\end{figure}
%
The \field{type} field denotes the type of the expression.
The \field{id} field denotes a unique identification of the temporary object.
Its value is of type \newtype{UniqueID}{32}
The \field{locus} field denotes the source location.
\partition{expr.temporary}
\subsection{\valueTag{ExprSort::Call}}
\label{sec:ifc:ExprSort:Call}
A \type{ExprIndex} value with tag \valueTag{ExprSort::Call} represents
a reference to a call expression.
The \field{index} field is an index into the call expression partition.
Each entry in that partition is a structure with five components: a \field{type} field, an \field{operation} field, an \field{arguments} field,
a \field{locus} field, and an \field{opcat} field.
%
\begin{figure}[H]
\centering
\structure{
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{operation}{ExprIndex} \\
\DeclareMember{arguments}{ExprIndex} \\
}
\caption{Structure of a call expression}
\label{fig:ifc-call-expression-structure}
\end{figure}
%
The \field{type} field denotes the type of the expression. Usually, it the return type of the function.
The \field{operation} field denotes the expression being invoked.
The \field{arguments} field denotes the list of arguments to supplied. It that list is empty or a singleton, \field{arguments} directly denotes that expression.
Otherwise it denotes a type expression.
The \field{locus} field denotes the source location.
\partition{expr.call}
\subsection{\valueTag{ExprSort::MemberInitializer}}
\label{sec:ifc:ExprSort:MemberInitializer}
An \type{ExprIndex} value with tag \valueTag{ExprSort::MemberInitializer} designates the initialization of
a base-class subobject, or a non-static data member, or a call to a delegated constructor. The \field{index}
field of that abstract reference is an index into the member initializer partition. Each entry in that
partition has the following layout
%
\begin{figure}[H]
\centering
\structure{
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{member}{DeclIndex} \\
\DeclareMember{base}{TypeIndex} \\
\DeclareMember{initializer}{ExprIndex} \\
}
\caption{Structure of a member-initializer expression}
\label{fig:ifc-member-initializer-expression-structure}
\end{figure}
%
The \field{locus} field designates the source location of the member initialization.
The \field{type} field denotes the type of the initialization.
The \field{member} field, if not null, designates the non-static data member being initialized.
The \field{base} field, if not null, designates the initialization of a base-class subobject.
Both fields \field{member} and \field{base} cannot be simultaneously non-null.
However, they can be simultaneously null; in that case, the expression is used
to represent a call to a delegated constructor.
The \field{initializer} field denotes the expression performing the initialization.
\partition{expr.member-initializer}
\note{This structure is subject to change in future releases.}
\subsection{\valueTag{ExprSort::MemberAccess}}
\label{sec:ifc:ExprSort:MemberAccess}
An \type{ExprIndex} value with tag \valueTag{ExprSort::MemberAccess} designates
an access to a non-static data member of an object. The access is expressed in terms of
base address (of the object) and an offset (in bytes) to the member.
The \field{index} field of the abstract reference is an index into the member access partition.
Each entry of that partition has the following layout:
%
\begin{figure}[H]
\centering
\structure{
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{offset}{ExprIndex} \\
\DeclareMember{enclosing}{TypeIndex} \\
\DeclareMember{name}{TextOffset} \\
}
\caption{Structure of a member access expression}
\label{fig:ifc:ExprSort:MemberAccess}
\end{figure}
%
The \field{locus} field designates the source location of this expression.
The \field{type} field denotes the type of the member access expression.
The \field{offset} is an expression designating the byte offset of the non-static data member
from the starting address of its enclosing object.
The member being accessed
is indirectly described by its \field{enclosing} class type, and its \field{name}.
\partition{expr.member-access}
\note{This representation is subject to change in future releases.}
\subsection{\valueTag{ExprSort::InheritancePath}}
\label{sec:ifc:ExprSort:InheritancePath}
An \type{ExprIndex} value with tag \valueTag{ExprSort::InheritancePath} designates an expression ``path'' to a base-class subobject.
The \field{index} field of that abstract reference is an index into the inheritance path partition.
Each entry of that partition is a structure with the following layout
%
\begin{figure}[H]
\centering
\structure{
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{path}{ExprIndex} \\
}
\caption{Structure of an inheritance path expression}
\label{fig:ifc-inheritance-path-expression-structure}
\end{figure}
%
The \field{locus} field designates the source location of this expression.
The \field{type} field denotes the type of the expression.
the \field{path} is a sequence of expressions designating each base-class component of the path.
\partition{expr.inheritance-path}
\subsection{\valueTag{ExprSort::InitializerList}}
\label{sec:ifc:ExprSort:InitializerList}
An \type{ExprIndex} value with tag \valueTag{ExprSort::InitializerList} designates a brace-enclosed comma-separated
sequence of expressions.
The \field{index} field is an index into the partition of initializer list expressions.
Each entry in that partition is a structure with the following layout
%
\begin{figure}[H]
\centering
\structure{
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{elements}{ExprIndex} \\
}
\caption{Structure of an initializer-list expression}
\label{fig:ifc-initializer-list-structure}
\end{figure}
%
The \field{elements} field denotes the sequence of expressions enclosed in the brace delimiters.
\partition{expr.initializer-list}
\subsection{\valueTag{ExprSort::Cast}}
\label{sec:ifc:ExprSort:Cast}
An \type{ExprIndex} value with tag \valueTag{ExprSort::Cast} designates a conversion operation.
The conversion may be explicit (in the input source code) and implicit (as required by semantics analysis).
The \field{index} field of this abstract reference is a position into the partition of cast expressions.
Each entry in that partition is a structure with the following layout
%
\begin{figure}[H]
\centering
\structure{
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{source}{ExprIndex} \\
\DeclareMember{target}{Index} \\
\DeclareMember{operator}{DyadicOperator} \\
}
\caption{Structure of a cast expression}
\label{fig:ifc:ExprSort:Cast}
\end{figure}
%
The \field{source} field denotes the operand expression, whereas the \field{target} field denotes
the type to convert that expression to. The \field{operator} designates the sort of conversion operation
to perform.
\partition{expr.cast}
\subsection{\valueTag{ExprSort::Condition}}
\label{sec:ifc:ExprSort:Condition}
An \type{ExprIndex} value with tag \valueTag{ExprSort::Condition} designates a syntactic
representation of an expression used as guarding predicate of an \code{if}-statement in a templated code.
The \field{index} field of this abstract reference is a position designating an entry of the
partition of syntactic condition expressions. Each such an entry is a structure with the following layout
%
\begin{figure}[H]
\centering
\structure{
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{expr}{ExprIndex} \\
}
\caption{Structure of a condition expression}
\label{fig:ifc:ExprSort:Condition}
\end{figure}
%
The \field{expr} field denotes the expression wrapped in this condition structure.
\partition{expr.condition}
\note{This structure is scheduled for removal in future releases.}
\subsection{\valueTag{ExprSort::ExpressionList}}
\label{sec:ifc:ExprSort:ExpressionList}
An \type{ExprIndex} value with tag \valueTag{ExprSort::ExpressionList} designates a syntactic representation
of a comma-separated sequence of expressions enclosed in a pair of matching delimiters, in a templated code.
The \field{index} field of this abstract reference is a position designating an entry of the partition of
syntactic expression-list expressions. Each such entry is a structure with the following layout
%
\begin{figure}[H]
\centering
\structure{
\DeclareMember{left}{SourceLocation} \\
\DeclareMember{right}{SourceLocation} \\
\DeclareMember{contents}{ExprIndex} \\
\DeclareMember{delimiter}{DelimiterSort} \\
}
\caption{Structure of an expression list}
\label{fig:ifc:ExprSort:ExpressionList}
\end{figure}
%
The \field{left} field represents the source location of the opening delimiter, whereas the \field{right}
field represents the source location of the closing delimiter.
The \field{delimiter} field is of type
\begin{typedef}{DelimiterSort}{}
enum class DelimiterSort : uint8_t {
Unknown = 0,
Brace = 1,
Parenthesis = 2,
};
\end{typedef}
and denotes the sort of delimiter:
\begin{itemize}
\item \valueTag{DelimiterSort::Brace} for matching brace delimiters
\item \valueTag{DelimiterSort::Parenthesis} for matching parenthesis delimiters
\end{itemize}
\partition{expr.expression-list}
\note{This structure is scheduled for removal in future releases.}
\subsection{\valueTag{ExprSort::SizeofType}}
\label{sec:ifc:ExprSort:SizeofType}
An \type{ExprIndex} value with tag \valueTag{ExprSort::SizeofType} designates a syntactic representation
of a \code{sizeof}-expression where the operand is a type.
The \field{index} field of this abstract reference is a position designating an entry of the partition
of syntactic \code{sizeof}-expressions. Each such entry is a structure with the following layout
%
\begin{figure}[H]
\centering
\structure{
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{operand}{TypeIndex} \\
}
\caption{Structure of \code{sizeof} expression}
\label{fig:ifc:ExprSort:SizeofType}
\end{figure}
%
The \field{operand} field designates the type operand to the \code{sizeof} operator in that expression.
The \field{type} field designates the type of the entire \code{sizeof}-expression.
\partition{expr.sizeof-type}
\note{This structure is subject to removal in future releases.}
\subsection{\valueTag{ExprSort::Alignof}}
\label{sec:ifc:ExprSort:Alignof}
An \type{ExprIndex} value with tag \valueTag{ExprSort::Alignof} designates a syntactic representation
of a \code{alignof}-expression.
The \field{index} field of this abstract reference is a position designating an entry of the partition
of syntactic \code{alignof}-expressions. Each such entry is a structure with the following layout
%
\begin{figure}[H]
\centering
\structure{
\DeclareMember{locus}{SourceLocation} \\
\DeclareMember{type}{TypeIndex} \\
\DeclareMember{operand}{TypeIndex} \\
}
\caption{Structure of \code{alignof} expression}
\label{fig:ifc:ExprSort:Alignof}