9#ifndef FORTRAN_EVALUATE_EXPRESSION_H_
10#define FORTRAN_EVALUATE_EXPRESSION_H_
21#include "formatting.h"
24#include "flang/Common/idioms.h"
25#include "flang/Common/indirection.h"
26#include "flang/Common/template.h"
27#include "flang/Parser/char-block.h"
28#include "flang/Support/Fortran.h"
40using common::LogicalOperator;
41using common::RelationalOperator;
60template <
typename A>
using ResultType =
typename std::decay_t<A>::Result;
61template <
typename A>
constexpr int ResultKind = std::decay_t<A>::kind();
66 using Result = RESULT;
72#if defined(__APPLE__) && defined(__GNUC__)
74 const Derived &derived()
const;
76 Derived &derived() {
return *
static_cast<Derived *
>(
this); }
77 const Derived &derived()
const {
return *
static_cast<const Derived *
>(
this); }
81 template <
typename A> Derived &operator=(
const A &x) {
82 Derived &d{derived()};
87 template <
typename A> common::IfNoLvalue<Derived &, A> operator=(A &&x) {
88 Derived &d{derived()};
93 std::optional<DynamicType> GetType()
const;
96 std::string AsFortran()
const;
97#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
98 LLVM_DUMP_METHOD
void dump()
const;
100 llvm::raw_ostream &AsFortran(llvm::raw_ostream &)
const;
113template <
typename DERIVED,
typename RESULT,
typename... OPERANDS>
118 using OperandTypes = std::tuple<OPERANDS..., std::monostate>;
121 using Derived = DERIVED;
122 using Result = RESULT;
123 static constexpr std::size_t operands{
sizeof...(OPERANDS)};
125 static_assert(IsSpecificIntrinsicType<Result> ||
126 (operands == 1 && std::is_same_v<Result, Type<TypeCategory::Derived>>));
127 template <
int J>
using Operand = std::tuple_element_t<J, OperandTypes>;
129 constexpr int kind()
const {
return kind_; }
134 using Container = std::conditional_t<operands == 1,
135 common::CopyableIndirection<Expr<Operand<0>>>,
136 std::tuple<common::CopyableIndirection<Expr<OPERANDS>>...>>;
139 CLASS_BOILERPLATE(Operation)
141 : kind_{kind}, operand_{x...} {
142 CHECK_KIND(kind, RESULT);
145 : kind_{kind}, operand_{std::move(x)...} {
146 CHECK_KIND(kind, RESULT);
149 Derived &derived() {
return *
static_cast<Derived *
>(
this); }
150 const Derived &derived()
const {
return *
static_cast<const Derived *
>(
this); }
158 if constexpr (operands == 1) {
159 static_assert(J == 0);
160 return operand_.value();
162 return std::get<J>(operand_).value();
166 if constexpr (operands == 1) {
167 static_assert(J == 0);
168 return operand_.value();
170 return std::get<J>(operand_).value();
177 std::conditional_t<(operands > 1),
Expr<Operand<1>> &,
void> right() {
178 if constexpr (operands > 1) {
182 std::conditional_t<(operands > 1),
const Expr<Operand<1>> &,
void>
184 if constexpr (operands > 1) {
189 constexpr std::optional<DynamicType> GetType()
const {
193 int rank{left().Rank()};
194 if constexpr (operands > 1) {
195 return std::max(rank, right().Rank());
200 static constexpr int Corank() {
return 0; }
202 bool operator==(
const Operation &that)
const {
203 return kind() == that.kind() && operand_ == that.operand_;
206 llvm::raw_ostream &AsFortran(llvm::raw_ostream &)
const;
217template <
typename TO, TypeCategory FROMCAT = TO::category>
218struct Convert :
public Operation<Convert<TO, FROMCAT>, TO, Type<FROMCAT>> {
222 ((TO::category == TypeCategory::Integer ||
223 TO::category == TypeCategory::Real ||
224 TO::category == TypeCategory::Unsigned) &&
225 (FROMCAT == TypeCategory::Integer || FROMCAT == TypeCategory::Real ||
226 FROMCAT == TypeCategory::Unsigned)) ||
227 TO::category == FROMCAT);
230 using Base = Operation<Convert, Result, Operand>;
233 llvm::raw_ostream &AsFortran(llvm::raw_ostream &)
const;
237struct Parentheses :
public Operation<Parentheses<A>, A, A> {
240 using Base = Operation<Parentheses, A, A>;
243 explicit Parentheses(
const Expr<A> &x) : Base{x.kind(), x} {}
244 explicit Parentheses(
Expr<A> &&x) : Base{x.kind(), std::move(x)} {}
248struct Parentheses<
Type<TypeCategory::Derived>>
249 :
public Operation<Parentheses<Type<TypeCategory::Derived>>,
250 Type<TypeCategory::Derived>, Type<TypeCategory::Derived>> {
254 using Base = Operation<Parentheses, Type<TypeCategory::Derived>,
263template <
typename A>
struct Negate :
public Operation<Negate<A>, A, A> {
266 using Base = Operation<Negate, A, A>;
269 explicit Negate(
const Expr<A> &x) : Base{x.kind(), x} {}
270 explicit Negate(
Expr<A> &&x) : Base{x.kind(), std::move(x)} {}
273struct ComplexComponent
274 :
public Operation<ComplexComponent, Type<TypeCategory::Real>,
275 Type<TypeCategory::Complex>> {
278 using Base = Operation<ComplexComponent, Result, Operand>;
279 CLASS_BOILERPLATE(ComplexComponent)
283 bool isImaginaryPart{
true};
286struct Not :
public Operation<Not, Type<TypeCategory::Logical>,
287 Type<TypeCategory::Logical>> {
289 using Operand = Result;
290 using Base = Operation<Not, Result, Operand>;
298struct SetLength :
public Operation<SetLength, Type<TypeCategory::Character>,
299 Type<TypeCategory::Character>, SubscriptInteger> {
301 using CharacterOperand = Result;
302 using LengthOperand = SubscriptInteger;
303 using Base = Operation<SetLength, Result, CharacterOperand, LengthOperand>;
309template <
typename A>
struct Add :
public Operation<Add<A>, A, A, A> {
312 using Base = Operation<Add, A, A, A>;
316template <
typename A>
struct Subtract :
public Operation<Subtract<A>, A, A, A> {
319 using Base = Operation<Subtract, A, A, A>;
323template <
typename A>
struct Multiply :
public Operation<Multiply<A>, A, A, A> {
326 using Base = Operation<Multiply, A, A, A>;
330template <
typename A>
struct Divide :
public Operation<Divide<A>, A, A, A> {
333 using Base = Operation<Divide, A, A, A>;
337template <
typename A>
struct Power :
public Operation<Power<A>, A, A, A> {
340 using Base = Operation<Power, A, A, A>;
346 :
public Operation<RealToIntPower<A>, A, A, Type<TypeCategory::Integer>> {
347 using Base = Operation<RealToIntPower, A, A, Type<TypeCategory::Integer>>;
349 using BaseOperand = A;
354template <
typename A>
struct Extremum :
public Operation<Extremum<A>, A, A, A> {
357 using Base = Operation<Extremum, A, A, A>;
358 CLASS_BOILERPLATE(Extremum)
360 : Base{x.kind(), x, y}, ordering{ord} {
361 CHECK(x.kind() == y.kind());
364 : Base{x.kind(), std::move(x), std::move(y)}, ordering{ord} {
365 CHECK(this->left().kind() == this->right().kind());
367 bool operator==(
const Extremum &)
const;
368 Ordering ordering{Ordering::Greater};
371struct ComplexConstructor
372 :
public Operation<ComplexConstructor, Type<TypeCategory::Complex>,
373 Type<TypeCategory::Real>, Type<TypeCategory::Real>> {
376 using Base = Operation<ComplexConstructor, Result, Operand, Operand>;
386 :
public Operation<Concat, Type<TypeCategory::Character>,
387 Type<TypeCategory::Character>, Type<TypeCategory::Character>> {
389 using Operand = Result;
390 using Base = Operation<Concat, Result, Operand, Operand>;
399struct LogicalOperation
400 :
public Operation<LogicalOperation, Type<TypeCategory::Logical>,
401 Type<TypeCategory::Logical>, Type<TypeCategory::Logical>> {
403 using Operand = Result;
404 using Base = Operation<LogicalOperation, Result, Operand, Operand>;
405 CLASS_BOILERPLATE(LogicalOperation)
409 bool operator==(
const LogicalOperation &)
const;
410 LogicalOperator logicalOperator;
415template <
typename T>
class ConditionalExpr {
419 constexpr int kind()
const {
return kind_; }
421 CLASS_BOILERPLATE(ConditionalExpr)
424 : kind_{thenVal.kind()}, condition_{std::move(cond)},
425 thenValue_{std::move(thenVal)}, elseValue_{std::move(elseVal)} {
426 CHECK_KIND(kind(), Result);
427 CHECK(thenValue().kind() == elseValue().kind());
429 bool operator==(
const ConditionalExpr &)
const;
432 Expr<Result> &thenValue() {
return thenValue_.value(); }
433 const Expr<Result> &thenValue()
const {
return thenValue_.value(); }
434 Expr<Result> &elseValue() {
return elseValue_.value(); }
435 const Expr<Result> &elseValue()
const {
return elseValue_.value(); }
436 int Rank()
const {
return thenValue().Rank(); }
437 std::optional<DynamicType> GetType()
const {
438 const auto thenType{thenValue().GetType()};
439 if constexpr (T::category == TypeCategory::Derived) {
441 if (thenType && !thenType->IsPolymorphic()) {
442 if (
const auto elseType{elseValue().GetType()}) {
443 if (elseType->IsPolymorphic()) {
451 static constexpr int Corank() {
return 0; }
452 llvm::raw_ostream &AsFortran(llvm::raw_ostream &)
const;
456 common::CopyableIndirection<Expr<LogicalResult>> condition_;
457 common::CopyableIndirection<Expr<Result>> thenValue_;
458 common::CopyableIndirection<Expr<Result>> elseValue_;
465 using Result = SubscriptInteger;
468 static constexpr int kind() {
return SubscriptIntegerKind; }
471 return {TypeCategory::Integer, kind()};
473 static constexpr int Rank() {
return 0; }
474 static constexpr int Corank() {
return 0; }
478template <
typename RESULT>
class ImpliedDo {
480 using Result = RESULT;
481 using Index = ResultType<ImpliedDoIndex>;
484 : name_{name}, lower_{std::move(lower)}, upper_{std::move(upper)},
485 stride_{std::move(stride)}, values_{std::move(values)} {}
486 DEFAULT_CONSTRUCTORS_AND_ASSIGNMENTS(ImpliedDo)
487 bool operator==(
const ImpliedDo &)
const;
490 const Expr<Index> &lower()
const {
return lower_.value(); }
492 const Expr<Index> &upper()
const {
return upper_.value(); }
494 const Expr<Index> &stride()
const {
return stride_.value(); }
497 return values_.value();
502 common::CopyableIndirection<Expr<Index>> lower_, upper_, stride_;
503 common::CopyableIndirection<ArrayConstructorValues<Result>> values_;
507 using Result = RESULT;
512template <
typename RESULT>
class ArrayConstructorValues {
514 using Result = RESULT;
515 using Values = std::vector<ArrayConstructorValue<Result>>;
516 DEFAULT_CONSTRUCTORS_AND_ASSIGNMENTS(ArrayConstructorValues)
517 ArrayConstructorValues() {}
519 bool operator==(
const ArrayConstructorValues &)
const;
520 static constexpr int Rank() {
return 1; }
521 static constexpr int Corank() {
return 0; }
522 template <
typename A> common::NoLvalue<A> Push(A &&x) {
523 values_.emplace_back(std::move(x));
526 typename Values::iterator begin() {
return values_.begin(); }
527 typename Values::const_iterator begin()
const {
return values_.begin(); }
528 typename Values::iterator end() {
return values_.end(); }
529 typename Values::const_iterator end()
const {
return values_.end(); }
539template <
typename RESULT>
540class ArrayConstructor :
public ArrayConstructorValues<RESULT> {
542 using Result = RESULT;
543 using Base = ArrayConstructorValues<Result>;
545 constexpr int kind()
const {
return kind_; }
547 DEFAULT_CONSTRUCTORS_AND_ASSIGNMENTS(ArrayConstructor)
548 explicit ArrayConstructor(
int kind, Base &&values)
549 : Base{std::move(values)}, kind_{kind} {
550 CHECK_KIND(kind, RESULT);
552 template <
typename T>
553 explicit ArrayConstructor(
int kind,
const Expr<T> &) : kind_{kind} {
554 CHECK_KIND(kind, RESULT);
556 static constexpr Result result(
int kind) {
return Result{kind}; }
557 DynamicType GetType()
const {
return {Result::category, kind_}; }
558 bool operator==(
const ArrayConstructor &that)
const {
559 return kind() == that.kind() && Base::operator==(that);
561 llvm::raw_ostream &AsFortran(llvm::raw_ostream &)
const;
568class ArrayConstructor<
Type<TypeCategory::Character>>
569 :
public ArrayConstructorValues<Type<TypeCategory::Character>> {
572 using Base = ArrayConstructorValues<Result>;
574 constexpr int kind()
const {
return kind_; }
576 DEFAULT_CONSTRUCTORS_AND_ASSIGNMENTS(ArrayConstructor)
577 explicit ArrayConstructor(
int kind, Base &&values)
578 : Base{std::move(values)}, kind_{kind} {
579 CHECK_KIND(kind, Result);
581 template <
typename T>
582 explicit ArrayConstructor(
int kind,
const Expr<T> &) : kind_{kind} {
583 CHECK_KIND(kind, Result);
586 bool operator==(
const ArrayConstructor &)
const;
587 static constexpr Result result(
int kind) {
return Result{kind}; }
588 DynamicType GetType()
const {
return {Result::category, kind()}; }
589 llvm::raw_ostream &AsFortran(llvm::raw_ostream &)
const;
591 return length_ ? &length_->value() :
nullptr;
596 std::optional<common::CopyableIndirection<Expr<SubscriptInteger>>> length_;
600class ArrayConstructor<
Type<TypeCategory::Derived>>
601 :
public ArrayConstructorValues<Type<TypeCategory::Derived>> {
604 using Base = ArrayConstructorValues<Result>;
606 static constexpr int kind() {
return 0; }
608 CLASS_BOILERPLATE(ArrayConstructor)
611 : Base{std::move(v)}, result_{spec} {}
612 template <
typename A>
613 explicit ArrayConstructor(
const A &prototype)
614 : result_{prototype.GetType().value().GetDerivedTypeSpec()} {}
615 template <
typename A>
616 explicit ArrayConstructor(
int kind,
const A &prototype)
617 : result_{prototype.GetType().value().GetDerivedTypeSpec()} {
621 bool operator==(
const ArrayConstructor &)
const;
622 constexpr Result result()
const {
return result_; }
623 constexpr DynamicType GetType()
const {
return result_.GetType(); }
624 llvm::raw_ostream &AsFortran(llvm::raw_ostream &)
const;
638 EVALUATE_UNION_CLASS_BOILERPLATE(
Expr)
641 using Conversions = std::tuple<Convert<Result, TypeCategory::Integer>,
644 using Operations = std::tuple<Parentheses<Result>,
Negate<Result>,
647 using Indices = std::tuple<ImpliedDoIndex>;
648 using TypeParamInquiries = std::tuple<TypeParamInquiry>;
649 using DescriptorInquiries = std::tuple<DescriptorInquiry>;
650 using RankOneBoundElements = std::tuple<RankOneBoundElement>;
655 common::TupleToVariant<common::CombineTuples<Operations, Conversions, Indices,
656 TypeParamInquiries, DescriptorInquiries, RankOneBoundElements, Others>>
666 EVALUATE_UNION_CLASS_BOILERPLATE(
Expr)
669 using Conversions = std::tuple<Convert<Result, TypeCategory::Integer>,
672 using Operations = std::tuple<Parentheses<Result>,
Negate<Result>,
679 common::TupleToVariant<common::CombineTuples<Operations, Conversions, Others>>
684class Expr<
Type<TypeCategory::Real>>
689 EVALUATE_UNION_CLASS_BOILERPLATE(Expr)
690 explicit Expr(
int kind,
const Scalar<Result> &x)
696 using Conversions = std::variant<Convert<Result, TypeCategory::Integer>,
699 using Operations = std::variant<ComplexComponent, Parentheses<Result>,
707 common::CombineVariants<Operations, Conversions, Others> u;
711class Expr<
Type<TypeCategory::Complex>>
715 EVALUATE_UNION_CLASS_BOILERPLATE(Expr)
716 explicit Expr(
int kind,
const Scalar<Result> &x)
718 using Operations = std::variant<Parentheses<Result>,
Negate<Result>,
726 common::CombineVariants<Operations, Others> u;
730class Expr<
Type<TypeCategory::Character>>
734 EVALUATE_UNION_CLASS_BOILERPLATE(Expr)
735 explicit Expr(
int kind,
const Scalar<Result> &x)
737 explicit Expr(
int kind, Scalar<Result> &&x)
740 std::optional<Expr<SubscriptInteger>> LEN()
const;
757class Relational :
public Operation<Relational<T>, LogicalResult, T, T> {
759 using Result = LogicalResult;
760 using Base = Operation<Relational, LogicalResult, T, T>;
761 using Operand =
typename Base::template Operand<0>;
762 static_assert(Operand::category == TypeCategory::Integer ||
763 Operand::category == TypeCategory::Real ||
764 Operand::category == TypeCategory::Complex ||
765 Operand::category == TypeCategory::Character ||
766 Operand::category == TypeCategory::Unsigned);
767 CLASS_BOILERPLATE(Relational)
770 : Base{LogicalResultKind, a, b}, opr{r} {
771 CHECK(a.kind() == b.kind());
774 : Base{LogicalResultKind, std::move(a), std::move(b)}, opr{r} {
775 CHECK(this->left().kind() == this->right().kind());
777 static constexpr std::optional<DynamicType> GetType() {
778 return DynamicType{TypeCategory::Logical, LogicalResultKind};
780 bool operator==(
const Relational &)
const;
781 RelationalOperator opr;
785 using DirectlyComparableTypes = common::CombineTuples<IntegerTypes, RealTypes,
786 ComplexTypes, CharacterTypes, UnsignedTypes>;
789 using Result = LogicalResult;
790 EVALUATE_UNION_CLASS_BOILERPLATE(Relational)
792 return common::visit([](
const auto &x) {
return x.kind(); }, u);
795 return {TypeCategory::Logical, LogicalResultKind};
798 return common::visit([](
const auto &x) {
return x.Rank(); }, u);
800 static constexpr int Corank() {
return 0; }
801 llvm::raw_ostream &AsFortran(llvm::raw_ostream &o)
const;
802 common::MapTemplate<Relational, DirectlyComparableTypes> u;
814class Expr<
Type<TypeCategory::Logical>>
818 EVALUATE_UNION_CLASS_BOILERPLATE(Expr)
820 explicit Expr(
const Scalar<Result> &x) : u{
Constant<Result>{x.kind(), x}} {}
821 explicit Expr(
int kind,
const Scalar<Result> &x)
823 explicit Expr(
int kind,
bool x)
829 using Relations = std::tuple<Relational<SomeType>>;
834 common::TupleToVariant<common::CombineTuples<Operations, Relations, Others>>
853class StructureConstructor {
857 static constexpr int kind() {
return 0; }
861 StructureConstructor(
863 StructureConstructor(
865 CLASS_BOILERPLATE(StructureConstructor)
867 constexpr Result result()
const {
return result_; }
869 return result_.derivedTypeSpec();
871 StructureConstructorValues &values() {
return values_; }
872 const StructureConstructorValues &values()
const {
return values_; }
874 bool operator==(
const StructureConstructor &)
const;
876 StructureConstructorValues::iterator begin() {
return values_.begin(); }
877 StructureConstructorValues::const_iterator begin()
const {
878 return values_.begin();
880 StructureConstructorValues::iterator end() {
return values_.end(); }
881 StructureConstructorValues::const_iterator end()
const {
882 return values_.end();
886 std::optional<Expr<SomeType>> Find(
const Symbol &)
const;
889 static constexpr int Rank() {
return 0; }
890 static constexpr int Corank() {
return 0; }
892 llvm::raw_ostream &AsFortran(llvm::raw_ostream &)
const;
895 std::optional<Expr<SomeType>> CreateParentComponent(
const Symbol &)
const;
897 StructureConstructorValues values_;
906 EVALUATE_UNION_CLASS_BOILERPLATE(
Expr)
914using CategoryExpression = common::MapTemplate<Expr, SomeCategory>;
920using BOZLiteralConstant =
typename LargestReal::Scalar::Word;
921inline constexpr int BOZLiteralConstantKind = LargestRealKind;
925 static constexpr int kind() {
return 0; }
927 constexpr bool operator==(
const NullPointer &)
const {
return true; }
928 static constexpr int Rank() {
return 0; }
929 static constexpr int Corank() {
return 0; }
935using TypelessExpression = std::variant<BOZLiteralConstant,
NullPointer,
944 static constexpr int kind() {
return 0; }
946 EVALUATE_UNION_CLASS_BOILERPLATE(Expr)
953 common::CombineVariants<TypelessExpression, CategoryExpression> u;
963 : lhs(std::move(lhs)), rhs(std::move(rhs)) {}
966 using BoundsSpec = std::vector<Expr<SubscriptInteger>>;
967 using BoundsRemapping =
969 llvm::raw_ostream &AsFortran(llvm::raw_ostream &)
const;
973 std::variant<Intrinsic, ProcedureRef, BoundsSpec, BoundsRemapping> u;
978struct GenericExprWrapper {
979 GenericExprWrapper() {}
984 GenericExprWrapper(GenericExprWrapper &&) =
default;
985 GenericExprWrapper &operator=(GenericExprWrapper &&) =
default;
986 ~GenericExprWrapper();
987 static void Deleter(GenericExprWrapper *);
988 std::optional<Expr<SomeType>> v;
992struct GenericAssignmentWrapper {
993 GenericAssignmentWrapper() {}
994 explicit GenericAssignmentWrapper(
Assignment &&x) : v{std::move(x)} {}
995 explicit GenericAssignmentWrapper(std::optional<Assignment> &&x)
997 GenericAssignmentWrapper(GenericAssignmentWrapper &&) =
default;
998 GenericAssignmentWrapper &operator=(GenericAssignmentWrapper &&) =
default;
999 ~GenericAssignmentWrapper();
1000 static void Deleter(GenericAssignmentWrapper *);
1001 std::optional<Assignment> v;
1009#define INSTANTIATE_EXPRESSION_TEMPLATES \
1010 template class Relational<Type<TypeCategory::Integer>>; \
1011 template class Relational<Type<TypeCategory::Unsigned>>; \
1012 template class Relational<Type<TypeCategory::Real>>; \
1013 template class Relational<Type<TypeCategory::Character>>; \
1014 FOR_EACH_TYPE_AND_KIND(template class ExpressionBase, ) \
1015 FOR_EACH_INTRINSIC_KIND(template class ArrayConstructorValues, ) \
1016 FOR_EACH_INTRINSIC_KIND(template class ArrayConstructor, ) \
1017 FOR_EACH_INTRINSIC_KIND(template class ConditionalExpr, )
1019template <
typename T>
1020inline Expr<T> MakeConstantExpr(
int kind,
const Scalar<T> &v) {
1021 CHECK(kind == v.kind());
1025template <
typename T>
inline Expr<T> MakeConstantExpr(
int kind, Scalar<T> &&v) {
1026 CHECK(kind == v.kind());
1030template <
typename T>
1032 CHECK(kind == c.kind());
1036template <
typename T>
1038 CHECK(kind == c.kind());
1042template <
typename T,
1044 std::enable_if_t<std::is_same_v<T, Type<TypeCategory::Character>>>>
1045inline Expr<T> MakeConstantExpr(
int kind,
const std::string &v) {
1046 return Expr<T>{MakeConstant<T>(kind, v)};
1049template <
typename T,
1050 typename = std::enable_if_t<std::is_same_v<T, Type<TypeCategory::Integer>>>>
1051inline Expr<T> MakeConstantExpr(
int kind, int64_t v) {
1055template <
typename T,
1057 std::enable_if_t<std::is_same_v<T, Type<TypeCategory::Unsigned>>>>
1058inline Expr<T> MakeConstantExpr(
int kind, uint64_t v) {
1062template <
typename T,
1063 typename = std::enable_if_t<std::is_same_v<T, Type<TypeCategory::Logical>>>>
1064inline Expr<T> MakeConstantExpr(
int kind,
bool v) {
1068template <
typename T>
inline Expr<T> MakeZeroExpr(
int kind) {
1069 return MakeConstantExpr<T>(kind, Scalar<T>::Zero(kind));
1077 const Scalar<SubscriptInteger> &v) {
1083 Scalar<SubscriptInteger> &&v) {
1091 return x.kind() == SubscriptIntegerKind;
1093inline bool IsSubscriptIntegerKind(
1095 return !x || IsSubscriptIntegerKind(*x);
1106inline Expr<Ascii> MakeAsciiExpr(
const std::string &v) {
1107 return Expr<Ascii>{MakeConstant<Ascii>(AsciiKind, v)};
1110inline Expr<Ascii> MakeAsciiExpr(std::string &&v) {
1111 return Expr<Ascii>{MakeConstant<Ascii>(AsciiKind, std::move(v))};
Definition expression.h:512
Definition expression.h:540
Definition expression.h:960
Definition expression.h:415
Definition constant.h:181
Definition variable.h:386
Definition expression.h:64
Definition expression.h:478
Definition expression.h:757
Definition expression.h:853
Definition char-block.h:27
Definition expression.h:309
Definition expression.h:506
Definition expression.h:965
Definition expression.h:373
Definition expression.h:387
Definition expression.h:218
Definition expression.h:330
Definition expression.h:354
Definition expression.h:464
Definition expression.h:401
Definition expression.h:323
Definition expression.h:263
Definition expression.h:287
Definition expression.h:924
Definition expression.h:237
Definition expression.h:337
Definition expression.h:346
Definition expression.h:299
Definition expression.h:316