diff --git a/src/CppParser/AST.h b/src/CppParser/AST.h index bdce6f35..9bb1f80d 100644 --- a/src/CppParser/AST.h +++ b/src/CppParser/AST.h @@ -11,6 +11,8 @@ #include "Sources.h" #include "Types.h" #include "Decl.h" +#include "Stmt.h" +#include "Expr.h" #include namespace CppSharp { namespace CppParser { namespace AST { diff --git a/src/CppParser/Expr.cpp b/src/CppParser/Expr.cpp new file mode 100644 index 00000000..1308ea8d --- /dev/null +++ b/src/CppParser/Expr.cpp @@ -0,0 +1,1048 @@ +// ---------------------------------------------------------------------------- +// +// This is autogenerated code by CppSharp. +// Do not edit this file or all your changes will be lost after re-generation. +// +// ---------------------------------------------------------------------------- + + +#include "Sources.h" +#include "Expr.h" + +namespace CppSharp { namespace CppParser { namespace AST { + +Expr::Classification::Classification() +{ +} + +Expr::Expr() + : Stmt(StmtClass::NoStmt) + , type(QualifiedType()) + , valueDependent(0) + , typeDependent(0) + , instantiationDependent(0) + , containsUnexpandedParameterPack(0) + , exprLoc(SourceLocation()) + , isLValue(0) + , isRValue(0) + , isXValue(0) + , isGLValue(0) + , isOrdinaryOrBitFieldObject(0) +{ +} + +Expr::Expr(StmtClass klass) + : Stmt(klass) + , type(QualifiedType()) + , valueDependent(0) + , typeDependent(0) + , instantiationDependent(0) + , containsUnexpandedParameterPack(0) + , exprLoc(SourceLocation()) + , isLValue(0) + , isRValue(0) + , isXValue(0) + , isGLValue(0) + , isOrdinaryOrBitFieldObject(0) +{ +} + +FullExpr::FullExpr() + : Expr(StmtClass::NoStmt) + , subExpr(nullptr) +{ +} + +FullExpr::FullExpr(StmtClass klass) + : Expr(klass) + , subExpr(nullptr) +{ +} + +ConstantExpr::ConstantExpr() + : FullExpr(StmtClass::ConstantExpr) +{ +} + +OpaqueValueExpr::OpaqueValueExpr() + : Expr(StmtClass::OpaqueValueExpr) + , isUnique(0) + , location(SourceLocation()) + , sourceExpr(nullptr) +{ +} + +DeclRefExpr::DeclRefExpr() + : Expr(StmtClass::DeclRefExpr) + , location(SourceLocation()) + , hadMultipleCandidates(0) + , hasQualifier(0) + , hasTemplateKWAndArgsInfo(0) + , templateKeywordLoc(SourceLocation()) + , lAngleLoc(SourceLocation()) + , rAngleLoc(SourceLocation()) + , hasTemplateKeyword(0) + , hasExplicitTemplateArgs(0) + , numTemplateArgs(0) + , refersToEnclosingVariableOrCapture(0) +{ +} + +IntegerLiteral::IntegerLiteral() + : Expr(StmtClass::IntegerLiteral) + , location(SourceLocation()) +{ +} + +FixedPointLiteral::FixedPointLiteral() + : Expr(StmtClass::FixedPointLiteral) + , location(SourceLocation()) +{ +} + +CharacterLiteral::CharacterLiteral() + : Expr(StmtClass::CharacterLiteral) + , location(SourceLocation()) + , kind((CharacterLiteral::CharacterKind::Ascii)) + , value(0) +{ +} + +FloatingLiteral::FloatingLiteral() + : Expr(StmtClass::FloatingLiteral) + , exact(0) + , location(SourceLocation()) + , valueAsApproximateDouble(0) +{ +} + +ImaginaryLiteral::ImaginaryLiteral() + : Expr(StmtClass::ImaginaryLiteral) + , subExpr(nullptr) +{ +} + +StringLiteral::StringLiteral() + : Expr(StmtClass::StringLiteral) + , byteLength(0) + , length(0) + , charByteWidth(0) + , kind((StringLiteral::StringKind::Ascii)) + , isAscii(0) + , isWide(0) + , isUTF8(0) + , isUTF16(0) + , isUTF32(0) + , isPascal(0) + , containsNonAscii(0) + , containsNonAsciiOrNull(0) + , numConcatenated(0) +{ +} + +PredefinedExpr::PredefinedExpr() + : Expr(StmtClass::PredefinedExpr) + , location(SourceLocation()) + , identKind((PredefinedExpr::IdentKind::Func)) +{ +} + +ParenExpr::ParenExpr() + : Expr(StmtClass::ParenExpr) + , subExpr(nullptr) + , lParen(SourceLocation()) + , rParen(SourceLocation()) +{ +} + +UnaryOperator::UnaryOperator() + : Expr(StmtClass::UnaryOperator) + , opcode((UnaryOperatorKind::PostInc)) + , subExpr(nullptr) + , operatorLoc(SourceLocation()) + , canOverflow(0) +{ +} + +OffsetOfExpr::OffsetOfExpr() + : Expr(StmtClass::OffsetOfExpr) + , operatorLoc(SourceLocation()) + , rParenLoc(SourceLocation()) + , numComponents(0) + , numExpressions(0) +{ +} + +UnaryExprOrTypeTraitExpr::UnaryExprOrTypeTraitExpr() + : Expr(StmtClass::UnaryExprOrTypeTraitExpr) + , kind((UnaryExprOrTypeTrait::SizeOf)) + , operatorLoc(SourceLocation()) + , rParenLoc(SourceLocation()) + , isArgumentType(0) + , argumentType(QualifiedType()) + , typeOfArgument(QualifiedType()) +{ +} + +ArraySubscriptExpr::ArraySubscriptExpr() + : Expr(StmtClass::ArraySubscriptExpr) + , lHS(nullptr) + , rHS(nullptr) + , rBracketLoc(SourceLocation()) +{ +} + +CallExpr::CallExpr() + : Expr(StmtClass::CallExpr) + , callee(nullptr) + , rParenLoc(SourceLocation()) + , numArgs(0) + , numCommas(0) + , builtinCallee(0) + , isCallToStdMove(0) +{ +} + +CallExpr::CallExpr(StmtClass klass) + : Expr(klass) + , callee(nullptr) + , rParenLoc(SourceLocation()) + , numArgs(0) + , numCommas(0) + , builtinCallee(0) + , isCallToStdMove(0) +{ +} + +DEF_VECTOR(CallExpr, Expr*, arguments) + +MemberExpr::MemberExpr() + : Expr(StmtClass::MemberExpr) + , base(nullptr) + , arrow(0) + , memberLoc(SourceLocation()) + , hadMultipleCandidates(0) + , hasQualifier(0) + , templateKeywordLoc(SourceLocation()) + , lAngleLoc(SourceLocation()) + , rAngleLoc(SourceLocation()) + , hasTemplateKeyword(0) + , hasExplicitTemplateArgs(0) + , numTemplateArgs(0) + , operatorLoc(SourceLocation()) + , isImplicitAccess(0) +{ +} + +CompoundLiteralExpr::CompoundLiteralExpr() + : Expr(StmtClass::CompoundLiteralExpr) + , initializer(nullptr) + , fileScope(0) + , lParenLoc(SourceLocation()) +{ +} + +CastExpr::CastExpr() + : Expr(StmtClass::NoStmt) + , castKind((CastKind::Dependent)) + , subExpr(nullptr) + , conversionFunction(nullptr) + , path_empty(0) + , path_size(0) +{ +} + +CastExpr::CastExpr(StmtClass klass) + : Expr(klass) + , castKind((CastKind::Dependent)) + , subExpr(nullptr) + , conversionFunction(nullptr) + , path_empty(0) + , path_size(0) +{ +} + +ImplicitCastExpr::ImplicitCastExpr() + : CastExpr(StmtClass::ImplicitCastExpr) + , isPartOfExplicitCast(0) +{ +} + +ExplicitCastExpr::ExplicitCastExpr() + : CastExpr(StmtClass::NoStmt) + , typeAsWritten(QualifiedType()) +{ +} + +ExplicitCastExpr::ExplicitCastExpr(StmtClass klass) + : CastExpr(klass) + , typeAsWritten(QualifiedType()) +{ +} + +CStyleCastExpr::CStyleCastExpr() + : ExplicitCastExpr(StmtClass::CStyleCastExpr) + , lParenLoc(SourceLocation()) + , rParenLoc(SourceLocation()) +{ +} + +BinaryOperator::BinaryOperator() + : Expr(StmtClass::BinaryOperator) + , operatorLoc(SourceLocation()) + , opcode((BinaryOperatorKind::PtrMemD)) + , lHS(nullptr) + , rHS(nullptr) + , isFPContractableWithinStatement(0) + , isFEnvAccessOn(0) +{ +} + +BinaryOperator::BinaryOperator(StmtClass klass) + : Expr(klass) + , operatorLoc(SourceLocation()) + , opcode((BinaryOperatorKind::PtrMemD)) + , lHS(nullptr) + , rHS(nullptr) + , isFPContractableWithinStatement(0) + , isFEnvAccessOn(0) +{ +} + +CompoundAssignOperator::CompoundAssignOperator() + : BinaryOperator(StmtClass::CompoundAssignOperator) + , computationLHSType(QualifiedType()) + , computationResultType(QualifiedType()) +{ +} + +AbstractConditionalOperator::AbstractConditionalOperator() + : Expr(StmtClass::NoStmt) + , cond(nullptr) + , trueExpr(nullptr) + , falseExpr(nullptr) + , questionLoc(SourceLocation()) + , colonLoc(SourceLocation()) +{ +} + +AbstractConditionalOperator::AbstractConditionalOperator(StmtClass klass) + : Expr(klass) + , cond(nullptr) + , trueExpr(nullptr) + , falseExpr(nullptr) + , questionLoc(SourceLocation()) + , colonLoc(SourceLocation()) +{ +} + +ConditionalOperator::ConditionalOperator() + : AbstractConditionalOperator(StmtClass::ConditionalOperator) + , lHS(nullptr) + , rHS(nullptr) +{ +} + +BinaryConditionalOperator::BinaryConditionalOperator() + : AbstractConditionalOperator(StmtClass::BinaryConditionalOperator) + , common(nullptr) + , opaqueValue(nullptr) +{ +} + +AddrLabelExpr::AddrLabelExpr() + : Expr(StmtClass::AddrLabelExpr) + , ampAmpLoc(SourceLocation()) + , labelLoc(SourceLocation()) +{ +} + +StmtExpr::StmtExpr() + : Expr(StmtClass::StmtExpr) + , subStmt(nullptr) + , lParenLoc(SourceLocation()) + , rParenLoc(SourceLocation()) +{ +} + +ShuffleVectorExpr::ShuffleVectorExpr() + : Expr(StmtClass::ShuffleVectorExpr) + , builtinLoc(SourceLocation()) + , rParenLoc(SourceLocation()) + , numSubExprs(0) +{ +} + +ConvertVectorExpr::ConvertVectorExpr() + : Expr(StmtClass::ConvertVectorExpr) + , srcExpr(nullptr) + , builtinLoc(SourceLocation()) + , rParenLoc(SourceLocation()) +{ +} + +ChooseExpr::ChooseExpr() + : Expr(StmtClass::ChooseExpr) + , isConditionTrue(0) + , cond(nullptr) + , lHS(nullptr) + , rHS(nullptr) + , builtinLoc(SourceLocation()) + , rParenLoc(SourceLocation()) + , isConditionDependent(0) + , chosenSubExpr(nullptr) +{ +} + +GNUNullExpr::GNUNullExpr() + : Expr(StmtClass::GNUNullExpr) + , tokenLocation(SourceLocation()) +{ +} + +VAArgExpr::VAArgExpr() + : Expr(StmtClass::VAArgExpr) + , subExpr(nullptr) + , isMicrosoftABI(0) + , builtinLoc(SourceLocation()) + , rParenLoc(SourceLocation()) +{ +} + +InitListExpr::InitListExpr() + : Expr(StmtClass::InitListExpr) + , arrayFiller(nullptr) + , lBraceLoc(SourceLocation()) + , rBraceLoc(SourceLocation()) + , syntacticForm(nullptr) + , numInits(0) + , hasArrayFiller(0) + , isExplicit(0) + , isStringLiteralInit(0) + , isTransparent(0) + , isSemanticForm(0) + , semanticForm(nullptr) + , isSyntacticForm(0) +{ +} + +DesignatedInitExpr::Designator::Designator() +{ +} + +DesignatedInitExpr::FieldDesignator::FieldDesignator() +{ +} + +DesignatedInitExpr::ArrayOrRangeDesignator::ArrayOrRangeDesignator() +{ +} + +DesignatedInitExpr::DesignatedInitExpr() + : Expr(StmtClass::DesignatedInitExpr) + , equalOrColonLoc(SourceLocation()) + , init(nullptr) + , size(0) + , usesGNUSyntax(0) + , numSubExprs(0) + , designatorsSourceRange(SourceRange()) +{ +} + +NoInitExpr::NoInitExpr() + : Expr(StmtClass::NoInitExpr) +{ +} + +DesignatedInitUpdateExpr::DesignatedInitUpdateExpr() + : Expr(StmtClass::DesignatedInitUpdateExpr) + , base(nullptr) + , updater(nullptr) +{ +} + +ArrayInitLoopExpr::ArrayInitLoopExpr() + : Expr(StmtClass::ArrayInitLoopExpr) + , commonExpr(nullptr) + , subExpr(nullptr) +{ +} + +ArrayInitIndexExpr::ArrayInitIndexExpr() + : Expr(StmtClass::ArrayInitIndexExpr) +{ +} + +ImplicitValueInitExpr::ImplicitValueInitExpr() + : Expr(StmtClass::ImplicitValueInitExpr) +{ +} + +ParenListExpr::ParenListExpr() + : Expr(StmtClass::ParenListExpr) + , numExprs(0) + , lParenLoc(SourceLocation()) + , rParenLoc(SourceLocation()) +{ +} + +GenericSelectionExpr::GenericSelectionExpr() + : Expr(StmtClass::GenericSelectionExpr) + , numAssocs(0) + , genericLoc(SourceLocation()) + , defaultLoc(SourceLocation()) + , rParenLoc(SourceLocation()) + , isResultDependent(0) + , resultIndex(0) +{ +} + +ExtVectorElementExpr::ExtVectorElementExpr() + : Expr(StmtClass::ExtVectorElementExpr) + , base(nullptr) + , accessorLoc(SourceLocation()) + , numElements(0) + , containsDuplicateElements(0) + , isArrow(0) +{ +} + +BlockExpr::BlockExpr() + : Expr(StmtClass::BlockExpr) + , caretLocation(SourceLocation()) +{ +} + +AsTypeExpr::AsTypeExpr() + : Expr(StmtClass::AsTypeExpr) + , srcExpr(nullptr) + , builtinLoc(SourceLocation()) + , rParenLoc(SourceLocation()) +{ +} + +PseudoObjectExpr::PseudoObjectExpr() + : Expr(StmtClass::PseudoObjectExpr) + , resultExprIndex(0) + , numSemanticExprs(0) +{ +} + +AtomicExpr::AtomicExpr() + : Expr(StmtClass::AtomicExpr) + , ptr(nullptr) + , order(nullptr) + , scope(nullptr) + , val1(nullptr) + , orderFail(nullptr) + , val2(nullptr) + , weak(nullptr) + , valueType(QualifiedType()) + , op((AtomicExpr::AtomicOp::C11AtomicInit)) + , isVolatile(0) + , isCmpXChg(0) + , isOpenCL(0) + , builtinLoc(SourceLocation()) + , rParenLoc(SourceLocation()) +{ +} + +TypoExpr::TypoExpr() + : Expr(StmtClass::TypoExpr) +{ +} + +CXXOperatorCallExpr::CXXOperatorCallExpr() + : CallExpr(StmtClass::CXXOperatorCallExpr) + , _operator((OverloadedOperatorKind::None)) + , isInfixBinaryOp(0) + , operatorLoc(SourceLocation()) + , isFPContractableWithinStatement(0) +{ +} + +CXXMemberCallExpr::CXXMemberCallExpr() + : CallExpr(StmtClass::CXXMemberCallExpr) + , implicitObjectArgument(nullptr) + , methodDecl(nullptr) +{ +} + +CUDAKernelCallExpr::CUDAKernelCallExpr() + : CallExpr(StmtClass::CUDAKernelCallExpr) + , config(nullptr) +{ +} + +CXXNamedCastExpr::CXXNamedCastExpr() + : ExplicitCastExpr(StmtClass::NoStmt) + , castName(nullptr) + , operatorLoc(SourceLocation()) + , rParenLoc(SourceLocation()) + , angleBrackets(SourceRange()) +{ +} + +CXXNamedCastExpr::CXXNamedCastExpr(StmtClass klass) + : ExplicitCastExpr(klass) + , castName(nullptr) + , operatorLoc(SourceLocation()) + , rParenLoc(SourceLocation()) + , angleBrackets(SourceRange()) +{ +} + +CXXStaticCastExpr::CXXStaticCastExpr() + : CXXNamedCastExpr(StmtClass::CXXStaticCastExpr) +{ +} + +CXXDynamicCastExpr::CXXDynamicCastExpr() + : CXXNamedCastExpr(StmtClass::CXXDynamicCastExpr) + , isAlwaysNull(0) +{ +} + +CXXReinterpretCastExpr::CXXReinterpretCastExpr() + : CXXNamedCastExpr(StmtClass::CXXReinterpretCastExpr) +{ +} + +CXXConstCastExpr::CXXConstCastExpr() + : CXXNamedCastExpr(StmtClass::CXXConstCastExpr) +{ +} + +UserDefinedLiteral::UserDefinedLiteral() + : CallExpr(StmtClass::UserDefinedLiteral) + , literalOperatorKind((UserDefinedLiteral::LiteralOperatorKind::Raw)) + , uDSuffixLoc(SourceLocation()) +{ +} + +CXXBoolLiteralExpr::CXXBoolLiteralExpr() + : Expr(StmtClass::CXXBoolLiteralExpr) + , value(0) + , location(SourceLocation()) +{ +} + +CXXNullPtrLiteralExpr::CXXNullPtrLiteralExpr() + : Expr(StmtClass::CXXNullPtrLiteralExpr) + , location(SourceLocation()) +{ +} + +CXXStdInitializerListExpr::CXXStdInitializerListExpr() + : Expr(StmtClass::CXXStdInitializerListExpr) +{ +} + +CXXTypeidExpr::CXXTypeidExpr() + : Expr(StmtClass::CXXTypeidExpr) + , exprOperand(nullptr) + , isPotentiallyEvaluated(0) + , isTypeOperand(0) +{ +} + +MSPropertyRefExpr::MSPropertyRefExpr() + : Expr(StmtClass::MSPropertyRefExpr) + , isImplicitAccess(0) + , baseExpr(nullptr) + , isArrow(0) + , memberLoc(SourceLocation()) +{ +} + +MSPropertySubscriptExpr::MSPropertySubscriptExpr() + : Expr(StmtClass::MSPropertySubscriptExpr) + , rBracketLoc(SourceLocation()) +{ +} + +CXXUuidofExpr::CXXUuidofExpr() + : Expr(StmtClass::CXXUuidofExpr) + , exprOperand(nullptr) + , isTypeOperand(0) +{ +} + +CXXThisExpr::CXXThisExpr() + : Expr(StmtClass::CXXThisExpr) + , location(SourceLocation()) + , implicit(0) +{ +} + +CXXThrowExpr::CXXThrowExpr() + : Expr(StmtClass::CXXThrowExpr) + , throwLoc(SourceLocation()) + , isThrownVariableInScope(0) +{ +} + +CXXDefaultArgExpr::CXXDefaultArgExpr() + : Expr(StmtClass::CXXDefaultArgExpr) + , usedLocation(SourceLocation()) +{ +} + +CXXDefaultInitExpr::CXXDefaultInitExpr() + : Expr(StmtClass::CXXDefaultInitExpr) +{ +} + +CXXBindTemporaryExpr::CXXBindTemporaryExpr() + : Expr(StmtClass::CXXBindTemporaryExpr) + , subExpr(nullptr) +{ +} + +CXXConstructExpr::CXXConstructExpr() + : Expr(StmtClass::CXXConstructExpr) + , location(SourceLocation()) + , elidable(0) + , hadMultipleCandidates(0) + , listInitialization(0) + , stdInitListInitialization(0) + , requiresZeroInitialization(0) + , parenOrBraceRange(SourceRange()) + , numArgs(0) +{ +} + +CXXConstructExpr::CXXConstructExpr(StmtClass klass) + : Expr(klass) + , location(SourceLocation()) + , elidable(0) + , hadMultipleCandidates(0) + , listInitialization(0) + , stdInitListInitialization(0) + , requiresZeroInitialization(0) + , parenOrBraceRange(SourceRange()) + , numArgs(0) +{ +} + +DEF_VECTOR(CXXConstructExpr, Expr*, arguments) + +CXXInheritedCtorInitExpr::CXXInheritedCtorInitExpr() + : Expr(StmtClass::CXXInheritedCtorInitExpr) + , constructsVBase(0) + , inheritedFromVBase(0) + , location(SourceLocation()) +{ +} + +CXXFunctionalCastExpr::CXXFunctionalCastExpr() + : ExplicitCastExpr(StmtClass::CXXFunctionalCastExpr) + , lParenLoc(SourceLocation()) + , rParenLoc(SourceLocation()) + , isListInitialization(0) +{ +} + +CXXTemporaryObjectExpr::CXXTemporaryObjectExpr() + : CXXConstructExpr(StmtClass::CXXTemporaryObjectExpr) +{ +} + +LambdaExpr::LambdaExpr() + : Expr(StmtClass::LambdaExpr) + , captureDefaultLoc(SourceLocation()) + , capture_size(0) + , introducerRange(SourceRange()) + , callOperator(nullptr) + , isGenericLambda(0) + , body(nullptr) + , isMutable(0) + , hasExplicitParameters(0) + , hasExplicitResultType(0) +{ +} + +DEF_VECTOR(LambdaExpr, Expr*, capture_inits) + +CXXScalarValueInitExpr::CXXScalarValueInitExpr() + : Expr(StmtClass::CXXScalarValueInitExpr) + , rParenLoc(SourceLocation()) +{ +} + +CXXNewExpr::CXXNewExpr() + : Expr(StmtClass::CXXNewExpr) + , operatorNew(nullptr) + , operatorDelete(nullptr) + , allocatedType(QualifiedType()) + , isArray(0) + , numPlacementArgs(0) + , isParenTypeId(0) + , typeIdParens(SourceRange()) + , isGlobalNew(0) + , hasInitializer(0) + , initializationStyle((CXXNewExpr::InitializationStyle::NoInit)) + , constructExpr(nullptr) + , directInitRange(SourceRange()) +{ +} + +DEF_VECTOR(CXXNewExpr, Expr*, placement_arguments) + +CXXDeleteExpr::CXXDeleteExpr() + : Expr(StmtClass::CXXDeleteExpr) + , isGlobalDelete(0) + , isArrayForm(0) + , isArrayFormAsWritten(0) + , operatorDelete(nullptr) + , destroyedType(QualifiedType()) +{ +} + +CXXPseudoDestructorExpr::CXXPseudoDestructorExpr() + : Expr(StmtClass::CXXPseudoDestructorExpr) + , base(nullptr) + , hasQualifier(0) + , isArrow(0) + , operatorLoc(SourceLocation()) + , colonColonLoc(SourceLocation()) + , tildeLoc(SourceLocation()) + , destroyedType(QualifiedType()) + , destroyedTypeLoc(SourceLocation()) +{ +} + +TypeTraitExpr::TypeTraitExpr() + : Expr(StmtClass::TypeTraitExpr) + , value(0) + , numArgs(0) +{ +} + +ArrayTypeTraitExpr::ArrayTypeTraitExpr() + : Expr(StmtClass::ArrayTypeTraitExpr) + , queriedType(QualifiedType()) + , value(0) + , dimensionExpression(nullptr) +{ +} + +ExpressionTraitExpr::ExpressionTraitExpr() + : Expr(StmtClass::ExpressionTraitExpr) + , queriedExpression(nullptr) + , value(0) +{ +} + +OverloadExpr::FindResult::FindResult() +{ +} + +OverloadExpr::OverloadExpr() + : Expr(StmtClass::NoStmt) + , numDecls(0) + , nameLoc(SourceLocation()) + , templateKeywordLoc(SourceLocation()) + , lAngleLoc(SourceLocation()) + , rAngleLoc(SourceLocation()) + , hasTemplateKeyword(0) + , hasExplicitTemplateArgs(0) + , numTemplateArgs(0) +{ +} + +OverloadExpr::OverloadExpr(StmtClass klass) + : Expr(klass) + , numDecls(0) + , nameLoc(SourceLocation()) + , templateKeywordLoc(SourceLocation()) + , lAngleLoc(SourceLocation()) + , rAngleLoc(SourceLocation()) + , hasTemplateKeyword(0) + , hasExplicitTemplateArgs(0) + , numTemplateArgs(0) +{ +} + +UnresolvedLookupExpr::UnresolvedLookupExpr() + : OverloadExpr(StmtClass::UnresolvedLookupExpr) + , requiresADL(0) + , isOverloaded(0) +{ +} + +DependentScopeDeclRefExpr::DependentScopeDeclRefExpr() + : Expr(StmtClass::DependentScopeDeclRefExpr) + , location(SourceLocation()) + , templateKeywordLoc(SourceLocation()) + , lAngleLoc(SourceLocation()) + , rAngleLoc(SourceLocation()) + , hasTemplateKeyword(0) + , hasExplicitTemplateArgs(0) + , numTemplateArgs(0) +{ +} + +ExprWithCleanups::ExprWithCleanups() + : FullExpr(StmtClass::ExprWithCleanups) + , numObjects(0) + , cleanupsHaveSideEffects(0) +{ +} + +CXXUnresolvedConstructExpr::CXXUnresolvedConstructExpr() + : Expr(StmtClass::CXXUnresolvedConstructExpr) + , lParenLoc(SourceLocation()) + , rParenLoc(SourceLocation()) + , typeAsWritten(QualifiedType()) + , isListInitialization(0) + , arg_size(0) +{ +} + +DEF_VECTOR(CXXUnresolvedConstructExpr, Expr*, arguments) + +CXXDependentScopeMemberExpr::CXXDependentScopeMemberExpr() + : Expr(StmtClass::CXXDependentScopeMemberExpr) + , isImplicitAccess(0) + , base(nullptr) + , baseType(QualifiedType()) + , isArrow(0) + , operatorLoc(SourceLocation()) + , firstQualifierFoundInScope(nullptr) + , memberLoc(SourceLocation()) + , templateKeywordLoc(SourceLocation()) + , lAngleLoc(SourceLocation()) + , rAngleLoc(SourceLocation()) + , hasTemplateKeyword(0) + , hasExplicitTemplateArgs(0) + , numTemplateArgs(0) +{ +} + +UnresolvedMemberExpr::UnresolvedMemberExpr() + : OverloadExpr(StmtClass::UnresolvedMemberExpr) + , isImplicitAccess(0) + , baseType(QualifiedType()) + , hasUnresolvedUsing(0) + , isArrow(0) + , operatorLoc(SourceLocation()) + , memberLoc(SourceLocation()) +{ +} + +CXXNoexceptExpr::CXXNoexceptExpr() + : Expr(StmtClass::CXXNoexceptExpr) + , operand(nullptr) + , value(0) +{ +} + +PackExpansionExpr::PackExpansionExpr() + : Expr(StmtClass::PackExpansionExpr) + , ellipsisLoc(SourceLocation()) +{ +} + +SizeOfPackExpr::SizeOfPackExpr() + : Expr(StmtClass::SizeOfPackExpr) + , operatorLoc(SourceLocation()) + , packLoc(SourceLocation()) + , rParenLoc(SourceLocation()) + , pack(nullptr) + , packLength(0) + , isPartiallySubstituted(0) +{ +} + +SubstNonTypeTemplateParmExpr::SubstNonTypeTemplateParmExpr() + : Expr(StmtClass::SubstNonTypeTemplateParmExpr) + , nameLoc(SourceLocation()) + , replacement(nullptr) +{ +} + +SubstNonTypeTemplateParmPackExpr::SubstNonTypeTemplateParmPackExpr() + : Expr(StmtClass::SubstNonTypeTemplateParmPackExpr) + , parameterPackLocation(SourceLocation()) + , argumentPack(TemplateArgument()) +{ +} + +FunctionParmPackExpr::FunctionParmPackExpr() + : Expr(StmtClass::FunctionParmPackExpr) + , parameterPackLocation(SourceLocation()) + , numExpansions(0) +{ +} + +MaterializeTemporaryExpr::ExtraState::ExtraState() +{ +} + +MaterializeTemporaryExpr::MaterializeTemporaryExpr() + : Expr(StmtClass::MaterializeTemporaryExpr) + , temporary(nullptr) + , TemporaryExpr(nullptr) + , manglingNumber(0) + , isBoundToLvalueReference(0) +{ +} + +CXXFoldExpr::CXXFoldExpr() + : Expr(StmtClass::CXXFoldExpr) + , lHS(nullptr) + , rHS(nullptr) + , isRightFold(0) + , isLeftFold(0) + , pattern(nullptr) + , init(nullptr) + , ellipsisLoc(SourceLocation()) + , _operator((BinaryOperatorKind::PtrMemD)) +{ +} + +CoroutineSuspendExpr::CoroutineSuspendExpr() + : Expr(StmtClass::NoStmt) + , keywordLoc(SourceLocation()) + , commonExpr(nullptr) + , opaqueValue(nullptr) + , readyExpr(nullptr) + , suspendExpr(nullptr) + , resumeExpr(nullptr) +{ +} + +CoroutineSuspendExpr::CoroutineSuspendExpr(StmtClass klass) + : Expr(klass) + , keywordLoc(SourceLocation()) + , commonExpr(nullptr) + , opaqueValue(nullptr) + , readyExpr(nullptr) + , suspendExpr(nullptr) + , resumeExpr(nullptr) +{ +} + +CoawaitExpr::CoawaitExpr() + : CoroutineSuspendExpr(StmtClass::CoawaitExpr) + , isImplicit(0) + , operand(nullptr) +{ +} + +DependentCoawaitExpr::DependentCoawaitExpr() + : Expr(StmtClass::DependentCoawaitExpr) + , operand(nullptr) + , operatorCoawaitLookup(nullptr) + , keywordLoc(SourceLocation()) +{ +} + +CoyieldExpr::CoyieldExpr() + : CoroutineSuspendExpr(StmtClass::CoyieldExpr) + , operand(nullptr) +{ +} + +} } } diff --git a/src/CppParser/Expr.h b/src/CppParser/Expr.h index d3bdd334..6d3d488d 100644 --- a/src/CppParser/Expr.h +++ b/src/CppParser/Expr.h @@ -7,52 +7,246 @@ #pragma once +#include "Sources.h" +#include "Types.h" #include "Stmt.h" namespace CppSharp { namespace CppParser { namespace AST { -class Expr : public Stmt +class Expr; +class Declaration; +class Field; +class Method; +class Function; + +enum class CastKind +{ + Dependent = 0, + BitCast = 1, + LValueBitCast = 2, + LValueToRValue = 3, + NoOp = 4, + BaseToDerived = 5, + DerivedToBase = 6, + UncheckedDerivedToBase = 7, + Dynamic = 8, + ToUnion = 9, + ArrayToPointerDecay = 10, + FunctionToPointerDecay = 11, + NullToPointer = 12, + NullToMemberPointer = 13, + BaseToDerivedMemberPointer = 14, + DerivedToBaseMemberPointer = 15, + MemberPointerToBoolean = 16, + ReinterpretMemberPointer = 17, + UserDefinedConversion = 18, + ConstructorConversion = 19, + IntegralToPointer = 20, + PointerToIntegral = 21, + PointerToBoolean = 22, + ToVoid = 23, + VectorSplat = 24, + IntegralCast = 25, + IntegralToBoolean = 26, + IntegralToFloating = 27, + FixedPointCast = 28, + FixedPointToBoolean = 29, + FloatingToIntegral = 30, + FloatingToBoolean = 31, + BooleanToSignedIntegral = 32, + FloatingCast = 33, + CPointerToObjCPointerCast = 34, + BlockPointerToObjCPointerCast = 35, + AnyPointerToBlockPointerCast = 36, + ObjCObjectLValueCast = 37, + FloatingRealToComplex = 38, + FloatingComplexToReal = 39, + FloatingComplexToBoolean = 40, + FloatingComplexCast = 41, + FloatingComplexToIntegralComplex = 42, + IntegralRealToComplex = 43, + IntegralComplexToReal = 44, + IntegralComplexToBoolean = 45, + IntegralComplexCast = 46, + IntegralComplexToFloatingComplex = 47, + ARCProduceObject = 48, + ARCConsumeObject = 49, + ARCReclaimReturnedObject = 50, + ARCExtendBlockObject = 51, + AtomicToNonAtomic = 52, + NonAtomicToAtomic = 53, + CopyAndAutoreleaseBlockObject = 54, + BuiltinFnToFnPtr = 55, + ZeroToOCLOpaqueType = 56, + AddressSpaceConversion = 57, + IntToOCLSampler = 58 +}; + +enum class BinaryOperatorKind +{ + PtrMemD = 0, + PtrMemI = 1, + Mul = 2, + Div = 3, + Rem = 4, + Add = 5, + Sub = 6, + Shl = 7, + Shr = 8, + Cmp = 9, + LT = 10, + GT = 11, + LE = 12, + GE = 13, + EQ = 14, + NE = 15, + And = 16, + Xor = 17, + Or = 18, + LAnd = 19, + LOr = 20, + Assign = 21, + MulAssign = 22, + DivAssign = 23, + RemAssign = 24, + AddAssign = 25, + SubAssign = 26, + ShlAssign = 27, + ShrAssign = 28, + AndAssign = 29, + XorAssign = 30, + OrAssign = 31, + Comma = 32 +}; + +enum class UnaryOperatorKind +{ + PostInc = 0, + PostDec = 1, + PreInc = 2, + PreDec = 3, + AddrOf = 4, + Deref = 5, + Plus = 6, + Minus = 7, + Not = 8, + LNot = 9, + Real = 10, + Imag = 11, + Extension = 12, + Coawait = 13 +}; + +enum class ObjCBridgeCastKind +{ + Bridge = 0, + BridgeTransfer = 1, + BridgeRetained = 2 +}; + +enum class OverloadedOperatorKind { + None = 0, + New = 1, + Delete = 2, + ArrayNew = 3, + ArrayDelete = 4, + Plus = 5, + Minus = 6, + Star = 7, + Slash = 8, + Percent = 9, + Caret = 10, + Amp = 11, + Pipe = 12, + Tilde = 13, + Exclaim = 14, + Equal = 15, + Less = 16, + Greater = 17, + PlusEqual = 18, + MinusEqual = 19, + StarEqual = 20, + SlashEqual = 21, + PercentEqual = 22, + CaretEqual = 23, + AmpEqual = 24, + PipeEqual = 25, + LessLess = 26, + GreaterGreater = 27, + LessLessEqual = 28, + GreaterGreaterEqual = 29, + EqualEqual = 30, + ExclaimEqual = 31, + LessEqual = 32, + GreaterEqual = 33, + Spaceship = 34, + AmpAmp = 35, + PipePipe = 36, + PlusPlus = 37, + MinusMinus = 38, + Comma = 39, + ArrowStar = 40, + Arrow = 41, + Call = 42, + Subscript = 43, + Conditional = 44, + Coawait = 45, + +}; + +enum class UnaryExprOrTypeTrait +{ + SizeOf = 0, + AlignOf = 1, + VecStep = 2, + OpenMPRequiredSimdAlign = 3, + PreferredAlignOf = 4 +}; + +class CS_API Expr : public Stmt +{ +public: enum class LValueClassification { - LV_Valid = 0, - LV_NotObjectType = 1, - LV_IncompleteVoidType = 2, - LV_DuplicateVectorComponents = 3, - LV_InvalidExpression = 4, - LV_InvalidMessageExpression = 5, - LV_MemberFunction = 6, - LV_SubObjCPropertySetting = 7, - LV_ClassTemporary = 8, - LV_ArrayTemporary = 9 + Valid = 0, + NotObjectType = 1, + IncompleteVoidType = 2, + DuplicateVectorComponents = 3, + InvalidExpression = 4, + InvalidMessageExpression = 5, + MemberFunction = 6, + SubObjCPropertySetting = 7, + ClassTemporary = 8, + ArrayTemporary = 9 }; enum class isModifiableLvalueResult { - MLV_Valid = 0, - MLV_NotObjectType = 1, - MLV_IncompleteVoidType = 2, - MLV_DuplicateVectorComponents = 3, - MLV_InvalidExpression = 4, - MLV_LValueCast = 5, - MLV_IncompleteType = 6, - MLV_ConstQualified = 7, - MLV_ConstQualifiedField = 8, - MLV_ConstAddrSpace = 9, - MLV_ArrayType = 10, - MLV_NoSetterProperty = 11, - MLV_MemberFunction = 12, - MLV_SubObjCPropertySetting = 13, - MLV_InvalidMessageExpression = 14, - MLV_ClassTemporary = 15, - MLV_ArrayTemporary = 16 + Valid = 0, + NotObjectType = 1, + IncompleteVoidType = 2, + DuplicateVectorComponents = 3, + InvalidExpression = 4, + LValueCast = 5, + IncompleteType = 6, + ConstQualified = 7, + ConstQualifiedField = 8, + ConstAddrSpace = 9, + ArrayType = 10, + NoSetterProperty = 11, + MemberFunction = 12, + SubObjCPropertySetting = 13, + InvalidMessageExpression = 14, + ClassTemporary = 15, + ArrayTemporary = 16 }; enum class SideEffectsKind { - SE_NoSideEffects = 0, - SE_AllowUndefinedBehavior = 1, - SE_AllowSideEffects = 2 + NoSideEffects = 0, + AllowUndefinedBehavior = 1, + AllowSideEffects = 2 }; enum class ConstExprUsage @@ -63,89 +257,137 @@ class Expr : public Stmt enum class NullPointerConstantKind { - NPCK_NotNull = 0, - NPCK_ZeroExpression = 1, - NPCK_ZeroLiteral = 2, - NPCK_CXX11_nullptr = 3, - NPCK_GNUNull = 4 + NotNull = 0, + ZeroExpression = 1, + ZeroLiteral = 2, + CXX11_nullptr = 3, + GNUNull = 4 }; enum class NullPointerConstantValueDependence { - NPC_NeverValueDependent = 0, - NPC_ValueDependentIsNull = 1, - NPC_ValueDependentIsNotNull = 2 + NeverValueDependent = 0, + ValueDependentIsNull = 1, + ValueDependentIsNotNull = 2 }; - class Classification + class CS_API Classification { + public: enum class Kinds { - CL_LValue = 0, - CL_XValue = 1, - CL_Function = 2, - CL_Void = 3, - CL_AddressableVoid = 4, - CL_DuplicateVectorComponents = 5, - CL_MemberFunction = 6, - CL_SubObjCPropertySetting = 7, - CL_ClassTemporary = 8, - CL_ArrayTemporary = 9, - CL_ObjCMessageRValue = 10, - CL_PRValue = 11 + LValue = 0, + XValue = 1, + Function = 2, + Void = 3, + AddressableVoid = 4, + DuplicateVectorComponents = 5, + MemberFunction = 6, + SubObjCPropertySetting = 7, + ClassTemporary = 8, + ArrayTemporary = 9, + ObjCMessageRValue = 10, + PRValue = 11 }; enum class ModifiableType { - CM_Untested = 0, - CM_Modifiable = 1, - CM_RValue = 2, - CM_Function = 3, - CM_LValueCast = 4, - CM_NoSetterProperty = 5, - CM_ConstQualified = 6, - CM_ConstQualifiedField = 7, - CM_ConstAddrSpace = 8, - CM_ArrayType = 9, - CM_IncompleteType = 10 + Untested = 0, + Modifiable = 1, + RValue = 2, + Function = 3, + LValueCast = 4, + NoSetterProperty = 5, + ConstQualified = 6, + ConstQualifiedField = 7, + ConstAddrSpace = 8, + ArrayType = 9, + IncompleteType = 10 }; - }; - class EvalStatus - { + Classification(); + Kinds kind; + ModifiableType modifiable; + bool isLValue; + bool isXValue; + bool isGLValue; + bool isPRValue; + bool isRValue; + bool isModifiable; }; - class EvalResult : public EvalStatus - { - }; + Expr(); + Expr(StmtClass klass); + QualifiedType type; + bool valueDependent; + bool typeDependent; + bool instantiationDependent; + bool containsUnexpandedParameterPack; + SourceLocation exprLoc; + bool isLValue; + bool isRValue; + bool isXValue; + bool isGLValue; + bool isOrdinaryOrBitFieldObject; }; -class FullExpr : public Expr +class CS_API FullExpr : public Expr { +public: + FullExpr(); + FullExpr(StmtClass klass); + Expr* subExpr; }; -class ConstantExpr : public FullExpr +class CS_API ConstantExpr : public FullExpr { +public: + ConstantExpr(); }; -class OpaqueValueExpr : public Expr +class CS_API OpaqueValueExpr : public Expr { +public: + OpaqueValueExpr(); + bool isUnique; + SourceLocation location; + Expr* sourceExpr; }; -class DeclRefExpr : public Expr +class CS_API DeclRefExpr : public Expr { +public: + DeclRefExpr(); + SourceLocation location; + bool hadMultipleCandidates; + bool hasQualifier; + bool hasTemplateKWAndArgsInfo; + SourceLocation templateKeywordLoc; + SourceLocation lAngleLoc; + SourceLocation rAngleLoc; + bool hasTemplateKeyword; + bool hasExplicitTemplateArgs; + unsigned int numTemplateArgs; + bool refersToEnclosingVariableOrCapture; }; -class IntegerLiteral : public Expr +class CS_API IntegerLiteral : public Expr { +public: + IntegerLiteral(); + SourceLocation location; }; -class FixedPointLiteral : public Expr +class CS_API FixedPointLiteral : public Expr { +public: + FixedPointLiteral(); + SourceLocation location; }; -class CharacterLiteral : public Expr +class CS_API CharacterLiteral : public Expr { +public: enum class CharacterKind { Ascii = 0, @@ -154,18 +396,32 @@ class CharacterLiteral : public Expr UTF16 = 3, UTF32 = 4 }; + + CharacterLiteral(); + SourceLocation location; + CharacterKind kind; + unsigned int value; }; -class FloatingLiteral : public Expr +class CS_API FloatingLiteral : public Expr { +public: + FloatingLiteral(); + bool exact; + SourceLocation location; + double valueAsApproximateDouble; }; -class ImaginaryLiteral : public Expr +class CS_API ImaginaryLiteral : public Expr { +public: + ImaginaryLiteral(); + Expr* subExpr; }; -class StringLiteral : public Expr +class CS_API StringLiteral : public Expr { +public: enum class StringKind { Ascii = 0, @@ -175,11 +431,27 @@ class StringLiteral : public Expr UTF32 = 4 }; - typedef const SourceLocation* tokloc_iterator; + StringLiteral(); + std::string string; + std::string bytes; + unsigned int byteLength; + unsigned int length; + unsigned int charByteWidth; + StringKind kind; + bool isAscii; + bool isWide; + bool isUTF8; + bool isUTF16; + bool isUTF32; + bool isPascal; + bool containsNonAscii; + bool containsNonAsciiOrNull; + unsigned int numConcatenated; }; -class PredefinedExpr : public Expr +class CS_API PredefinedExpr : public Expr { +public: enum class IdentKind { Func = 0, @@ -191,251 +463,1021 @@ class PredefinedExpr : public Expr PrettyFunction = 6, PrettyFunctionNoVirtual = 7 }; + + PredefinedExpr(); + SourceLocation location; + IdentKind identKind; }; -class ParenExpr : public Expr +class CS_API ParenExpr : public Expr { +public: + ParenExpr(); + Expr* subExpr; + SourceLocation lParen; + SourceLocation rParen; }; -class UnaryOperator : public Expr +class CS_API UnaryOperator : public Expr { - typedef UnaryOperatorKind Opcode; +public: + UnaryOperator(); + UnaryOperatorKind opcode; + Expr* subExpr; + SourceLocation operatorLoc; + bool canOverflow; }; -class OffsetOfExpr : public Expr +class CS_API OffsetOfExpr : public Expr { +public: + OffsetOfExpr(); + SourceLocation operatorLoc; + SourceLocation rParenLoc; + unsigned int numComponents; + unsigned int numExpressions; }; -class UnaryExprOrTypeTraitExpr : public Expr +class CS_API UnaryExprOrTypeTraitExpr : public Expr { +public: + UnaryExprOrTypeTraitExpr(); + UnaryExprOrTypeTrait kind; + SourceLocation operatorLoc; + SourceLocation rParenLoc; + bool isArgumentType; + QualifiedType argumentType; + QualifiedType typeOfArgument; }; -class ArraySubscriptExpr : public Expr +class CS_API ArraySubscriptExpr : public Expr { +public: + ArraySubscriptExpr(); + Expr* lHS; + Expr* rHS; + SourceLocation rBracketLoc; }; -class CallExpr : public Expr +class CS_API CallExpr : public Expr { - typedef ExprIterator arg_iterator; +public: + CallExpr(); + CallExpr(StmtClass klass); + VECTOR(Expr*, arguments) + Expr* callee; + SourceLocation rParenLoc; + unsigned int numArgs; + unsigned int numCommas; + unsigned int builtinCallee; + bool isCallToStdMove; +}; - typedef ConstExprIterator const_arg_iterator; +class CS_API MemberExpr : public Expr +{ +public: + MemberExpr(); + Expr* base; + bool arrow; + SourceLocation memberLoc; + bool hadMultipleCandidates; + bool hasQualifier; + SourceLocation templateKeywordLoc; + SourceLocation lAngleLoc; + SourceLocation rAngleLoc; + bool hasTemplateKeyword; + bool hasExplicitTemplateArgs; + unsigned int numTemplateArgs; + SourceLocation operatorLoc; + bool isImplicitAccess; +}; - typedef iterator_range arg_range; +class CS_API CompoundLiteralExpr : public Expr +{ +public: + CompoundLiteralExpr(); + Expr* initializer; + bool fileScope; + SourceLocation lParenLoc; +}; - typedef iterator_range const_arg_range; +class CS_API CastExpr : public Expr +{ +public: + CastExpr(); + CastExpr(StmtClass klass); + CastKind castKind; + Expr* subExpr; + Declaration* conversionFunction; + bool path_empty; + unsigned int path_size; }; -class MemberExpr : public Expr +class CS_API ImplicitCastExpr : public CastExpr { +public: + enum class OnStack_t + { + OnStack = 0 + }; + + ImplicitCastExpr(); + bool isPartOfExplicitCast; }; -class CompoundLiteralExpr : public Expr +class CS_API ExplicitCastExpr : public CastExpr { +public: + ExplicitCastExpr(); + ExplicitCastExpr(StmtClass klass); + QualifiedType typeAsWritten; }; -class CastExpr : public Expr +class CS_API CStyleCastExpr : public ExplicitCastExpr { - typedef CXXBaseSpecifier** path_iterator; +public: + CStyleCastExpr(); + SourceLocation lParenLoc; + SourceLocation rParenLoc; +}; - typedef const CXXBaseSpecifier* const* path_const_iterator; +class CS_API BinaryOperator : public Expr +{ +public: + BinaryOperator(); + BinaryOperator(StmtClass klass); + SourceLocation operatorLoc; + BinaryOperatorKind opcode; + Expr* lHS; + Expr* rHS; + bool isFPContractableWithinStatement; + bool isFEnvAccessOn; }; -class ImplicitCastExpr : public CastExpr +class CS_API CompoundAssignOperator : public BinaryOperator { - enum class OnStack_t +public: + CompoundAssignOperator(); + QualifiedType computationLHSType; + QualifiedType computationResultType; +}; + +class CS_API AbstractConditionalOperator : public Expr +{ +public: + AbstractConditionalOperator(); + AbstractConditionalOperator(StmtClass klass); + Expr* cond; + Expr* trueExpr; + Expr* falseExpr; + SourceLocation questionLoc; + SourceLocation colonLoc; +}; + +class CS_API ConditionalOperator : public AbstractConditionalOperator +{ +public: + ConditionalOperator(); + Expr* lHS; + Expr* rHS; +}; + +class CS_API BinaryConditionalOperator : public AbstractConditionalOperator +{ +public: + BinaryConditionalOperator(); + Expr* common; + OpaqueValueExpr* opaqueValue; +}; + +class CS_API AddrLabelExpr : public Expr +{ +public: + AddrLabelExpr(); + SourceLocation ampAmpLoc; + SourceLocation labelLoc; +}; + +class CS_API StmtExpr : public Expr +{ +public: + StmtExpr(); + CompoundStmt* subStmt; + SourceLocation lParenLoc; + SourceLocation rParenLoc; +}; + +class CS_API ShuffleVectorExpr : public Expr +{ +public: + ShuffleVectorExpr(); + SourceLocation builtinLoc; + SourceLocation rParenLoc; + unsigned int numSubExprs; +}; + +class CS_API ConvertVectorExpr : public Expr +{ +public: + ConvertVectorExpr(); + Expr* srcExpr; + SourceLocation builtinLoc; + SourceLocation rParenLoc; +}; + +class CS_API ChooseExpr : public Expr +{ +public: + ChooseExpr(); + bool isConditionTrue; + Expr* cond; + Expr* lHS; + Expr* rHS; + SourceLocation builtinLoc; + SourceLocation rParenLoc; + bool isConditionDependent; + Expr* chosenSubExpr; +}; + +class CS_API GNUNullExpr : public Expr +{ +public: + GNUNullExpr(); + SourceLocation tokenLocation; +}; + +class CS_API VAArgExpr : public Expr +{ +public: + VAArgExpr(); + Expr* subExpr; + bool isMicrosoftABI; + SourceLocation builtinLoc; + SourceLocation rParenLoc; +}; + +class CS_API InitListExpr : public Expr +{ +public: + InitListExpr(); + Expr* arrayFiller; + SourceLocation lBraceLoc; + SourceLocation rBraceLoc; + InitListExpr* syntacticForm; + unsigned int numInits; + bool hasArrayFiller; + bool isExplicit; + bool isStringLiteralInit; + bool isTransparent; + bool isSemanticForm; + InitListExpr* semanticForm; + bool isSyntacticForm; +}; + +class CS_API DesignatedInitExpr : public Expr +{ +public: + class CS_API Designator { - OnStack = 0 + public: + Designator(); + Field* field; + bool isFieldDesignator; + bool isArrayDesignator; + bool isArrayRangeDesignator; + SourceLocation dotLoc; + SourceLocation fieldLoc; + SourceLocation lBracketLoc; + SourceLocation rBracketLoc; + SourceLocation ellipsisLoc; + unsigned int firstExprIndex; + SourceRange sourceRange; + }; + + class CS_API FieldDesignator + { + public: + FieldDesignator(); + }; + + class CS_API ArrayOrRangeDesignator + { + public: + ArrayOrRangeDesignator(); }; + + DesignatedInitExpr(); + SourceLocation equalOrColonLoc; + Expr* init; + unsigned int size; + bool usesGNUSyntax; + unsigned int numSubExprs; + SourceRange designatorsSourceRange; }; -class ExplicitCastExpr : public CastExpr +class CS_API NoInitExpr : public Expr { +public: + NoInitExpr(); }; -class CStyleCastExpr : public ExplicitCastExpr +class CS_API DesignatedInitUpdateExpr : public Expr { +public: + DesignatedInitUpdateExpr(); + Expr* base; + InitListExpr* updater; }; -class BinaryOperator : public Expr +class CS_API ArrayInitLoopExpr : public Expr { - typedef BinaryOperatorKind Opcode; +public: + ArrayInitLoopExpr(); + OpaqueValueExpr* commonExpr; + Expr* subExpr; }; -class CompoundAssignOperator : public BinaryOperator +class CS_API ArrayInitIndexExpr : public Expr { +public: + ArrayInitIndexExpr(); }; -class AbstractConditionalOperator : public Expr +class CS_API ImplicitValueInitExpr : public Expr { +public: + ImplicitValueInitExpr(); }; -class ConditionalOperator : public AbstractConditionalOperator +class CS_API ParenListExpr : public Expr { +public: + ParenListExpr(); + unsigned int numExprs; + SourceLocation lParenLoc; + SourceLocation rParenLoc; }; -class BinaryConditionalOperator : public AbstractConditionalOperator +class CS_API GenericSelectionExpr : public Expr { +public: + GenericSelectionExpr(); + unsigned int numAssocs; + SourceLocation genericLoc; + SourceLocation defaultLoc; + SourceLocation rParenLoc; + bool isResultDependent; + unsigned int resultIndex; }; -class AddrLabelExpr : public Expr +class CS_API ExtVectorElementExpr : public Expr { +public: + ExtVectorElementExpr(); + Expr* base; + SourceLocation accessorLoc; + unsigned int numElements; + bool containsDuplicateElements; + bool isArrow; }; -class StmtExpr : public Expr +class CS_API BlockExpr : public Expr { +public: + BlockExpr(); + SourceLocation caretLocation; }; -class ShuffleVectorExpr : public Expr +class CS_API AsTypeExpr : public Expr { +public: + AsTypeExpr(); + Expr* srcExpr; + SourceLocation builtinLoc; + SourceLocation rParenLoc; }; -class ConvertVectorExpr : public Expr +class CS_API PseudoObjectExpr : public Expr { +public: + PseudoObjectExpr(); + unsigned int resultExprIndex; + unsigned int numSemanticExprs; }; -class ChooseExpr : public Expr +class CS_API AtomicExpr : public Expr { +public: + enum class AtomicOp + { + C11AtomicInit = 0, + C11AtomicLoad = 1, + C11AtomicStore = 2, + C11AtomicExchange = 3, + C11AtomicCompareExchangeStrong = 4, + C11AtomicCompareExchangeWeak = 5, + C11AtomicFetchAdd = 6, + C11AtomicFetchSub = 7, + C11AtomicFetchAnd = 8, + C11AtomicFetchOr = 9, + C11AtomicFetchXor = 10, + AtomicLoad = 11, + AtomicLoadN = 12, + AtomicStore = 13, + AtomicStoreN = 14, + AtomicExchange = 15, + AtomicExchangeN = 16, + AtomicCompareExchange = 17, + AtomicCompareExchangeN = 18, + AtomicFetchAdd = 19, + AtomicFetchSub = 20, + AtomicFetchAnd = 21, + AtomicFetchOr = 22, + AtomicFetchXor = 23, + AtomicFetchNand = 24, + AtomicAddFetch = 25, + AtomicSubFetch = 26, + AtomicAndFetch = 27, + AtomicOrFetch = 28, + AtomicXorFetch = 29, + AtomicNandFetch = 30, + OpenclAtomicInit = 31, + OpenclAtomicLoad = 32, + OpenclAtomicStore = 33, + OpenclAtomicExchange = 34, + OpenclAtomicCompareExchangeStrong = 35, + OpenclAtomicCompareExchangeWeak = 36, + OpenclAtomicFetchAdd = 37, + OpenclAtomicFetchSub = 38, + OpenclAtomicFetchAnd = 39, + OpenclAtomicFetchOr = 40, + OpenclAtomicFetchXor = 41, + OpenclAtomicFetchMin = 42, + OpenclAtomicFetchMax = 43, + AtomicFetchMin = 44, + AtomicFetchMax = 45, + + }; + + AtomicExpr(); + Expr* ptr; + Expr* order; + Expr* scope; + Expr* val1; + Expr* orderFail; + Expr* val2; + Expr* weak; + QualifiedType valueType; + AtomicOp op; + bool isVolatile; + bool isCmpXChg; + bool isOpenCL; + SourceLocation builtinLoc; + SourceLocation rParenLoc; }; -class GNUNullExpr : public Expr +class CS_API TypoExpr : public Expr { +public: + TypoExpr(); }; -class VAArgExpr : public Expr +class CS_API CXXOperatorCallExpr : public CallExpr { +public: + CXXOperatorCallExpr(); + OverloadedOperatorKind _operator; + bool isInfixBinaryOp; + SourceLocation operatorLoc; + bool isFPContractableWithinStatement; }; -class InitListExpr : public Expr +class CS_API CXXMemberCallExpr : public CallExpr { - typedef ASTVector InitExprsTy; +public: + CXXMemberCallExpr(); + Expr* implicitObjectArgument; + Method* methodDecl; +}; + +class CS_API CUDAKernelCallExpr : public CallExpr +{ +public: + CUDAKernelCallExpr(); + CallExpr* config; +}; - typedef iterator iterator; +class CS_API CXXNamedCastExpr : public ExplicitCastExpr +{ +public: + CXXNamedCastExpr(); + CXXNamedCastExpr(StmtClass klass); + const char* castName; + SourceLocation operatorLoc; + SourceLocation rParenLoc; + SourceRange angleBrackets; +}; - typedef const_iterator const_iterator; +class CS_API CXXStaticCastExpr : public CXXNamedCastExpr +{ +public: + CXXStaticCastExpr(); +}; - typedef reverse_iterator reverse_iterator; +class CS_API CXXDynamicCastExpr : public CXXNamedCastExpr +{ +public: + CXXDynamicCastExpr(); + bool isAlwaysNull; +}; - typedef const_reverse_iterator const_reverse_iterator; +class CS_API CXXReinterpretCastExpr : public CXXNamedCastExpr +{ +public: + CXXReinterpretCastExpr(); }; -class DesignatedInitExpr : public Expr +class CS_API CXXConstCastExpr : public CXXNamedCastExpr { - class Designator +public: + CXXConstCastExpr(); +}; + +class CS_API UserDefinedLiteral : public CallExpr +{ +public: + enum class LiteralOperatorKind + { + Raw = 0, + Template = 1, + Integer = 2, + Floating = 3, + String = 4, + Character = 5 + }; + + UserDefinedLiteral(); + LiteralOperatorKind literalOperatorKind; + SourceLocation uDSuffixLoc; +}; + +class CS_API CXXBoolLiteralExpr : public Expr +{ +public: + CXXBoolLiteralExpr(); + bool value; + SourceLocation location; +}; + +class CS_API CXXNullPtrLiteralExpr : public Expr +{ +public: + CXXNullPtrLiteralExpr(); + SourceLocation location; +}; + +class CS_API CXXStdInitializerListExpr : public Expr +{ +public: + CXXStdInitializerListExpr(); +}; + +class CS_API CXXTypeidExpr : public Expr +{ +public: + CXXTypeidExpr(); + Expr* exprOperand; + bool isPotentiallyEvaluated; + bool isTypeOperand; +}; + +class CS_API MSPropertyRefExpr : public Expr +{ +public: + MSPropertyRefExpr(); + bool isImplicitAccess; + Expr* baseExpr; + bool isArrow; + SourceLocation memberLoc; +}; + +class CS_API MSPropertySubscriptExpr : public Expr +{ +public: + MSPropertySubscriptExpr(); + SourceLocation rBracketLoc; +}; + +class CS_API CXXUuidofExpr : public Expr +{ +public: + CXXUuidofExpr(); + Expr* exprOperand; + std::string uuidStr; + bool isTypeOperand; +}; + +class CS_API CXXThisExpr : public Expr +{ +public: + CXXThisExpr(); + SourceLocation location; + bool implicit; +}; + +class CS_API CXXThrowExpr : public Expr +{ +public: + CXXThrowExpr(); + SourceLocation throwLoc; + bool isThrownVariableInScope; +}; + +class CS_API CXXDefaultArgExpr : public Expr +{ +public: + CXXDefaultArgExpr(); + SourceLocation usedLocation; +}; + +class CS_API CXXDefaultInitExpr : public Expr +{ +public: + CXXDefaultInitExpr(); +}; + +class CS_API CXXBindTemporaryExpr : public Expr +{ +public: + CXXBindTemporaryExpr(); + Expr* subExpr; +}; + +class CS_API CXXConstructExpr : public Expr +{ +public: + enum class ConstructionKind { + Complete = 0, + NonVirtualBase = 1, + VirtualBase = 2, + Delegating = 3 }; - class FieldDesignator + CXXConstructExpr(); + CXXConstructExpr(StmtClass klass); + VECTOR(Expr*, arguments) + SourceLocation location; + bool elidable; + bool hadMultipleCandidates; + bool listInitialization; + bool stdInitListInitialization; + bool requiresZeroInitialization; + SourceRange parenOrBraceRange; + unsigned int numArgs; +}; + +class CS_API CXXInheritedCtorInitExpr : public Expr +{ +public: + CXXInheritedCtorInitExpr(); + bool constructsVBase; + bool inheritedFromVBase; + SourceLocation location; +}; + +class CS_API CXXFunctionalCastExpr : public ExplicitCastExpr +{ +public: + CXXFunctionalCastExpr(); + SourceLocation lParenLoc; + SourceLocation rParenLoc; + bool isListInitialization; +}; + +class CS_API CXXTemporaryObjectExpr : public CXXConstructExpr +{ +public: + CXXTemporaryObjectExpr(); +}; + +class CS_API LambdaExpr : public Expr +{ +public: + LambdaExpr(); + VECTOR(Expr*, capture_inits) + SourceLocation captureDefaultLoc; + unsigned int capture_size; + SourceRange introducerRange; + Method* callOperator; + bool isGenericLambda; + CompoundStmt* body; + bool isMutable; + bool hasExplicitParameters; + bool hasExplicitResultType; +}; + +class CS_API CXXScalarValueInitExpr : public Expr +{ +public: + CXXScalarValueInitExpr(); + SourceLocation rParenLoc; +}; + +class CS_API CXXNewExpr : public Expr +{ +public: + enum class InitializationStyle { + NoInit = 0, + CallInit = 1, + ListInit = 2 }; - class ArrayOrRangeDesignator + CXXNewExpr(); + VECTOR(Expr*, placement_arguments) + Function* operatorNew; + Function* operatorDelete; + QualifiedType allocatedType; + bool isArray; + unsigned int numPlacementArgs; + bool isParenTypeId; + SourceRange typeIdParens; + bool isGlobalNew; + bool hasInitializer; + InitializationStyle initializationStyle; + CXXConstructExpr* constructExpr; + SourceRange directInitRange; +}; + +class CS_API CXXDeleteExpr : public Expr +{ +public: + CXXDeleteExpr(); + bool isGlobalDelete; + bool isArrayForm; + bool isArrayFormAsWritten; + Function* operatorDelete; + QualifiedType destroyedType; +}; + +class CS_API CXXPseudoDestructorExpr : public Expr +{ +public: + CXXPseudoDestructorExpr(); + Expr* base; + bool hasQualifier; + bool isArrow; + SourceLocation operatorLoc; + SourceLocation colonColonLoc; + SourceLocation tildeLoc; + QualifiedType destroyedType; + SourceLocation destroyedTypeLoc; +}; + +class CS_API TypeTraitExpr : public Expr +{ +public: + TypeTraitExpr(); + bool value; + unsigned int numArgs; +}; + +class CS_API ArrayTypeTraitExpr : public Expr +{ +public: + ArrayTypeTraitExpr(); + QualifiedType queriedType; + uint64_t value; + Expr* dimensionExpression; +}; + +class CS_API ExpressionTraitExpr : public Expr +{ +public: + ExpressionTraitExpr(); + Expr* queriedExpression; + bool value; +}; + +class CS_API OverloadExpr : public Expr +{ +public: + class CS_API FindResult { + public: + FindResult(); }; + + OverloadExpr(); + OverloadExpr(StmtClass klass); + unsigned int numDecls; + SourceLocation nameLoc; + SourceLocation templateKeywordLoc; + SourceLocation lAngleLoc; + SourceLocation rAngleLoc; + bool hasTemplateKeyword; + bool hasExplicitTemplateArgs; + unsigned int numTemplateArgs; }; -class NoInitExpr : public Expr +class CS_API UnresolvedLookupExpr : public OverloadExpr { +public: + UnresolvedLookupExpr(); + bool requiresADL; + bool isOverloaded; }; -class DesignatedInitUpdateExpr : public Expr +class CS_API DependentScopeDeclRefExpr : public Expr { +public: + DependentScopeDeclRefExpr(); + SourceLocation location; + SourceLocation templateKeywordLoc; + SourceLocation lAngleLoc; + SourceLocation rAngleLoc; + bool hasTemplateKeyword; + bool hasExplicitTemplateArgs; + unsigned int numTemplateArgs; }; -class ArrayInitLoopExpr : public Expr +class CS_API ExprWithCleanups : public FullExpr { +public: + ExprWithCleanups(); + unsigned int numObjects; + bool cleanupsHaveSideEffects; }; -class ArrayInitIndexExpr : public Expr +class CS_API CXXUnresolvedConstructExpr : public Expr { +public: + CXXUnresolvedConstructExpr(); + VECTOR(Expr*, arguments) + SourceLocation lParenLoc; + SourceLocation rParenLoc; + QualifiedType typeAsWritten; + bool isListInitialization; + unsigned int arg_size; }; -class ImplicitValueInitExpr : public Expr +class CS_API CXXDependentScopeMemberExpr : public Expr { +public: + CXXDependentScopeMemberExpr(); + bool isImplicitAccess; + Expr* base; + QualifiedType baseType; + bool isArrow; + SourceLocation operatorLoc; + Declaration* firstQualifierFoundInScope; + SourceLocation memberLoc; + SourceLocation templateKeywordLoc; + SourceLocation lAngleLoc; + SourceLocation rAngleLoc; + bool hasTemplateKeyword; + bool hasExplicitTemplateArgs; + unsigned int numTemplateArgs; }; -class ParenListExpr : public Expr +class CS_API UnresolvedMemberExpr : public OverloadExpr { +public: + UnresolvedMemberExpr(); + bool isImplicitAccess; + QualifiedType baseType; + bool hasUnresolvedUsing; + bool isArrow; + SourceLocation operatorLoc; + SourceLocation memberLoc; }; -class GenericSelectionExpr : public Expr +class CS_API CXXNoexceptExpr : public Expr { +public: + CXXNoexceptExpr(); + Expr* operand; + bool value; }; -class ExtVectorElementExpr : public Expr +class CS_API PackExpansionExpr : public Expr { +public: + PackExpansionExpr(); + SourceLocation ellipsisLoc; }; -class BlockExpr : public Expr +class CS_API SizeOfPackExpr : public Expr { +public: + SizeOfPackExpr(); + SourceLocation operatorLoc; + SourceLocation packLoc; + SourceLocation rParenLoc; + Declaration* pack; + unsigned int packLength; + bool isPartiallySubstituted; }; -class AsTypeExpr : public Expr +class CS_API SubstNonTypeTemplateParmExpr : public Expr { +public: + SubstNonTypeTemplateParmExpr(); + SourceLocation nameLoc; + Expr* replacement; }; -class PseudoObjectExpr : public Expr +class CS_API SubstNonTypeTemplateParmPackExpr : public Expr { - typedef Expr* const* semantics_iterator; +public: + SubstNonTypeTemplateParmPackExpr(); + SourceLocation parameterPackLocation; + TemplateArgument argumentPack; +}; - typedef const Expr* const* const_semantics_iterator; +class CS_API FunctionParmPackExpr : public Expr +{ +public: + FunctionParmPackExpr(); + SourceLocation parameterPackLocation; + unsigned int numExpansions; }; -class AtomicExpr : public Expr +class CS_API MaterializeTemporaryExpr : public Expr { - enum class AtomicOp +public: + class CS_API ExtraState { - AO__c11_atomic_init = 0, - AO__c11_atomic_load = 1, - AO__c11_atomic_store = 2, - AO__c11_atomic_exchange = 3, - AO__c11_atomic_compare_exchange_strong = 4, - AO__c11_atomic_compare_exchange_weak = 5, - AO__c11_atomic_fetch_add = 6, - AO__c11_atomic_fetch_sub = 7, - AO__c11_atomic_fetch_and = 8, - AO__c11_atomic_fetch_or = 9, - AO__c11_atomic_fetch_xor = 10, - AO__atomic_load = 11, - AO__atomic_load_n = 12, - AO__atomic_store = 13, - AO__atomic_store_n = 14, - AO__atomic_exchange = 15, - AO__atomic_exchange_n = 16, - AO__atomic_compare_exchange = 17, - AO__atomic_compare_exchange_n = 18, - AO__atomic_fetch_add = 19, - AO__atomic_fetch_sub = 20, - AO__atomic_fetch_and = 21, - AO__atomic_fetch_or = 22, - AO__atomic_fetch_xor = 23, - AO__atomic_fetch_nand = 24, - AO__atomic_add_fetch = 25, - AO__atomic_sub_fetch = 26, - AO__atomic_and_fetch = 27, - AO__atomic_or_fetch = 28, - AO__atomic_xor_fetch = 29, - AO__atomic_nand_fetch = 30, - AO__opencl_atomic_init = 31, - AO__opencl_atomic_load = 32, - AO__opencl_atomic_store = 33, - AO__opencl_atomic_exchange = 34, - AO__opencl_atomic_compare_exchange_strong = 35, - AO__opencl_atomic_compare_exchange_weak = 36, - AO__opencl_atomic_fetch_add = 37, - AO__opencl_atomic_fetch_sub = 38, - AO__opencl_atomic_fetch_and = 39, - AO__opencl_atomic_fetch_or = 40, - AO__opencl_atomic_fetch_xor = 41, - AO__opencl_atomic_fetch_min = 42, - AO__opencl_atomic_fetch_max = 43, - AO__atomic_fetch_min = 44, - AO__atomic_fetch_max = 45, - BI_First = 0 + public: + ExtraState(); }; + + MaterializeTemporaryExpr(); + Stmt* temporary; + Expr* TemporaryExpr; + unsigned int manglingNumber; + bool isBoundToLvalueReference; +}; + +class CS_API CXXFoldExpr : public Expr +{ +public: + CXXFoldExpr(); + Expr* lHS; + Expr* rHS; + bool isRightFold; + bool isLeftFold; + Expr* pattern; + Expr* init; + SourceLocation ellipsisLoc; + BinaryOperatorKind _operator; +}; + +class CS_API CoroutineSuspendExpr : public Expr +{ +public: + enum class SubExpr + { + Common = 0, + Ready = 1, + Suspend = 2, + Resume = 3, + Count = 4 + }; + + CoroutineSuspendExpr(); + CoroutineSuspendExpr(StmtClass klass); + SourceLocation keywordLoc; + Expr* commonExpr; + OpaqueValueExpr* opaqueValue; + Expr* readyExpr; + Expr* suspendExpr; + Expr* resumeExpr; +}; + +class CS_API CoawaitExpr : public CoroutineSuspendExpr +{ +public: + CoawaitExpr(); + bool isImplicit; + Expr* operand; +}; + +class CS_API DependentCoawaitExpr : public Expr +{ +public: + DependentCoawaitExpr(); + Expr* operand; + UnresolvedLookupExpr* operatorCoawaitLookup; + SourceLocation keywordLoc; }; -class TypoExpr : public Expr +class CS_API CoyieldExpr : public CoroutineSuspendExpr { +public: + CoyieldExpr(); + Expr* operand; }; } } } diff --git a/src/CppParser/ParseExpr.cpp b/src/CppParser/ParseExpr.cpp new file mode 100644 index 00000000..f884fbc1 --- /dev/null +++ b/src/CppParser/ParseExpr.cpp @@ -0,0 +1,2038 @@ +// ---------------------------------------------------------------------------- +// +// This is autogenerated code by CppSharp. +// Do not edit this file or all your changes will be lost after re-generation. +// +// ---------------------------------------------------------------------------- + + +#include "AST.h" +#include "Parser.h" +#include +#include + +namespace CppSharp { namespace CppParser { + +AST::Expr* Parser::WalkExpression(const clang::Expr* Expr) +{ + if (Expr == nullptr) + return nullptr; + + AST::Expr* _Expr= 0; + + switch (Expr->getStmtClass()) + { + case clang::Stmt::ConstantExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::ConstantExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->subExpr = static_cast(WalkExpression(S->getSubExpr())); + _Expr = _S; + break; + } + case clang::Stmt::OpaqueValueExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::OpaqueValueExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->isUnique = S->isUnique(); + _S->sourceExpr = static_cast(WalkExpression(S->getSourceExpr())); + _Expr = _S; + break; + } + case clang::Stmt::DeclRefExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::DeclRefExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->hadMultipleCandidates = S->hadMultipleCandidates(); + _S->hasQualifier = S->hasQualifier(); + _S->hasTemplateKWAndArgsInfo = S->hasTemplateKWAndArgsInfo(); + _S->hasTemplateKeyword = S->hasTemplateKeyword(); + _S->hasExplicitTemplateArgs = S->hasExplicitTemplateArgs(); + _S->numTemplateArgs = S->getNumTemplateArgs(); + _S->refersToEnclosingVariableOrCapture = S->refersToEnclosingVariableOrCapture(); + _Expr = _S; + break; + } + case clang::Stmt::IntegerLiteralClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::IntegerLiteral(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _Expr = _S; + break; + } + case clang::Stmt::FixedPointLiteralClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::FixedPointLiteral(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _Expr = _S; + break; + } + case clang::Stmt::CharacterLiteralClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CharacterLiteral(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->kind = (CharacterLiteral::CharacterKind) S->getKind(); + _S->value = S->getValue(); + _Expr = _S; + break; + } + case clang::Stmt::FloatingLiteralClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::FloatingLiteral(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->exact = S->isExact(); + _S->valueAsApproximateDouble = S->getValueAsApproximateDouble(); + _Expr = _S; + break; + } + case clang::Stmt::ImaginaryLiteralClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::ImaginaryLiteral(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->subExpr = static_cast(WalkExpression(S->getSubExpr())); + _Expr = _S; + break; + } + case clang::Stmt::StringLiteralClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::StringLiteral(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->string = S->getString(); + _S->bytes = S->getBytes(); + _S->byteLength = S->getByteLength(); + _S->length = S->getLength(); + _S->charByteWidth = S->getCharByteWidth(); + _S->kind = (StringLiteral::StringKind) S->getKind(); + _S->isAscii = S->isAscii(); + _S->isWide = S->isWide(); + _S->isUTF8 = S->isUTF8(); + _S->isUTF16 = S->isUTF16(); + _S->isUTF32 = S->isUTF32(); + _S->isPascal = S->isPascal(); + _S->containsNonAscii = S->containsNonAscii(); + _S->containsNonAsciiOrNull = S->containsNonAsciiOrNull(); + _S->numConcatenated = S->getNumConcatenated(); + _Expr = _S; + break; + } + case clang::Stmt::PredefinedExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::PredefinedExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->identKind = (PredefinedExpr::IdentKind) S->getIdentKind(); + _Expr = _S; + break; + } + case clang::Stmt::ParenExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::ParenExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->subExpr = static_cast(WalkExpression(S->getSubExpr())); + _Expr = _S; + break; + } + case clang::Stmt::UnaryOperatorClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::UnaryOperator(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->opcode = (UnaryOperatorKind) S->getOpcode(); + _S->subExpr = static_cast(WalkExpression(S->getSubExpr())); + _S->canOverflow = S->canOverflow(); + _Expr = _S; + break; + } + case clang::Stmt::OffsetOfExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::OffsetOfExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->numComponents = S->getNumComponents(); + _S->numExpressions = S->getNumExpressions(); + _Expr = _S; + break; + } + case clang::Stmt::UnaryExprOrTypeTraitExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::UnaryExprOrTypeTraitExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->kind = (UnaryExprOrTypeTrait) S->getKind(); + _S->isArgumentType = S->isArgumentType(); + if (S->isArgumentType()) + _S->argumentType = GetQualifiedType(S->getArgumentType()); + _S->typeOfArgument = GetQualifiedType(S->getTypeOfArgument()); + _Expr = _S; + break; + } + case clang::Stmt::ArraySubscriptExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::ArraySubscriptExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->lHS = static_cast(WalkExpression(S->getLHS())); + _S->rHS = static_cast(WalkExpression(S->getRHS())); + _Expr = _S; + break; + } + case clang::Stmt::CallExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CallExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->callee = static_cast(WalkExpression(S->getCallee())); + _S->numArgs = S->getNumArgs(); + _S->numCommas = S->getNumCommas(); + _S->builtinCallee = S->getBuiltinCallee(); + _S->isCallToStdMove = S->isCallToStdMove(); + for (auto _E : S->arguments()) + { + auto _ES = WalkExpression(_E); + _S->addarguments(_ES); + } + _Expr = _S; + break; + } + case clang::Stmt::MemberExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::MemberExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->base = static_cast(WalkExpression(S->getBase())); + _S->arrow = S->isArrow(); + _S->hadMultipleCandidates = S->hadMultipleCandidates(); + _S->hasQualifier = S->hasQualifier(); + _S->hasTemplateKeyword = S->hasTemplateKeyword(); + _S->hasExplicitTemplateArgs = S->hasExplicitTemplateArgs(); + _S->numTemplateArgs = S->getNumTemplateArgs(); + _S->isImplicitAccess = S->isImplicitAccess(); + _Expr = _S; + break; + } + case clang::Stmt::CompoundLiteralExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CompoundLiteralExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->initializer = static_cast(WalkExpression(S->getInitializer())); + _S->fileScope = S->isFileScope(); + _Expr = _S; + break; + } + case clang::Stmt::ImplicitCastExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::ImplicitCastExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->castKind = (CastKind) S->getCastKind(); + _S->subExpr = static_cast(WalkExpression(S->getSubExpr())); + _S->conversionFunction = static_cast(WalkDeclaration(S->getConversionFunction())); + _S->path_empty = S->path_empty(); + _S->path_size = S->path_size(); + _S->isPartOfExplicitCast = S->isPartOfExplicitCast(); + _Expr = _S; + break; + } + case clang::Stmt::CStyleCastExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CStyleCastExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->castKind = (CastKind) S->getCastKind(); + _S->subExpr = static_cast(WalkExpression(S->getSubExpr())); + _S->conversionFunction = static_cast(WalkDeclaration(S->getConversionFunction())); + _S->path_empty = S->path_empty(); + _S->path_size = S->path_size(); + _S->typeAsWritten = GetQualifiedType(S->getTypeAsWritten()); + _Expr = _S; + break; + } + case clang::Stmt::BinaryOperatorClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::BinaryOperator(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->opcode = (BinaryOperatorKind) S->getOpcode(); + _S->lHS = static_cast(WalkExpression(S->getLHS())); + _S->rHS = static_cast(WalkExpression(S->getRHS())); + _S->isFPContractableWithinStatement = S->isFPContractableWithinStatement(); + _S->isFEnvAccessOn = S->isFEnvAccessOn(); + _Expr = _S; + break; + } + case clang::Stmt::CompoundAssignOperatorClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CompoundAssignOperator(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->opcode = (BinaryOperatorKind) S->getOpcode(); + _S->lHS = static_cast(WalkExpression(S->getLHS())); + _S->rHS = static_cast(WalkExpression(S->getRHS())); + _S->isFPContractableWithinStatement = S->isFPContractableWithinStatement(); + _S->isFEnvAccessOn = S->isFEnvAccessOn(); + _S->computationLHSType = GetQualifiedType(S->getComputationLHSType()); + _S->computationResultType = GetQualifiedType(S->getComputationResultType()); + _Expr = _S; + break; + } + case clang::Stmt::ConditionalOperatorClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::ConditionalOperator(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->cond = static_cast(WalkExpression(S->getCond())); + _S->trueExpr = static_cast(WalkExpression(S->getTrueExpr())); + _S->falseExpr = static_cast(WalkExpression(S->getFalseExpr())); + _S->cond = static_cast(WalkExpression(S->getCond())); + _S->trueExpr = static_cast(WalkExpression(S->getTrueExpr())); + _S->falseExpr = static_cast(WalkExpression(S->getFalseExpr())); + _S->lHS = static_cast(WalkExpression(S->getLHS())); + _S->rHS = static_cast(WalkExpression(S->getRHS())); + _Expr = _S; + break; + } + case clang::Stmt::BinaryConditionalOperatorClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::BinaryConditionalOperator(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->cond = static_cast(WalkExpression(S->getCond())); + _S->trueExpr = static_cast(WalkExpression(S->getTrueExpr())); + _S->falseExpr = static_cast(WalkExpression(S->getFalseExpr())); + _S->common = static_cast(WalkExpression(S->getCommon())); + _S->opaqueValue = static_cast(WalkExpression(S->getOpaqueValue())); + _S->cond = static_cast(WalkExpression(S->getCond())); + _S->trueExpr = static_cast(WalkExpression(S->getTrueExpr())); + _S->falseExpr = static_cast(WalkExpression(S->getFalseExpr())); + _Expr = _S; + break; + } + case clang::Stmt::AddrLabelExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::AddrLabelExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _Expr = _S; + break; + } + case clang::Stmt::StmtExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::StmtExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->subStmt = static_cast(WalkStatement(S->getSubStmt())); + _Expr = _S; + break; + } + case clang::Stmt::ShuffleVectorExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::ShuffleVectorExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->numSubExprs = S->getNumSubExprs(); + _Expr = _S; + break; + } + case clang::Stmt::ConvertVectorExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::ConvertVectorExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->srcExpr = static_cast(WalkExpression(S->getSrcExpr())); + _Expr = _S; + break; + } + case clang::Stmt::ChooseExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::ChooseExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->isConditionTrue = S->isConditionTrue(); + _S->cond = static_cast(WalkExpression(S->getCond())); + _S->lHS = static_cast(WalkExpression(S->getLHS())); + _S->rHS = static_cast(WalkExpression(S->getRHS())); + _S->isConditionDependent = S->isConditionDependent(); + _S->chosenSubExpr = static_cast(WalkExpression(S->getChosenSubExpr())); + _Expr = _S; + break; + } + case clang::Stmt::GNUNullExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::GNUNullExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _Expr = _S; + break; + } + case clang::Stmt::VAArgExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::VAArgExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->subExpr = static_cast(WalkExpression(S->getSubExpr())); + _S->isMicrosoftABI = S->isMicrosoftABI(); + _Expr = _S; + break; + } + case clang::Stmt::InitListExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::InitListExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->arrayFiller = static_cast(WalkExpression(S->getArrayFiller())); + if (S->isSyntacticForm()) + _S->syntacticForm = static_cast(WalkExpression(S->getSyntacticForm())); + _S->numInits = S->getNumInits(); + _S->hasArrayFiller = S->hasArrayFiller(); + _S->isExplicit = S->isExplicit(); + _S->isStringLiteralInit = S->isStringLiteralInit(); + _S->isTransparent = S->isTransparent(); + _S->isSemanticForm = S->isSemanticForm(); + if (S->isSemanticForm()) + _S->semanticForm = static_cast(WalkExpression(S->getSemanticForm())); + _S->isSyntacticForm = S->isSyntacticForm(); + _Expr = _S; + break; + } + case clang::Stmt::DesignatedInitExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::DesignatedInitExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->init = static_cast(WalkExpression(S->getInit())); + _S->size = S->size(); + _S->usesGNUSyntax = S->usesGNUSyntax(); + _S->numSubExprs = S->getNumSubExprs(); + _Expr = _S; + break; + } + case clang::Stmt::NoInitExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::NoInitExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _Expr = _S; + break; + } + case clang::Stmt::DesignatedInitUpdateExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::DesignatedInitUpdateExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->base = static_cast(WalkExpression(S->getBase())); + _S->updater = static_cast(WalkExpression(S->getUpdater())); + _Expr = _S; + break; + } + case clang::Stmt::ArrayInitLoopExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::ArrayInitLoopExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->commonExpr = static_cast(WalkExpression(S->getCommonExpr())); + _S->subExpr = static_cast(WalkExpression(S->getSubExpr())); + _Expr = _S; + break; + } + case clang::Stmt::ArrayInitIndexExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::ArrayInitIndexExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _Expr = _S; + break; + } + case clang::Stmt::ImplicitValueInitExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::ImplicitValueInitExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _Expr = _S; + break; + } + case clang::Stmt::ParenListExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::ParenListExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->numExprs = S->getNumExprs(); + _Expr = _S; + break; + } + case clang::Stmt::GenericSelectionExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::GenericSelectionExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->numAssocs = S->getNumAssocs(); + _S->isResultDependent = S->isResultDependent(); + _S->resultIndex = S->getResultIndex(); + _Expr = _S; + break; + } + case clang::Stmt::ExtVectorElementExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::ExtVectorElementExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->base = static_cast(WalkExpression(S->getBase())); + _S->numElements = S->getNumElements(); + _S->containsDuplicateElements = S->containsDuplicateElements(); + _S->isArrow = S->isArrow(); + _Expr = _S; + break; + } + case clang::Stmt::BlockExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::BlockExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _Expr = _S; + break; + } + case clang::Stmt::AsTypeExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::AsTypeExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->srcExpr = static_cast(WalkExpression(S->getSrcExpr())); + _Expr = _S; + break; + } + case clang::Stmt::PseudoObjectExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::PseudoObjectExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->resultExprIndex = S->getResultExprIndex(); + _S->numSemanticExprs = S->getNumSemanticExprs(); + _Expr = _S; + break; + } + case clang::Stmt::AtomicExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::AtomicExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->ptr = static_cast(WalkExpression(S->getPtr())); + _S->order = static_cast(WalkExpression(S->getOrder())); + _S->scope = static_cast(WalkExpression(S->getScope())); + _S->val1 = static_cast(WalkExpression(S->getVal1())); + _S->orderFail = static_cast(WalkExpression(S->getOrderFail())); + _S->val2 = static_cast(WalkExpression(S->getVal2())); + _S->weak = static_cast(WalkExpression(S->getWeak())); + _S->valueType = GetQualifiedType(S->getValueType()); + _S->op = (AtomicExpr::AtomicOp) S->getOp(); + _S->isVolatile = S->isVolatile(); + _S->isCmpXChg = S->isCmpXChg(); + _S->isOpenCL = S->isOpenCL(); + _Expr = _S; + break; + } + case clang::Stmt::TypoExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::TypoExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _Expr = _S; + break; + } + case clang::Stmt::CXXOperatorCallExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXOperatorCallExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->callee = static_cast(WalkExpression(S->getCallee())); + _S->numArgs = S->getNumArgs(); + _S->numCommas = S->getNumCommas(); + _S->builtinCallee = S->getBuiltinCallee(); + _S->isCallToStdMove = S->isCallToStdMove(); + for (auto _E : S->arguments()) + { + auto _ES = WalkExpression(_E); + _S->addarguments(_ES); + } + _S->_operator = (OverloadedOperatorKind) S->getOperator(); + _S->isInfixBinaryOp = S->isInfixBinaryOp(); + _S->isFPContractableWithinStatement = S->isFPContractableWithinStatement(); + _Expr = _S; + break; + } + case clang::Stmt::CXXMemberCallExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXMemberCallExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->callee = static_cast(WalkExpression(S->getCallee())); + _S->numArgs = S->getNumArgs(); + _S->numCommas = S->getNumCommas(); + _S->builtinCallee = S->getBuiltinCallee(); + _S->isCallToStdMove = S->isCallToStdMove(); + for (auto _E : S->arguments()) + { + auto _ES = WalkExpression(_E); + _S->addarguments(_ES); + } + _S->implicitObjectArgument = static_cast(WalkExpression(S->getImplicitObjectArgument())); + _S->methodDecl = static_cast(WalkDeclaration(S->getMethodDecl())); + _Expr = _S; + break; + } + case clang::Stmt::CUDAKernelCallExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CUDAKernelCallExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->callee = static_cast(WalkExpression(S->getCallee())); + _S->numArgs = S->getNumArgs(); + _S->numCommas = S->getNumCommas(); + _S->builtinCallee = S->getBuiltinCallee(); + _S->isCallToStdMove = S->isCallToStdMove(); + for (auto _E : S->arguments()) + { + auto _ES = WalkExpression(_E); + _S->addarguments(_ES); + } + _S->config = static_cast(WalkExpression(S->getConfig())); + _Expr = _S; + break; + } + case clang::Stmt::CXXStaticCastExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXStaticCastExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->castKind = (CastKind) S->getCastKind(); + _S->subExpr = static_cast(WalkExpression(S->getSubExpr())); + _S->conversionFunction = static_cast(WalkDeclaration(S->getConversionFunction())); + _S->path_empty = S->path_empty(); + _S->path_size = S->path_size(); + _S->typeAsWritten = GetQualifiedType(S->getTypeAsWritten()); + _S->castName = S->getCastName(); + _Expr = _S; + break; + } + case clang::Stmt::CXXDynamicCastExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXDynamicCastExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->castKind = (CastKind) S->getCastKind(); + _S->subExpr = static_cast(WalkExpression(S->getSubExpr())); + _S->conversionFunction = static_cast(WalkDeclaration(S->getConversionFunction())); + _S->path_empty = S->path_empty(); + _S->path_size = S->path_size(); + _S->typeAsWritten = GetQualifiedType(S->getTypeAsWritten()); + _S->castName = S->getCastName(); + _S->isAlwaysNull = S->isAlwaysNull(); + _Expr = _S; + break; + } + case clang::Stmt::CXXReinterpretCastExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXReinterpretCastExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->castKind = (CastKind) S->getCastKind(); + _S->subExpr = static_cast(WalkExpression(S->getSubExpr())); + _S->conversionFunction = static_cast(WalkDeclaration(S->getConversionFunction())); + _S->path_empty = S->path_empty(); + _S->path_size = S->path_size(); + _S->typeAsWritten = GetQualifiedType(S->getTypeAsWritten()); + _S->castName = S->getCastName(); + _Expr = _S; + break; + } + case clang::Stmt::CXXConstCastExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXConstCastExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->castKind = (CastKind) S->getCastKind(); + _S->subExpr = static_cast(WalkExpression(S->getSubExpr())); + _S->conversionFunction = static_cast(WalkDeclaration(S->getConversionFunction())); + _S->path_empty = S->path_empty(); + _S->path_size = S->path_size(); + _S->typeAsWritten = GetQualifiedType(S->getTypeAsWritten()); + _S->castName = S->getCastName(); + _Expr = _S; + break; + } + case clang::Stmt::UserDefinedLiteralClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::UserDefinedLiteral(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->callee = static_cast(WalkExpression(S->getCallee())); + _S->numArgs = S->getNumArgs(); + _S->numCommas = S->getNumCommas(); + _S->builtinCallee = S->getBuiltinCallee(); + _S->isCallToStdMove = S->isCallToStdMove(); + for (auto _E : S->arguments()) + { + auto _ES = WalkExpression(_E); + _S->addarguments(_ES); + } + _S->literalOperatorKind = (UserDefinedLiteral::LiteralOperatorKind) S->getLiteralOperatorKind(); + _Expr = _S; + break; + } + case clang::Stmt::CXXBoolLiteralExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXBoolLiteralExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->value = S->getValue(); + _Expr = _S; + break; + } + case clang::Stmt::CXXNullPtrLiteralExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXNullPtrLiteralExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _Expr = _S; + break; + } + case clang::Stmt::CXXStdInitializerListExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXStdInitializerListExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _Expr = _S; + break; + } + case clang::Stmt::CXXTypeidExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXTypeidExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->exprOperand = static_cast(WalkExpression(S->getExprOperand())); + _S->isPotentiallyEvaluated = S->isPotentiallyEvaluated(); + _S->isTypeOperand = S->isTypeOperand(); + _Expr = _S; + break; + } + case clang::Stmt::MSPropertyRefExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::MSPropertyRefExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->isImplicitAccess = S->isImplicitAccess(); + _S->baseExpr = static_cast(WalkExpression(S->getBaseExpr())); + _S->isArrow = S->isArrow(); + _Expr = _S; + break; + } + case clang::Stmt::MSPropertySubscriptExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::MSPropertySubscriptExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _Expr = _S; + break; + } + case clang::Stmt::CXXUuidofExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXUuidofExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->exprOperand = static_cast(WalkExpression(S->getExprOperand())); + _S->uuidStr = S->getUuidStr(); + _S->isTypeOperand = S->isTypeOperand(); + _Expr = _S; + break; + } + case clang::Stmt::CXXThisExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXThisExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->implicit = S->isImplicit(); + _Expr = _S; + break; + } + case clang::Stmt::CXXThrowExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXThrowExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->isThrownVariableInScope = S->isThrownVariableInScope(); + _Expr = _S; + break; + } + case clang::Stmt::CXXDefaultArgExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXDefaultArgExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _Expr = _S; + break; + } + case clang::Stmt::CXXDefaultInitExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXDefaultInitExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _Expr = _S; + break; + } + case clang::Stmt::CXXBindTemporaryExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXBindTemporaryExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->subExpr = static_cast(WalkExpression(S->getSubExpr())); + _Expr = _S; + break; + } + case clang::Stmt::CXXConstructExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXConstructExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->elidable = S->isElidable(); + _S->hadMultipleCandidates = S->hadMultipleCandidates(); + _S->listInitialization = S->isListInitialization(); + _S->stdInitListInitialization = S->isStdInitListInitialization(); + _S->requiresZeroInitialization = S->requiresZeroInitialization(); + _S->numArgs = S->getNumArgs(); + for (auto _E : S->arguments()) + { + auto _ES = WalkExpression(_E); + _S->addarguments(_ES); + } + _Expr = _S; + break; + } + case clang::Stmt::CXXInheritedCtorInitExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXInheritedCtorInitExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->constructsVBase = S->constructsVBase(); + _S->inheritedFromVBase = S->inheritedFromVBase(); + _Expr = _S; + break; + } + case clang::Stmt::CXXFunctionalCastExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXFunctionalCastExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->castKind = (CastKind) S->getCastKind(); + _S->subExpr = static_cast(WalkExpression(S->getSubExpr())); + _S->conversionFunction = static_cast(WalkDeclaration(S->getConversionFunction())); + _S->path_empty = S->path_empty(); + _S->path_size = S->path_size(); + _S->typeAsWritten = GetQualifiedType(S->getTypeAsWritten()); + _S->isListInitialization = S->isListInitialization(); + _Expr = _S; + break; + } + case clang::Stmt::CXXTemporaryObjectExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXTemporaryObjectExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->elidable = S->isElidable(); + _S->hadMultipleCandidates = S->hadMultipleCandidates(); + _S->listInitialization = S->isListInitialization(); + _S->stdInitListInitialization = S->isStdInitListInitialization(); + _S->requiresZeroInitialization = S->requiresZeroInitialization(); + _S->numArgs = S->getNumArgs(); + for (auto _E : S->arguments()) + { + auto _ES = WalkExpression(_E); + _S->addarguments(_ES); + } + _Expr = _S; + break; + } + case clang::Stmt::LambdaExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::LambdaExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->capture_size = S->capture_size(); + _S->callOperator = static_cast(WalkDeclaration(S->getCallOperator())); + _S->isGenericLambda = S->isGenericLambda(); + _S->body = static_cast(WalkStatement(S->getBody())); + _S->isMutable = S->isMutable(); + _S->hasExplicitParameters = S->hasExplicitParameters(); + _S->hasExplicitResultType = S->hasExplicitResultType(); + for (auto _E : S->capture_inits()) + { + auto _ES = WalkExpression(_E); + _S->addcapture_inits(_ES); + } + _Expr = _S; + break; + } + case clang::Stmt::CXXScalarValueInitExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXScalarValueInitExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _Expr = _S; + break; + } + case clang::Stmt::CXXNewExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXNewExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->operatorNew = static_cast(WalkDeclaration(S->getOperatorNew())); + _S->operatorDelete = static_cast(WalkDeclaration(S->getOperatorDelete())); + _S->allocatedType = GetQualifiedType(S->getAllocatedType()); + _S->isArray = S->isArray(); + _S->numPlacementArgs = S->getNumPlacementArgs(); + _S->isParenTypeId = S->isParenTypeId(); + _S->isGlobalNew = S->isGlobalNew(); + _S->hasInitializer = S->hasInitializer(); + _S->initializationStyle = (CXXNewExpr::InitializationStyle) S->getInitializationStyle(); + _S->constructExpr = static_cast(WalkExpression(S->getConstructExpr())); + for (auto _E : S->placement_arguments()) + { + auto _ES = WalkExpression(_E); + _S->addplacement_arguments(_ES); + } + _Expr = _S; + break; + } + case clang::Stmt::CXXDeleteExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXDeleteExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->isGlobalDelete = S->isGlobalDelete(); + _S->isArrayForm = S->isArrayForm(); + _S->isArrayFormAsWritten = S->isArrayFormAsWritten(); + _S->operatorDelete = static_cast(WalkDeclaration(S->getOperatorDelete())); + _S->destroyedType = GetQualifiedType(S->getDestroyedType()); + _Expr = _S; + break; + } + case clang::Stmt::CXXPseudoDestructorExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXPseudoDestructorExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->base = static_cast(WalkExpression(S->getBase())); + _S->hasQualifier = S->hasQualifier(); + _S->isArrow = S->isArrow(); + _S->destroyedType = GetQualifiedType(S->getDestroyedType()); + _Expr = _S; + break; + } + case clang::Stmt::TypeTraitExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::TypeTraitExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->value = S->getValue(); + _S->numArgs = S->getNumArgs(); + _Expr = _S; + break; + } + case clang::Stmt::ArrayTypeTraitExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::ArrayTypeTraitExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->queriedType = GetQualifiedType(S->getQueriedType()); + _S->value = S->getValue(); + _S->dimensionExpression = static_cast(WalkExpression(S->getDimensionExpression())); + _Expr = _S; + break; + } + case clang::Stmt::ExpressionTraitExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::ExpressionTraitExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->queriedExpression = static_cast(WalkExpression(S->getQueriedExpression())); + _S->value = S->getValue(); + _Expr = _S; + break; + } + case clang::Stmt::UnresolvedLookupExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::UnresolvedLookupExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->numDecls = S->getNumDecls(); + _S->hasTemplateKeyword = S->hasTemplateKeyword(); + _S->hasExplicitTemplateArgs = S->hasExplicitTemplateArgs(); + _S->numTemplateArgs = S->getNumTemplateArgs(); + _S->requiresADL = S->requiresADL(); + _S->isOverloaded = S->isOverloaded(); + _Expr = _S; + break; + } + case clang::Stmt::DependentScopeDeclRefExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::DependentScopeDeclRefExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->hasTemplateKeyword = S->hasTemplateKeyword(); + _S->hasExplicitTemplateArgs = S->hasExplicitTemplateArgs(); + _S->numTemplateArgs = S->getNumTemplateArgs(); + _Expr = _S; + break; + } + case clang::Stmt::ExprWithCleanupsClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::ExprWithCleanups(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->subExpr = static_cast(WalkExpression(S->getSubExpr())); + _S->numObjects = S->getNumObjects(); + _S->cleanupsHaveSideEffects = S->cleanupsHaveSideEffects(); + _Expr = _S; + break; + } + case clang::Stmt::CXXUnresolvedConstructExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXUnresolvedConstructExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->typeAsWritten = GetQualifiedType(S->getTypeAsWritten()); + _S->isListInitialization = S->isListInitialization(); + _S->arg_size = S->arg_size(); + for (auto _E : S->arguments()) + { + auto _ES = WalkExpression(_E); + _S->addarguments(_ES); + } + _Expr = _S; + break; + } + case clang::Stmt::CXXDependentScopeMemberExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXDependentScopeMemberExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->isImplicitAccess = S->isImplicitAccess(); + _S->base = static_cast(WalkExpression(S->getBase())); + _S->baseType = GetQualifiedType(S->getBaseType()); + _S->isArrow = S->isArrow(); + _S->firstQualifierFoundInScope = static_cast(WalkDeclaration(S->getFirstQualifierFoundInScope())); + _S->hasTemplateKeyword = S->hasTemplateKeyword(); + _S->hasExplicitTemplateArgs = S->hasExplicitTemplateArgs(); + _S->numTemplateArgs = S->getNumTemplateArgs(); + _Expr = _S; + break; + } + case clang::Stmt::UnresolvedMemberExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::UnresolvedMemberExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->numDecls = S->getNumDecls(); + _S->hasTemplateKeyword = S->hasTemplateKeyword(); + _S->hasExplicitTemplateArgs = S->hasExplicitTemplateArgs(); + _S->numTemplateArgs = S->getNumTemplateArgs(); + _S->isImplicitAccess = S->isImplicitAccess(); + _S->baseType = GetQualifiedType(S->getBaseType()); + _S->hasUnresolvedUsing = S->hasUnresolvedUsing(); + _S->isArrow = S->isArrow(); + _Expr = _S; + break; + } + case clang::Stmt::CXXNoexceptExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXNoexceptExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->operand = static_cast(WalkExpression(S->getOperand())); + _S->value = S->getValue(); + _Expr = _S; + break; + } + case clang::Stmt::PackExpansionExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::PackExpansionExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _Expr = _S; + break; + } + case clang::Stmt::SizeOfPackExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::SizeOfPackExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->pack = static_cast(WalkDeclaration(S->getPack())); + _S->packLength = S->getPackLength(); + _S->isPartiallySubstituted = S->isPartiallySubstituted(); + _Expr = _S; + break; + } + case clang::Stmt::SubstNonTypeTemplateParmExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::SubstNonTypeTemplateParmExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->replacement = static_cast(WalkExpression(S->getReplacement())); + _Expr = _S; + break; + } + case clang::Stmt::SubstNonTypeTemplateParmPackExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::SubstNonTypeTemplateParmPackExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->argumentPack = WalkTemplateArgument(S->getArgumentPack()); + _Expr = _S; + break; + } + case clang::Stmt::FunctionParmPackExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::FunctionParmPackExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->numExpansions = S->getNumExpansions(); + _Expr = _S; + break; + } + case clang::Stmt::MaterializeTemporaryExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::MaterializeTemporaryExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->temporary = static_cast(WalkStatement(S->getTemporary())); + _S->TemporaryExpr = static_cast(WalkExpression(S->GetTemporaryExpr())); + _S->manglingNumber = S->getManglingNumber(); + _S->isBoundToLvalueReference = S->isBoundToLvalueReference(); + _Expr = _S; + break; + } + case clang::Stmt::CXXFoldExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CXXFoldExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->lHS = static_cast(WalkExpression(S->getLHS())); + _S->rHS = static_cast(WalkExpression(S->getRHS())); + _S->isRightFold = S->isRightFold(); + _S->isLeftFold = S->isLeftFold(); + _S->pattern = static_cast(WalkExpression(S->getPattern())); + _S->init = static_cast(WalkExpression(S->getInit())); + _S->_operator = (BinaryOperatorKind) S->getOperator(); + _Expr = _S; + break; + } + case clang::Stmt::CoawaitExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CoawaitExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->commonExpr = static_cast(WalkExpression(S->getCommonExpr())); + _S->opaqueValue = static_cast(WalkExpression(S->getOpaqueValue())); + _S->readyExpr = static_cast(WalkExpression(S->getReadyExpr())); + _S->suspendExpr = static_cast(WalkExpression(S->getSuspendExpr())); + _S->resumeExpr = static_cast(WalkExpression(S->getResumeExpr())); + _S->isImplicit = S->isImplicit(); + _S->operand = static_cast(WalkExpression(S->getOperand())); + _Expr = _S; + break; + } + case clang::Stmt::DependentCoawaitExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::DependentCoawaitExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->operand = static_cast(WalkExpression(S->getOperand())); + _S->operatorCoawaitLookup = static_cast(WalkExpression(S->getOperatorCoawaitLookup())); + _Expr = _S; + break; + } + case clang::Stmt::CoyieldExprClass: + { + auto S = const_cast(llvm::cast(Expr)); + auto _S = new AST::CoyieldExpr(); + _S->type = GetQualifiedType(S->getType()); + _S->valueDependent = S->isValueDependent(); + _S->typeDependent = S->isTypeDependent(); + _S->instantiationDependent = S->isInstantiationDependent(); + _S->containsUnexpandedParameterPack = S->containsUnexpandedParameterPack(); + _S->isLValue = S->isLValue(); + _S->isRValue = S->isRValue(); + _S->isXValue = S->isXValue(); + _S->isGLValue = S->isGLValue(); + _S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject(); + _S->commonExpr = static_cast(WalkExpression(S->getCommonExpr())); + _S->opaqueValue = static_cast(WalkExpression(S->getOpaqueValue())); + _S->readyExpr = static_cast(WalkExpression(S->getReadyExpr())); + _S->suspendExpr = static_cast(WalkExpression(S->getSuspendExpr())); + _S->resumeExpr = static_cast(WalkExpression(S->getResumeExpr())); + _S->operand = static_cast(WalkExpression(S->getOperand())); + _Expr = _S; + break; + } + default: + printf("Unhandled statement kind: %s\n", Expr->getStmtClassName()); + } + + return _Expr; +} + +} } diff --git a/src/CppParser/ParseStmt.cpp b/src/CppParser/ParseStmt.cpp new file mode 100644 index 00000000..e7d918e0 --- /dev/null +++ b/src/CppParser/ParseStmt.cpp @@ -0,0 +1,464 @@ +// ---------------------------------------------------------------------------- +// +// This is autogenerated code by CppSharp. +// Do not edit this file or all your changes will be lost after re-generation. +// +// ---------------------------------------------------------------------------- + + +#include "AST.h" +#include "Parser.h" +#include +#include + +namespace CppSharp { namespace CppParser { + +AST::Stmt* Parser::WalkStatement(const clang::Stmt* Stmt) +{ + if (Stmt == nullptr) + return nullptr; + + AST::Stmt* _Stmt= 0; + + switch (Stmt->getStmtClass()) + { + case clang::Stmt::DeclStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::DeclStmt(); + _S->isSingleDecl = S->isSingleDecl(); + for (auto _E : S->decls()) + { + auto _ES = WalkDeclaration(_E); + _S->adddecls(_ES); + } + _Stmt = _S; + break; + } + case clang::Stmt::NullStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::NullStmt(); + _S->hasLeadingEmptyMacro = S->hasLeadingEmptyMacro(); + _Stmt = _S; + break; + } + case clang::Stmt::CompoundStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::CompoundStmt(); + _S->body_empty = S->body_empty(); + _S->size = S->size(); + for (auto _E : S->body()) + { + auto _ES = WalkStatement(_E); + _S->addbody(_ES); + } + _Stmt = _S; + break; + } + case clang::Stmt::CaseStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::CaseStmt(); + _S->lHS = static_cast(WalkExpression(S->getLHS())); + _S->rHS = static_cast(WalkExpression(S->getRHS())); + _S->subStmt = static_cast(WalkStatement(S->getSubStmt())); + _S->caseStmtIsGNURange = S->caseStmtIsGNURange(); + _Stmt = _S; + break; + } + case clang::Stmt::DefaultStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::DefaultStmt(); + _S->subStmt = static_cast(WalkStatement(S->getSubStmt())); + _Stmt = _S; + break; + } + case clang::Stmt::LabelStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::LabelStmt(); + _S->subStmt = static_cast(WalkStatement(S->getSubStmt())); + _S->name = S->getName(); + _Stmt = _S; + break; + } + case clang::Stmt::AttributedStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::AttributedStmt(); + _Stmt = _S; + break; + } + case clang::Stmt::IfStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::IfStmt(); + _S->cond = static_cast(WalkExpression(S->getCond())); + _S->then = static_cast(WalkStatement(S->getThen())); + _S->_else = static_cast(WalkStatement(S->getElse())); + _S->init = static_cast(WalkStatement(S->getInit())); + _S->_constexpr = S->isConstexpr(); + _S->hasInitStorage = S->hasInitStorage(); + _S->hasVarStorage = S->hasVarStorage(); + _S->hasElseStorage = S->hasElseStorage(); + _S->isObjCAvailabilityCheck = S->isObjCAvailabilityCheck(); + _Stmt = _S; + break; + } + case clang::Stmt::SwitchStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::SwitchStmt(); + _S->cond = static_cast(WalkExpression(S->getCond())); + _S->body = static_cast(WalkStatement(S->getBody())); + _S->init = static_cast(WalkStatement(S->getInit())); + _S->hasInitStorage = S->hasInitStorage(); + _S->hasVarStorage = S->hasVarStorage(); + _S->isAllEnumCasesCovered = S->isAllEnumCasesCovered(); + _Stmt = _S; + break; + } + case clang::Stmt::WhileStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::WhileStmt(); + _S->cond = static_cast(WalkExpression(S->getCond())); + _S->body = static_cast(WalkStatement(S->getBody())); + _S->hasVarStorage = S->hasVarStorage(); + _Stmt = _S; + break; + } + case clang::Stmt::DoStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::DoStmt(); + _S->cond = static_cast(WalkExpression(S->getCond())); + _S->body = static_cast(WalkStatement(S->getBody())); + _Stmt = _S; + break; + } + case clang::Stmt::ForStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::ForStmt(); + _S->init = static_cast(WalkStatement(S->getInit())); + _S->cond = static_cast(WalkExpression(S->getCond())); + _S->inc = static_cast(WalkExpression(S->getInc())); + _S->body = static_cast(WalkStatement(S->getBody())); + _S->conditionVariableDeclStmt = static_cast(WalkStatement(S->getConditionVariableDeclStmt())); + _Stmt = _S; + break; + } + case clang::Stmt::GotoStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::GotoStmt(); + _Stmt = _S; + break; + } + case clang::Stmt::IndirectGotoStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::IndirectGotoStmt(); + _S->target = static_cast(WalkExpression(S->getTarget())); + _Stmt = _S; + break; + } + case clang::Stmt::ContinueStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::ContinueStmt(); + _Stmt = _S; + break; + } + case clang::Stmt::BreakStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::BreakStmt(); + _Stmt = _S; + break; + } + case clang::Stmt::ReturnStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::ReturnStmt(); + _S->retValue = static_cast(WalkExpression(S->getRetValue())); + _Stmt = _S; + break; + } + case clang::Stmt::GCCAsmStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::GCCAsmStmt(); + _S->simple = S->isSimple(); + _S->_volatile = S->isVolatile(); + _S->numOutputs = S->getNumOutputs(); + _S->numPlusOperands = S->getNumPlusOperands(); + _S->numInputs = S->getNumInputs(); + _S->numClobbers = S->getNumClobbers(); + for (auto _E : S->inputs()) + { + auto _ES = WalkExpression(_E); + _S->addinputs(_ES); + } + for (auto _E : S->outputs()) + { + auto _ES = WalkExpression(_E); + _S->addoutputs(_ES); + } + _Stmt = _S; + break; + } + case clang::Stmt::MSAsmStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::MSAsmStmt(); + _S->simple = S->isSimple(); + _S->_volatile = S->isVolatile(); + _S->numOutputs = S->getNumOutputs(); + _S->numPlusOperands = S->getNumPlusOperands(); + _S->numInputs = S->getNumInputs(); + _S->numClobbers = S->getNumClobbers(); + for (auto _E : S->inputs()) + { + auto _ES = WalkExpression(_E); + _S->addinputs(_ES); + } + for (auto _E : S->outputs()) + { + auto _ES = WalkExpression(_E); + _S->addoutputs(_ES); + } + _S->hasBraces = S->hasBraces(); + _S->numAsmToks = S->getNumAsmToks(); + _S->asmString = S->getAsmString(); + _Stmt = _S; + break; + } + case clang::Stmt::SEHExceptStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::SEHExceptStmt(); + _S->filterExpr = static_cast(WalkExpression(S->getFilterExpr())); + _S->block = static_cast(WalkStatement(S->getBlock())); + _Stmt = _S; + break; + } + case clang::Stmt::SEHFinallyStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::SEHFinallyStmt(); + _S->block = static_cast(WalkStatement(S->getBlock())); + _Stmt = _S; + break; + } + case clang::Stmt::SEHTryStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::SEHTryStmt(); + _S->isCXXTry = S->getIsCXXTry(); + _S->tryBlock = static_cast(WalkStatement(S->getTryBlock())); + _S->handler = static_cast(WalkStatement(S->getHandler())); + _S->exceptHandler = static_cast(WalkStatement(S->getExceptHandler())); + _S->finallyHandler = static_cast(WalkStatement(S->getFinallyHandler())); + _Stmt = _S; + break; + } + case clang::Stmt::SEHLeaveStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::SEHLeaveStmt(); + _Stmt = _S; + break; + } + case clang::Stmt::CapturedStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::CapturedStmt(); + _S->capture_size = S->capture_size(); + for (auto _E : S->capture_inits()) + { + auto _ES = WalkExpression(_E); + _S->addcapture_inits(_ES); + } + _Stmt = _S; + break; + } + case clang::Stmt::CXXCatchStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::CXXCatchStmt(); + _S->caughtType = GetQualifiedType(S->getCaughtType()); + _S->handlerBlock = static_cast(WalkStatement(S->getHandlerBlock())); + _Stmt = _S; + break; + } + case clang::Stmt::CXXTryStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::CXXTryStmt(); + _S->numHandlers = S->getNumHandlers(); + _Stmt = _S; + break; + } + case clang::Stmt::CXXForRangeStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::CXXForRangeStmt(); + _S->init = static_cast(WalkStatement(S->getInit())); + _S->rangeInit = static_cast(WalkExpression(S->getRangeInit())); + _S->cond = static_cast(WalkExpression(S->getCond())); + _S->inc = static_cast(WalkExpression(S->getInc())); + _S->body = static_cast(WalkStatement(S->getBody())); + _Stmt = _S; + break; + } + case clang::Stmt::MSDependentExistsStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::MSDependentExistsStmt(); + _S->isIfExists = S->isIfExists(); + _S->isIfNotExists = S->isIfNotExists(); + _S->subStmt = static_cast(WalkStatement(S->getSubStmt())); + _Stmt = _S; + break; + } + case clang::Stmt::CoroutineBodyStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::CoroutineBodyStmt(); + _S->hasDependentPromiseType = S->hasDependentPromiseType(); + _S->body = static_cast(WalkStatement(S->getBody())); + _S->promiseDeclStmt = static_cast(WalkStatement(S->getPromiseDeclStmt())); + _S->initSuspendStmt = static_cast(WalkStatement(S->getInitSuspendStmt())); + _S->finalSuspendStmt = static_cast(WalkStatement(S->getFinalSuspendStmt())); + _S->exceptionHandler = static_cast(WalkStatement(S->getExceptionHandler())); + _S->fallthroughHandler = static_cast(WalkStatement(S->getFallthroughHandler())); + _S->allocate = static_cast(WalkExpression(S->getAllocate())); + _S->deallocate = static_cast(WalkExpression(S->getDeallocate())); + _S->returnValueInit = static_cast(WalkExpression(S->getReturnValueInit())); + _S->resultDecl = static_cast(WalkStatement(S->getResultDecl())); + _S->returnStmt = static_cast(WalkStatement(S->getReturnStmt())); + _S->returnStmtOnAllocFailure = static_cast(WalkStatement(S->getReturnStmtOnAllocFailure())); + _Stmt = _S; + break; + } + case clang::Stmt::CoreturnStmtClass: + { + auto S = const_cast(llvm::cast(Stmt)); + auto _S = new AST::CoreturnStmt(); + _S->isImplicit = S->isImplicit(); + _S->operand = static_cast(WalkExpression(S->getOperand())); + _S->promiseCall = static_cast(WalkExpression(S->getPromiseCall())); + _Stmt = _S; + break; + } + case clang::Stmt::ConstantExprClass: + case clang::Stmt::OpaqueValueExprClass: + case clang::Stmt::DeclRefExprClass: + case clang::Stmt::IntegerLiteralClass: + case clang::Stmt::FixedPointLiteralClass: + case clang::Stmt::CharacterLiteralClass: + case clang::Stmt::FloatingLiteralClass: + case clang::Stmt::ImaginaryLiteralClass: + case clang::Stmt::StringLiteralClass: + case clang::Stmt::PredefinedExprClass: + case clang::Stmt::ParenExprClass: + case clang::Stmt::UnaryOperatorClass: + case clang::Stmt::OffsetOfExprClass: + case clang::Stmt::UnaryExprOrTypeTraitExprClass: + case clang::Stmt::ArraySubscriptExprClass: + case clang::Stmt::CallExprClass: + case clang::Stmt::MemberExprClass: + case clang::Stmt::CompoundLiteralExprClass: + case clang::Stmt::ImplicitCastExprClass: + case clang::Stmt::CStyleCastExprClass: + case clang::Stmt::BinaryOperatorClass: + case clang::Stmt::CompoundAssignOperatorClass: + case clang::Stmt::ConditionalOperatorClass: + case clang::Stmt::BinaryConditionalOperatorClass: + case clang::Stmt::AddrLabelExprClass: + case clang::Stmt::StmtExprClass: + case clang::Stmt::ShuffleVectorExprClass: + case clang::Stmt::ConvertVectorExprClass: + case clang::Stmt::ChooseExprClass: + case clang::Stmt::GNUNullExprClass: + case clang::Stmt::VAArgExprClass: + case clang::Stmt::InitListExprClass: + case clang::Stmt::DesignatedInitExprClass: + case clang::Stmt::NoInitExprClass: + case clang::Stmt::DesignatedInitUpdateExprClass: + case clang::Stmt::ArrayInitLoopExprClass: + case clang::Stmt::ArrayInitIndexExprClass: + case clang::Stmt::ImplicitValueInitExprClass: + case clang::Stmt::ParenListExprClass: + case clang::Stmt::GenericSelectionExprClass: + case clang::Stmt::ExtVectorElementExprClass: + case clang::Stmt::BlockExprClass: + case clang::Stmt::AsTypeExprClass: + case clang::Stmt::PseudoObjectExprClass: + case clang::Stmt::AtomicExprClass: + case clang::Stmt::TypoExprClass: + case clang::Stmt::CXXOperatorCallExprClass: + case clang::Stmt::CXXMemberCallExprClass: + case clang::Stmt::CUDAKernelCallExprClass: + case clang::Stmt::CXXStaticCastExprClass: + case clang::Stmt::CXXDynamicCastExprClass: + case clang::Stmt::CXXReinterpretCastExprClass: + case clang::Stmt::CXXConstCastExprClass: + case clang::Stmt::UserDefinedLiteralClass: + case clang::Stmt::CXXBoolLiteralExprClass: + case clang::Stmt::CXXNullPtrLiteralExprClass: + case clang::Stmt::CXXStdInitializerListExprClass: + case clang::Stmt::CXXTypeidExprClass: + case clang::Stmt::MSPropertyRefExprClass: + case clang::Stmt::MSPropertySubscriptExprClass: + case clang::Stmt::CXXUuidofExprClass: + case clang::Stmt::CXXThisExprClass: + case clang::Stmt::CXXThrowExprClass: + case clang::Stmt::CXXDefaultArgExprClass: + case clang::Stmt::CXXDefaultInitExprClass: + case clang::Stmt::CXXBindTemporaryExprClass: + case clang::Stmt::CXXConstructExprClass: + case clang::Stmt::CXXInheritedCtorInitExprClass: + case clang::Stmt::CXXFunctionalCastExprClass: + case clang::Stmt::CXXTemporaryObjectExprClass: + case clang::Stmt::LambdaExprClass: + case clang::Stmt::CXXScalarValueInitExprClass: + case clang::Stmt::CXXNewExprClass: + case clang::Stmt::CXXDeleteExprClass: + case clang::Stmt::CXXPseudoDestructorExprClass: + case clang::Stmt::TypeTraitExprClass: + case clang::Stmt::ArrayTypeTraitExprClass: + case clang::Stmt::ExpressionTraitExprClass: + case clang::Stmt::UnresolvedLookupExprClass: + case clang::Stmt::DependentScopeDeclRefExprClass: + case clang::Stmt::ExprWithCleanupsClass: + case clang::Stmt::CXXUnresolvedConstructExprClass: + case clang::Stmt::CXXDependentScopeMemberExprClass: + case clang::Stmt::UnresolvedMemberExprClass: + case clang::Stmt::CXXNoexceptExprClass: + case clang::Stmt::PackExpansionExprClass: + case clang::Stmt::SizeOfPackExprClass: + case clang::Stmt::SubstNonTypeTemplateParmExprClass: + case clang::Stmt::SubstNonTypeTemplateParmPackExprClass: + case clang::Stmt::FunctionParmPackExprClass: + case clang::Stmt::MaterializeTemporaryExprClass: + case clang::Stmt::CXXFoldExprClass: + case clang::Stmt::CoawaitExprClass: + case clang::Stmt::DependentCoawaitExprClass: + case clang::Stmt::CoyieldExprClass: + { + return WalkExpression(llvm::cast(Stmt)); + } + default: + printf("Unhandled statement kind: %s\n", Stmt->getStmtClassName()); + } + + return _Stmt; +} + +} } diff --git a/src/CppParser/Parser.cpp b/src/CppParser/Parser.cpp index d7d20fe2..54fb648c 100644 --- a/src/CppParser/Parser.cpp +++ b/src/CppParser/Parser.cpp @@ -1439,7 +1439,7 @@ Parser::WalkTemplateArgumentList(const clang::TemplateArgumentList* TAL, //-----------------------------------// CppSharp::CppParser::TemplateArgument -Parser::WalkTemplateArgument(const clang::TemplateArgument& TA, clang::TemplateArgumentLoc* ArgLoc) +Parser::WalkTemplateArgument(clang::TemplateArgument TA, clang::TemplateArgumentLoc* ArgLoc) { auto Arg = CppSharp::CppParser::TemplateArgument(); @@ -3563,7 +3563,7 @@ AST::ExpressionObsolete* Parser::WalkExpressionObsolete(const clang::Expr* Expr) if (ConstructorExpr->getNumArgs() == 1) { auto Arg = ConstructorExpr->getArg(0); - auto TemporaryExpr = dyn_cast(Arg); + auto TemporaryExpr = dyn_cast(Arg); if (TemporaryExpr) { auto SubTemporaryExpr = TemporaryExpr->GetTemporaryExpr(); @@ -3593,6 +3593,7 @@ AST::ExpressionObsolete* Parser::WalkExpressionObsolete(const clang::Expr* Expr) default: break; } + clang::Expr::EvalResult integer; if (Expr->getStmtClass() != clang::Stmt::CharacterLiteralClass && Expr->getStmtClass() != clang::Stmt::CXXBoolLiteralExprClass && diff --git a/src/CppParser/Parser.h b/src/CppParser/Parser.h index d9c8f82c..5cea9984 100644 --- a/src/CppParser/Parser.h +++ b/src/CppParser/Parser.h @@ -94,7 +94,7 @@ private: RawComment* WalkRawComment(const clang::RawComment* RC); Type* WalkType(clang::QualType QualType, const clang::TypeLoc* TL = 0, bool DesugarType = false); - TemplateArgument WalkTemplateArgument(const clang::TemplateArgument& TA, clang::TemplateArgumentLoc* ArgLoc); + TemplateArgument WalkTemplateArgument(clang::TemplateArgument TA, clang::TemplateArgumentLoc* ArgLoc = 0); TemplateTemplateParameter* WalkTemplateTemplateParameter(const clang::TemplateTemplateParmDecl* TTP); TypeTemplateParameter* WalkTypeTemplateParameter(const clang::TemplateTypeParmDecl* TTPD); NonTypeTemplateParameter* WalkNonTypeTemplateParameter(const clang::NonTypeTemplateParmDecl* TTPD); @@ -111,7 +111,7 @@ private: std::vector WalkTemplateArgumentList(const clang::TemplateArgumentList* TAL, TypeLoc* TSTL); std::vector WalkTemplateArgumentList(const clang::TemplateArgumentList* TAL, const clang::ASTTemplateArgumentListInfo* TSTL); void WalkVTable(const clang::CXXRecordDecl* RD, Class* C); - QualifiedType GetQualifiedType(const clang::QualType& qual, const clang::TypeLoc* TL = 0); + QualifiedType GetQualifiedType(clang::QualType qual, const clang::TypeLoc* TL = 0); void ReadClassLayout(Class* Class, const clang::RecordDecl* RD, clang::CharUnits Offset, bool IncludeVirtualBases); LayoutField WalkVTablePointer(Class* Class, const clang::CharUnits& Offset, const std::string& prefix); VTableLayout WalkVTableLayout(const clang::VTableLayout& VTLayout); @@ -119,6 +119,8 @@ private: PreprocessedEntity* WalkPreprocessedEntity(Declaration* Decl, clang::PreprocessedEntity* PPEntity); AST::ExpressionObsolete* WalkExpressionObsolete(const clang::Expr* Expression); + AST::Stmt* WalkStatement(const clang::Stmt* Stmt); + AST::Expr* WalkExpression(const clang::Expr* Stmt); std::string GetStringFromStatement(const clang::Stmt* Statement); std::string GetFunctionBody(const clang::FunctionDecl* FD); diff --git a/src/CppParser/Stmt.cpp b/src/CppParser/Stmt.cpp new file mode 100644 index 00000000..5ffe5032 --- /dev/null +++ b/src/CppParser/Stmt.cpp @@ -0,0 +1,353 @@ +// ---------------------------------------------------------------------------- +// +// This is autogenerated code by CppSharp. +// Do not edit this file or all your changes will be lost after re-generation. +// +// ---------------------------------------------------------------------------- + + +#include "Sources.h" +#include "Stmt.h" + +namespace CppSharp { namespace CppParser { namespace AST { + +Stmt::Stmt() + : stmtClass(StmtClass::NoStmt) + , sourceRange(SourceRange()) + , endLoc(SourceLocation()) +{ +} + +Stmt::Stmt(StmtClass klass) + : stmtClass(klass) + , sourceRange(SourceRange()) + , endLoc(SourceLocation()) +{ +} + +DeclStmt::DeclStmt() + : Stmt(StmtClass::DeclStmt) + , isSingleDecl(0) +{ +} + +DEF_VECTOR(DeclStmt, Declaration*, decls) + +NullStmt::NullStmt() + : Stmt(StmtClass::NullStmt) + , semiLoc(SourceLocation()) + , hasLeadingEmptyMacro(0) +{ +} + +CompoundStmt::CompoundStmt() + : Stmt(StmtClass::CompoundStmt) + , body_empty(0) + , size(0) + , lBracLoc(SourceLocation()) + , rBracLoc(SourceLocation()) +{ +} + +DEF_VECTOR(CompoundStmt, Stmt*, body) + +SwitchCase::SwitchCase() + : Stmt(StmtClass::NoStmt) + , keywordLoc(SourceLocation()) + , colonLoc(SourceLocation()) +{ +} + +SwitchCase::SwitchCase(StmtClass klass) + : Stmt(klass) + , keywordLoc(SourceLocation()) + , colonLoc(SourceLocation()) +{ +} + +CaseStmt::CaseStmt() + : SwitchCase(StmtClass::CaseStmt) + , caseLoc(SourceLocation()) + , ellipsisLoc(SourceLocation()) + , lHS(nullptr) + , rHS(nullptr) + , subStmt(nullptr) + , caseStmtIsGNURange(0) +{ +} + +DefaultStmt::DefaultStmt() + : SwitchCase(StmtClass::DefaultStmt) + , subStmt(nullptr) + , defaultLoc(SourceLocation()) +{ +} + +LabelStmt::LabelStmt() + : Stmt(StmtClass::LabelStmt) + , identLoc(SourceLocation()) + , subStmt(nullptr) + , name(nullptr) +{ +} + +AttributedStmt::AttributedStmt() + : Stmt(StmtClass::AttributedStmt) + , attrLoc(SourceLocation()) +{ +} + +IfStmt::IfStmt() + : Stmt(StmtClass::IfStmt) + , cond(nullptr) + , then(nullptr) + , _else(nullptr) + , init(nullptr) + , ifLoc(SourceLocation()) + , elseLoc(SourceLocation()) + , _constexpr(0) + , hasInitStorage(0) + , hasVarStorage(0) + , hasElseStorage(0) + , isObjCAvailabilityCheck(0) +{ +} + +SwitchStmt::SwitchStmt() + : Stmt(StmtClass::SwitchStmt) + , cond(nullptr) + , body(nullptr) + , init(nullptr) + , switchLoc(SourceLocation()) + , hasInitStorage(0) + , hasVarStorage(0) + , isAllEnumCasesCovered(0) +{ +} + +WhileStmt::WhileStmt() + : Stmt(StmtClass::WhileStmt) + , cond(nullptr) + , body(nullptr) + , whileLoc(SourceLocation()) + , hasVarStorage(0) +{ +} + +DoStmt::DoStmt() + : Stmt(StmtClass::DoStmt) + , cond(nullptr) + , body(nullptr) + , doLoc(SourceLocation()) + , whileLoc(SourceLocation()) + , rParenLoc(SourceLocation()) +{ +} + +ForStmt::ForStmt() + : Stmt(StmtClass::ForStmt) + , init(nullptr) + , cond(nullptr) + , inc(nullptr) + , body(nullptr) + , forLoc(SourceLocation()) + , lParenLoc(SourceLocation()) + , rParenLoc(SourceLocation()) + , conditionVariableDeclStmt(nullptr) +{ +} + +GotoStmt::GotoStmt() + : Stmt(StmtClass::GotoStmt) + , gotoLoc(SourceLocation()) + , labelLoc(SourceLocation()) +{ +} + +IndirectGotoStmt::IndirectGotoStmt() + : Stmt(StmtClass::IndirectGotoStmt) + , gotoLoc(SourceLocation()) + , starLoc(SourceLocation()) + , target(nullptr) +{ +} + +ContinueStmt::ContinueStmt() + : Stmt(StmtClass::ContinueStmt) + , continueLoc(SourceLocation()) +{ +} + +BreakStmt::BreakStmt() + : Stmt(StmtClass::BreakStmt) + , breakLoc(SourceLocation()) +{ +} + +ReturnStmt::ReturnStmt() + : Stmt(StmtClass::ReturnStmt) + , retValue(nullptr) + , returnLoc(SourceLocation()) +{ +} + +AsmStmt::AsmStmt() + : Stmt(StmtClass::NoStmt) + , asmLoc(SourceLocation()) + , simple(0) + , _volatile(0) + , numOutputs(0) + , numPlusOperands(0) + , numInputs(0) + , numClobbers(0) +{ +} + +AsmStmt::AsmStmt(StmtClass klass) + : Stmt(klass) + , asmLoc(SourceLocation()) + , simple(0) + , _volatile(0) + , numOutputs(0) + , numPlusOperands(0) + , numInputs(0) + , numClobbers(0) +{ +} + +DEF_VECTOR(AsmStmt, Expr*, inputs) + +DEF_VECTOR(AsmStmt, Expr*, outputs) + +GCCAsmStmt::AsmStringPiece::AsmStringPiece() +{ +} + +GCCAsmStmt::GCCAsmStmt() + : AsmStmt(StmtClass::GCCAsmStmt) + , rParenLoc(SourceLocation()) +{ +} + +MSAsmStmt::MSAsmStmt() + : AsmStmt(StmtClass::MSAsmStmt) + , lBraceLoc(SourceLocation()) + , hasBraces(0) + , numAsmToks(0) +{ +} + +SEHExceptStmt::SEHExceptStmt() + : Stmt(StmtClass::SEHExceptStmt) + , exceptLoc(SourceLocation()) + , filterExpr(nullptr) + , block(nullptr) +{ +} + +SEHFinallyStmt::SEHFinallyStmt() + : Stmt(StmtClass::SEHFinallyStmt) + , finallyLoc(SourceLocation()) + , block(nullptr) +{ +} + +SEHTryStmt::SEHTryStmt() + : Stmt(StmtClass::SEHTryStmt) + , tryLoc(SourceLocation()) + , isCXXTry(0) + , tryBlock(nullptr) + , handler(nullptr) + , exceptHandler(nullptr) + , finallyHandler(nullptr) +{ +} + +SEHLeaveStmt::SEHLeaveStmt() + : Stmt(StmtClass::SEHLeaveStmt) + , leaveLoc(SourceLocation()) +{ +} + +CapturedStmt::Capture::Capture() +{ +} + +CapturedStmt::CapturedStmt() + : Stmt(StmtClass::CapturedStmt) + , capture_size(0) +{ +} + +DEF_VECTOR(CapturedStmt, Expr*, capture_inits) + +CXXCatchStmt::CXXCatchStmt() + : Stmt(StmtClass::CXXCatchStmt) + , catchLoc(SourceLocation()) + , caughtType(QualifiedType()) + , handlerBlock(nullptr) +{ +} + +CXXTryStmt::CXXTryStmt() + : Stmt(StmtClass::CXXTryStmt) + , tryLoc(SourceLocation()) + , numHandlers(0) +{ +} + +CXXForRangeStmt::CXXForRangeStmt() + : Stmt(StmtClass::CXXForRangeStmt) + , init(nullptr) + , rangeInit(nullptr) + , cond(nullptr) + , inc(nullptr) + , body(nullptr) + , forLoc(SourceLocation()) + , coawaitLoc(SourceLocation()) + , colonLoc(SourceLocation()) + , rParenLoc(SourceLocation()) +{ +} + +MSDependentExistsStmt::MSDependentExistsStmt() + : Stmt(StmtClass::MSDependentExistsStmt) + , keywordLoc(SourceLocation()) + , isIfExists(0) + , isIfNotExists(0) + , subStmt(nullptr) +{ +} + +CoroutineBodyStmt::CtorArgs::CtorArgs() +{ +} + +CoroutineBodyStmt::CoroutineBodyStmt() + : Stmt(StmtClass::CoroutineBodyStmt) + , hasDependentPromiseType(0) + , body(nullptr) + , promiseDeclStmt(nullptr) + , initSuspendStmt(nullptr) + , finalSuspendStmt(nullptr) + , exceptionHandler(nullptr) + , fallthroughHandler(nullptr) + , allocate(nullptr) + , deallocate(nullptr) + , returnValueInit(nullptr) + , resultDecl(nullptr) + , returnStmt(nullptr) + , returnStmtOnAllocFailure(nullptr) +{ +} + +CoreturnStmt::CoreturnStmt() + : Stmt(StmtClass::CoreturnStmt) + , isImplicit(0) + , keywordLoc(SourceLocation()) + , operand(nullptr) + , promiseCall(nullptr) +{ +} + +} } } diff --git a/src/CppParser/Stmt.h b/src/CppParser/Stmt.h index 4f9aed09..82de8d5e 100644 --- a/src/CppParser/Stmt.h +++ b/src/CppParser/Stmt.h @@ -7,15 +7,19 @@ #pragma once +#include "Sources.h" +#include "Types.h" + namespace CppSharp { namespace CppParser { namespace AST { -enum class StmtKind +class Expr; +class Declaration; + +enum class StmtClass { NoStmt = 0, GCCAsmStmt = 1, MSAsmStmt = 2, - firstAsmStmtConstant = 1, - lastAsmStmtConstant = 2, AttributedStmt = 3, BreakStmt = 4, CXXCatchStmt = 5, @@ -30,8 +34,6 @@ enum class StmtKind DoStmt = 14, BinaryConditionalOperator = 15, ConditionalOperator = 16, - firstAbstractConditionalOperatorConstant = 15, - lastAbstractConditionalOperatorConstant = 16, AddrLabelExpr = 17, ArrayInitIndexExpr = 18, ArrayInitLoopExpr = 19, @@ -41,15 +43,11 @@ enum class StmtKind AtomicExpr = 23, BinaryOperator = 24, CompoundAssignOperator = 25, - firstBinaryOperatorConstant = 24, - lastBinaryOperatorConstant = 25, BlockExpr = 26, CXXBindTemporaryExpr = 27, CXXBoolLiteralExpr = 28, CXXConstructExpr = 29, CXXTemporaryObjectExpr = 30, - firstCXXConstructExprConstant = 29, - lastCXXConstructExprConstant = 30, CXXDefaultArgExpr = 31, CXXDefaultInitExpr = 32, CXXDeleteExpr = 33, @@ -72,30 +70,19 @@ enum class StmtKind CXXMemberCallExpr = 50, CXXOperatorCallExpr = 51, UserDefinedLiteral = 52, - firstCallExprConstant = 48, - lastCallExprConstant = 52, CStyleCastExpr = 53, CXXFunctionalCastExpr = 54, CXXConstCastExpr = 55, CXXDynamicCastExpr = 56, CXXReinterpretCastExpr = 57, CXXStaticCastExpr = 58, - firstCXXNamedCastExprConstant = 55, - lastCXXNamedCastExprConstant = 58, - ObjCBridgedCastExpr = 59, - firstExplicitCastExprConstant = 53, - lastExplicitCastExprConstant = 59, ImplicitCastExpr = 60, - firstCastExprConstant = 53, - lastCastExprConstant = 60, CharacterLiteral = 61, ChooseExpr = 62, CompoundLiteralExpr = 63, ConvertVectorExpr = 64, CoawaitExpr = 65, CoyieldExpr = 66, - firstCoroutineSuspendExprConstant = 65, - lastCoroutineSuspendExprConstant = 66, DeclRefExpr = 67, DependentCoawaitExpr = 68, DependentScopeDeclRefExpr = 69, @@ -107,8 +94,6 @@ enum class StmtKind FloatingLiteral = 75, ConstantExpr = 76, ExprWithCleanups = 77, - firstFullExprConstant = 76, - lastFullExprConstant = 77, FunctionParmPackExpr = 78, GNUNullExpr = 79, GenericSelectionExpr = 80, @@ -122,28 +107,10 @@ enum class StmtKind MaterializeTemporaryExpr = 88, MemberExpr = 89, NoInitExpr = 90, - OMPArraySectionExpr = 91, - ObjCArrayLiteral = 92, - ObjCAvailabilityCheckExpr = 93, - ObjCBoolLiteralExpr = 94, - ObjCBoxedExpr = 95, - ObjCDictionaryLiteral = 96, - ObjCEncodeExpr = 97, - ObjCIndirectCopyRestoreExpr = 98, - ObjCIsaExpr = 99, - ObjCIvarRefExpr = 100, - ObjCMessageExpr = 101, - ObjCPropertyRefExpr = 102, - ObjCProtocolExpr = 103, - ObjCSelectorExpr = 104, - ObjCStringLiteral = 105, - ObjCSubscriptRefExpr = 106, OffsetOfExpr = 107, OpaqueValueExpr = 108, UnresolvedLookupExpr = 109, UnresolvedMemberExpr = 110, - firstOverloadExprConstant = 109, - lastOverloadExprConstant = 110, PackExpansionExpr = 111, ParenExpr = 112, ParenListExpr = 113, @@ -160,8 +127,6 @@ enum class StmtKind UnaryExprOrTypeTraitExpr = 124, UnaryOperator = 125, VAArgExpr = 126, - firstExprConstant = 15, - lastExprConstant = 126, ForStmt = 127, GotoStmt = 128, IfStmt = 129, @@ -169,64 +134,6 @@ enum class StmtKind LabelStmt = 131, MSDependentExistsStmt = 132, NullStmt = 133, - OMPAtomicDirective = 134, - OMPBarrierDirective = 135, - OMPCancelDirective = 136, - OMPCancellationPointDirective = 137, - OMPCriticalDirective = 138, - OMPFlushDirective = 139, - OMPDistributeDirective = 140, - OMPDistributeParallelForDirective = 141, - OMPDistributeParallelForSimdDirective = 142, - OMPDistributeSimdDirective = 143, - OMPForDirective = 144, - OMPForSimdDirective = 145, - OMPParallelForDirective = 146, - OMPParallelForSimdDirective = 147, - OMPSimdDirective = 148, - OMPTargetParallelForSimdDirective = 149, - OMPTargetSimdDirective = 150, - OMPTargetTeamsDistributeDirective = 151, - OMPTargetTeamsDistributeParallelForDirective = 152, - OMPTargetTeamsDistributeParallelForSimdDirective = 153, - OMPTargetTeamsDistributeSimdDirective = 154, - OMPTaskLoopDirective = 155, - OMPTaskLoopSimdDirective = 156, - OMPTeamsDistributeDirective = 157, - OMPTeamsDistributeParallelForDirective = 158, - OMPTeamsDistributeParallelForSimdDirective = 159, - OMPTeamsDistributeSimdDirective = 160, - firstOMPLoopDirectiveConstant = 140, - lastOMPLoopDirectiveConstant = 160, - OMPMasterDirective = 161, - OMPOrderedDirective = 162, - OMPParallelDirective = 163, - OMPParallelSectionsDirective = 164, - OMPSectionDirective = 165, - OMPSectionsDirective = 166, - OMPSingleDirective = 167, - OMPTargetDataDirective = 168, - OMPTargetDirective = 169, - OMPTargetEnterDataDirective = 170, - OMPTargetExitDataDirective = 171, - OMPTargetParallelDirective = 172, - OMPTargetParallelForDirective = 173, - OMPTargetTeamsDirective = 174, - OMPTargetUpdateDirective = 175, - OMPTaskDirective = 176, - OMPTaskgroupDirective = 177, - OMPTaskwaitDirective = 178, - OMPTaskyieldDirective = 179, - OMPTeamsDirective = 180, - firstOMPExecutableDirectiveConstant = 134, - lastOMPExecutableDirectiveConstant = 180, - ObjCAtCatchStmt = 181, - ObjCAtFinallyStmt = 182, - ObjCAtSynchronizedStmt = 183, - ObjCAtThrowStmt = 184, - ObjCAtTryStmt = 185, - ObjCAutoreleasePoolStmt = 186, - ObjCForCollectionStmt = 187, ReturnStmt = 188, SEHExceptStmt = 189, SEHFinallyStmt = 190, @@ -234,139 +141,412 @@ enum class StmtKind SEHTryStmt = 192, CaseStmt = 193, DefaultStmt = 194, - firstSwitchCaseConstant = 193, - lastSwitchCaseConstant = 194, SwitchStmt = 195, WhileStmt = 196, - firstStmtConstant = 1, - lastStmtConstant = 196 + }; -class Stmt +class CS_API Stmt { +public: + Stmt(); + Stmt(StmtClass klass); + StmtClass stmtClass; + SourceRange sourceRange; + SourceLocation endLoc; }; -class DeclStmt : public Stmt +class CS_API DeclStmt : public Stmt { +public: + DeclStmt(); + VECTOR(Declaration*, decls) + bool isSingleDecl; }; -class NullStmt : public Stmt +class CS_API NullStmt : public Stmt { +public: + NullStmt(); + SourceLocation semiLoc; + bool hasLeadingEmptyMacro; }; -class CompoundStmt : public Stmt +class CS_API CompoundStmt : public Stmt { +public: + CompoundStmt(); + VECTOR(Stmt*, body) + bool body_empty; + unsigned int size; + SourceLocation lBracLoc; + SourceLocation rBracLoc; }; -class SwitchCase : public Stmt +class CS_API SwitchCase : public Stmt { +public: + SwitchCase(); + SwitchCase(StmtClass klass); + SourceLocation keywordLoc; + SourceLocation colonLoc; }; -class CaseStmt : public SwitchCase +class CS_API CaseStmt : public SwitchCase { +public: + CaseStmt(); + SourceLocation caseLoc; + SourceLocation ellipsisLoc; + Expr* lHS; + Expr* rHS; + Stmt* subStmt; + bool caseStmtIsGNURange; }; -class DefaultStmt : public SwitchCase +class CS_API DefaultStmt : public SwitchCase { +public: + DefaultStmt(); + Stmt* subStmt; + SourceLocation defaultLoc; }; -class LabelStmt : public Stmt +class CS_API LabelStmt : public Stmt { +public: + LabelStmt(); + SourceLocation identLoc; + Stmt* subStmt; + const char* name; }; -class AttributedStmt : public Stmt +class CS_API AttributedStmt : public Stmt { +public: + AttributedStmt(); + SourceLocation attrLoc; }; -class IfStmt : public Stmt +class CS_API IfStmt : public Stmt { +public: + IfStmt(); + Expr* cond; + Stmt* then; + Stmt* _else; + Stmt* init; + SourceLocation ifLoc; + SourceLocation elseLoc; + bool _constexpr; + bool hasInitStorage; + bool hasVarStorage; + bool hasElseStorage; + bool isObjCAvailabilityCheck; }; -class SwitchStmt : public Stmt +class CS_API SwitchStmt : public Stmt { +public: + SwitchStmt(); + Expr* cond; + Stmt* body; + Stmt* init; + SourceLocation switchLoc; + bool hasInitStorage; + bool hasVarStorage; + bool isAllEnumCasesCovered; }; -class WhileStmt : public Stmt +class CS_API WhileStmt : public Stmt { +public: + WhileStmt(); + Expr* cond; + Stmt* body; + SourceLocation whileLoc; + bool hasVarStorage; }; -class DoStmt : public Stmt +class CS_API DoStmt : public Stmt { +public: + DoStmt(); + Expr* cond; + Stmt* body; + SourceLocation doLoc; + SourceLocation whileLoc; + SourceLocation rParenLoc; }; -class ForStmt : public Stmt +class CS_API ForStmt : public Stmt { +public: + ForStmt(); + Stmt* init; + Expr* cond; + Expr* inc; + Stmt* body; + SourceLocation forLoc; + SourceLocation lParenLoc; + SourceLocation rParenLoc; + DeclStmt* conditionVariableDeclStmt; }; -class GotoStmt : public Stmt +class CS_API GotoStmt : public Stmt { +public: + GotoStmt(); + SourceLocation gotoLoc; + SourceLocation labelLoc; }; -class IndirectGotoStmt : public Stmt +class CS_API IndirectGotoStmt : public Stmt { +public: + IndirectGotoStmt(); + SourceLocation gotoLoc; + SourceLocation starLoc; + Expr* target; }; -class ContinueStmt : public Stmt +class CS_API ContinueStmt : public Stmt { +public: + ContinueStmt(); + SourceLocation continueLoc; }; -class BreakStmt : public Stmt +class CS_API BreakStmt : public Stmt { +public: + BreakStmt(); + SourceLocation breakLoc; }; -class ReturnStmt : public Stmt +class CS_API ReturnStmt : public Stmt { +public: + ReturnStmt(); + Expr* retValue; + SourceLocation returnLoc; }; -class AsmStmt : public Stmt +class CS_API AsmStmt : public Stmt { +public: + AsmStmt(); + AsmStmt(StmtClass klass); + VECTOR(Expr*, inputs) + VECTOR(Expr*, outputs) + SourceLocation asmLoc; + bool simple; + bool _volatile; + unsigned int numOutputs; + unsigned int numPlusOperands; + unsigned int numInputs; + unsigned int numClobbers; }; -class GCCAsmStmt : public AsmStmt +class StringLiteral; + +class CS_API GCCAsmStmt : public AsmStmt { - class AsmStringPiece +public: + class CS_API AsmStringPiece { + public: enum class Kind { String = 0, Operand = 1 }; + + AsmStringPiece(); + bool isString; + bool isOperand; + std::string string; + unsigned int operandNo; + char modifier; }; + + GCCAsmStmt(); + SourceLocation rParenLoc; }; -class MSAsmStmt : public AsmStmt +class CS_API MSAsmStmt : public AsmStmt { +public: + MSAsmStmt(); + SourceLocation lBraceLoc; + bool hasBraces; + unsigned int numAsmToks; + std::string asmString; }; -class SEHExceptStmt : public Stmt +class CS_API SEHExceptStmt : public Stmt { +public: + SEHExceptStmt(); + SourceLocation exceptLoc; + Expr* filterExpr; + CompoundStmt* block; }; -class SEHFinallyStmt : public Stmt +class CS_API SEHFinallyStmt : public Stmt { +public: + SEHFinallyStmt(); + SourceLocation finallyLoc; + CompoundStmt* block; }; -class SEHTryStmt : public Stmt +class CS_API SEHTryStmt : public Stmt { +public: + SEHTryStmt(); + SourceLocation tryLoc; + bool isCXXTry; + CompoundStmt* tryBlock; + Stmt* handler; + SEHExceptStmt* exceptHandler; + SEHFinallyStmt* finallyHandler; }; -class SEHLeaveStmt : public Stmt +class CS_API SEHLeaveStmt : public Stmt { +public: + SEHLeaveStmt(); + SourceLocation leaveLoc; }; -class CapturedStmt : public Stmt +class CS_API CapturedStmt : public Stmt { +public: enum class VariableCaptureKind { - VCK_This = 0, - VCK_ByRef = 1, - VCK_ByCopy = 2, - VCK_VLAType = 3 + This = 0, + ByRef = 1, + ByCopy = 2, + VLAType = 3 + }; + + class CS_API Capture + { + public: + Capture(); + VariableCaptureKind captureKind; + SourceLocation location; + bool capturesThis; + bool capturesVariable; + bool capturesVariableByCopy; + bool capturesVariableArrayType; + }; + + CapturedStmt(); + VECTOR(Expr*, capture_inits) + unsigned int capture_size; +}; + +class CS_API CXXCatchStmt : public Stmt +{ +public: + CXXCatchStmt(); + SourceLocation catchLoc; + QualifiedType caughtType; + Stmt* handlerBlock; +}; + +class CS_API CXXTryStmt : public Stmt +{ +public: + CXXTryStmt(); + SourceLocation tryLoc; + unsigned int numHandlers; +}; + +class CS_API CXXForRangeStmt : public Stmt +{ +public: + CXXForRangeStmt(); + Stmt* init; + Expr* rangeInit; + Expr* cond; + Expr* inc; + Stmt* body; + SourceLocation forLoc; + SourceLocation coawaitLoc; + SourceLocation colonLoc; + SourceLocation rParenLoc; +}; + +class CS_API MSDependentExistsStmt : public Stmt +{ +public: + MSDependentExistsStmt(); + SourceLocation keywordLoc; + bool isIfExists; + bool isIfNotExists; + CompoundStmt* subStmt; +}; + +class CS_API CoroutineBodyStmt : public Stmt +{ +public: + enum class SubStmt + { + Body = 0, + Promise = 1, + InitSuspend = 2, + FinalSuspend = 3, + OnException = 4, + OnFallthrough = 5, + Allocate = 6, + Deallocate = 7, + ReturnValue = 8, + ResultDecl = 9, + ReturnStmt = 10, + ReturnStmtOnAllocFailure = 11, + FirstParamMove = 12 + }; + + class CS_API CtorArgs + { + public: + CtorArgs(); }; - class Capture + CoroutineBodyStmt(); + bool hasDependentPromiseType; + Stmt* body; + Stmt* promiseDeclStmt; + Stmt* initSuspendStmt; + Stmt* finalSuspendStmt; + Stmt* exceptionHandler; + Stmt* fallthroughHandler; + Expr* allocate; + Expr* deallocate; + Expr* returnValueInit; + Stmt* resultDecl; + Stmt* returnStmt; + Stmt* returnStmtOnAllocFailure; +}; + +class CS_API CoreturnStmt : public Stmt +{ +public: + enum class SubStmt { + Operand = 0, + PromiseCall = 1, + Count = 2 }; + + CoreturnStmt(); + bool isImplicit; + SourceLocation keywordLoc; + Expr* operand; + Expr* promiseCall; }; } } }