Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for statement-as-expression #92

Merged
merged 1 commit into from
Jul 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 39 additions & 4 deletions ltx/exprs.tex
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
\enumerator{Nullptr}
\enumerator{This}
\enumerator{TemplateReference}
\enumerator{Unused1}
\enumerator{Statement}
\enumerator{TypeTraitIntrinsic}
\enumerator{DesignatedInitializer}
\enumerator{PackedTemplateArguments}
Expand Down Expand Up @@ -1568,10 +1568,31 @@ \subsection{\valueTag{ExprSort::TemplateReference}}

\note{This structure is subject to removal in future releases.}

\subsection{\valueTag{ExprSort::Unused1}}
\label{sec:ifc:ExprSort:Unused1}
\subsection{\valueTag{ExprSort::Statement}}
\label{sec:ifc:ExprSort:Statement}

No structured is associated with this sort value.
A \type{ExprIndex} value with tag \valueTag{ExprSort::Statement} represents an abstract reference to a statement used
in a context where an expression would normally occur. Such a context could be in support of code transformation that
expands a function call to its body where arguments are substituted for parameters, or in support of some extensions
such as ``statement expressions''. Yet, another context would be to satisfy IFC-internal typing requirements
where a structure is notionally a statement, but needs to appear as argument to an operator expecting an expression
structure. In such cases, this structure effectively acts as an embedding of a statement structure in the
expression sort category. The \field{index} is an index into the statement-as-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{stmt}{StmtIndex} \\
}
\end{figure}
%
and meanings for the fields
\begin{itemize}
\item \field{stmt} designates the statement being embedded in the expression sort category.
\end{itemize}


\subsection{\valueTag{ExprSort::TypeTraitIntrinsic}}
Expand Down Expand Up @@ -1892,6 +1913,9 @@ \subsection{Monadic operators}
\enumerator{MsvcConfusedPopState}
\enumerator{MsvcConfusedDtorAction}
\enumerator{MsvcConfusedVtorDisplacement}
\enumerator{MsvcConfusedDependentExpression}
\enumerator{MsvcConfusedSubstitution}
\enumerator{MsvcConfusedAggregateReturn}
\end{Enumeration}

\ifcSortSection{Unknown}{MonadicOperator}
Expand Down Expand Up @@ -2095,6 +2119,17 @@ \subsection{Monadic operators}
\ifcSortSection{MsvcConfusedDependentSizeof}{MonadicOperator}
Source-level \code{sizeof} operator, used in an expression where the operand is dependent.

\ifcSortSection{MsvcConfusedDependentExpression}{MonadicOperator}
This operator indicates a weakness in the current MSVC parser whereby certain expressions are explicitly
marked dependent (with no indication of whether they are type-dependent or value-dependent).

\ifcSortSection{MsvcConfusedSubstitution}{MonadicOperator}
This operator indicates a substitution of an expression (the operand) for a template parameter declaration
(the implementation field of the monadic tree).

\ifcSortSection{MsvcConfusedAggregateReturn}{MonadicOperator}
This operator indicates a semantic action of a \code{return} statement where the expression-to-return
evaluates to an aggregate with at least one subobject having non-trivial destructor.

\subsection{Dyadic operators}
\label{sec:ifc:OperatorSort:Dyadic}
Expand Down