Browse Source

Generate the native parser code for expression and statements.

pull/1179/head
Joao Matos 6 years ago committed by João Matos
parent
commit
d7fdf20b1e
  1. 2
      src/CppParser/AST.h
  2. 1048
      src/CppParser/Expr.cpp
  3. 1418
      src/CppParser/Expr.h
  4. 2038
      src/CppParser/ParseExpr.cpp
  5. 464
      src/CppParser/ParseStmt.cpp
  6. 5
      src/CppParser/Parser.cpp
  7. 6
      src/CppParser/Parser.h
  8. 353
      src/CppParser/Stmt.cpp
  9. 454
      src/CppParser/Stmt.h

2
src/CppParser/AST.h

@ -11,6 +11,8 @@ @@ -11,6 +11,8 @@
#include "Sources.h"
#include "Types.h"
#include "Decl.h"
#include "Stmt.h"
#include "Expr.h"
#include <algorithm>
namespace CppSharp { namespace CppParser { namespace AST {

1048
src/CppParser/Expr.cpp

File diff suppressed because it is too large Load Diff

1418
src/CppParser/Expr.h

File diff suppressed because it is too large Load Diff

2038
src/CppParser/ParseExpr.cpp

File diff suppressed because it is too large Load Diff

464
src/CppParser/ParseStmt.cpp

@ -0,0 +1,464 @@ @@ -0,0 +1,464 @@
// ----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
// ----------------------------------------------------------------------------
#include "AST.h"
#include "Parser.h"
#include <clang/AST/Stmt.h>
#include <clang/AST/StmtCXX.h>
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<clang::DeclStmt*>(llvm::cast<clang::DeclStmt>(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<clang::NullStmt*>(llvm::cast<clang::NullStmt>(Stmt));
auto _S = new AST::NullStmt();
_S->hasLeadingEmptyMacro = S->hasLeadingEmptyMacro();
_Stmt = _S;
break;
}
case clang::Stmt::CompoundStmtClass:
{
auto S = const_cast<clang::CompoundStmt*>(llvm::cast<clang::CompoundStmt>(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<clang::CaseStmt*>(llvm::cast<clang::CaseStmt>(Stmt));
auto _S = new AST::CaseStmt();
_S->lHS = static_cast<AST::Expr*>(WalkExpression(S->getLHS()));
_S->rHS = static_cast<AST::Expr*>(WalkExpression(S->getRHS()));
_S->subStmt = static_cast<AST::Stmt*>(WalkStatement(S->getSubStmt()));
_S->caseStmtIsGNURange = S->caseStmtIsGNURange();
_Stmt = _S;
break;
}
case clang::Stmt::DefaultStmtClass:
{
auto S = const_cast<clang::DefaultStmt*>(llvm::cast<clang::DefaultStmt>(Stmt));
auto _S = new AST::DefaultStmt();
_S->subStmt = static_cast<AST::Stmt*>(WalkStatement(S->getSubStmt()));
_Stmt = _S;
break;
}
case clang::Stmt::LabelStmtClass:
{
auto S = const_cast<clang::LabelStmt*>(llvm::cast<clang::LabelStmt>(Stmt));
auto _S = new AST::LabelStmt();
_S->subStmt = static_cast<AST::Stmt*>(WalkStatement(S->getSubStmt()));
_S->name = S->getName();
_Stmt = _S;
break;
}
case clang::Stmt::AttributedStmtClass:
{
auto S = const_cast<clang::AttributedStmt*>(llvm::cast<clang::AttributedStmt>(Stmt));
auto _S = new AST::AttributedStmt();
_Stmt = _S;
break;
}
case clang::Stmt::IfStmtClass:
{
auto S = const_cast<clang::IfStmt*>(llvm::cast<clang::IfStmt>(Stmt));
auto _S = new AST::IfStmt();
_S->cond = static_cast<AST::Expr*>(WalkExpression(S->getCond()));
_S->then = static_cast<AST::Stmt*>(WalkStatement(S->getThen()));
_S->_else = static_cast<AST::Stmt*>(WalkStatement(S->getElse()));
_S->init = static_cast<AST::Stmt*>(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<clang::SwitchStmt*>(llvm::cast<clang::SwitchStmt>(Stmt));
auto _S = new AST::SwitchStmt();
_S->cond = static_cast<AST::Expr*>(WalkExpression(S->getCond()));
_S->body = static_cast<AST::Stmt*>(WalkStatement(S->getBody()));
_S->init = static_cast<AST::Stmt*>(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<clang::WhileStmt*>(llvm::cast<clang::WhileStmt>(Stmt));
auto _S = new AST::WhileStmt();
_S->cond = static_cast<AST::Expr*>(WalkExpression(S->getCond()));
_S->body = static_cast<AST::Stmt*>(WalkStatement(S->getBody()));
_S->hasVarStorage = S->hasVarStorage();
_Stmt = _S;
break;
}
case clang::Stmt::DoStmtClass:
{
auto S = const_cast<clang::DoStmt*>(llvm::cast<clang::DoStmt>(Stmt));
auto _S = new AST::DoStmt();
_S->cond = static_cast<AST::Expr*>(WalkExpression(S->getCond()));
_S->body = static_cast<AST::Stmt*>(WalkStatement(S->getBody()));
_Stmt = _S;
break;
}
case clang::Stmt::ForStmtClass:
{
auto S = const_cast<clang::ForStmt*>(llvm::cast<clang::ForStmt>(Stmt));
auto _S = new AST::ForStmt();
_S->init = static_cast<AST::Stmt*>(WalkStatement(S->getInit()));
_S->cond = static_cast<AST::Expr*>(WalkExpression(S->getCond()));
_S->inc = static_cast<AST::Expr*>(WalkExpression(S->getInc()));
_S->body = static_cast<AST::Stmt*>(WalkStatement(S->getBody()));
_S->conditionVariableDeclStmt = static_cast<AST::DeclStmt*>(WalkStatement(S->getConditionVariableDeclStmt()));
_Stmt = _S;
break;
}
case clang::Stmt::GotoStmtClass:
{
auto S = const_cast<clang::GotoStmt*>(llvm::cast<clang::GotoStmt>(Stmt));
auto _S = new AST::GotoStmt();
_Stmt = _S;
break;
}
case clang::Stmt::IndirectGotoStmtClass:
{
auto S = const_cast<clang::IndirectGotoStmt*>(llvm::cast<clang::IndirectGotoStmt>(Stmt));
auto _S = new AST::IndirectGotoStmt();
_S->target = static_cast<AST::Expr*>(WalkExpression(S->getTarget()));
_Stmt = _S;
break;
}
case clang::Stmt::ContinueStmtClass:
{
auto S = const_cast<clang::ContinueStmt*>(llvm::cast<clang::ContinueStmt>(Stmt));
auto _S = new AST::ContinueStmt();
_Stmt = _S;
break;
}
case clang::Stmt::BreakStmtClass:
{
auto S = const_cast<clang::BreakStmt*>(llvm::cast<clang::BreakStmt>(Stmt));
auto _S = new AST::BreakStmt();
_Stmt = _S;
break;
}
case clang::Stmt::ReturnStmtClass:
{
auto S = const_cast<clang::ReturnStmt*>(llvm::cast<clang::ReturnStmt>(Stmt));
auto _S = new AST::ReturnStmt();
_S->retValue = static_cast<AST::Expr*>(WalkExpression(S->getRetValue()));
_Stmt = _S;
break;
}
case clang::Stmt::GCCAsmStmtClass:
{
auto S = const_cast<clang::GCCAsmStmt*>(llvm::cast<clang::GCCAsmStmt>(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<clang::MSAsmStmt*>(llvm::cast<clang::MSAsmStmt>(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<clang::SEHExceptStmt*>(llvm::cast<clang::SEHExceptStmt>(Stmt));
auto _S = new AST::SEHExceptStmt();
_S->filterExpr = static_cast<AST::Expr*>(WalkExpression(S->getFilterExpr()));
_S->block = static_cast<AST::CompoundStmt*>(WalkStatement(S->getBlock()));
_Stmt = _S;
break;
}
case clang::Stmt::SEHFinallyStmtClass:
{
auto S = const_cast<clang::SEHFinallyStmt*>(llvm::cast<clang::SEHFinallyStmt>(Stmt));
auto _S = new AST::SEHFinallyStmt();
_S->block = static_cast<AST::CompoundStmt*>(WalkStatement(S->getBlock()));
_Stmt = _S;
break;
}
case clang::Stmt::SEHTryStmtClass:
{
auto S = const_cast<clang::SEHTryStmt*>(llvm::cast<clang::SEHTryStmt>(Stmt));
auto _S = new AST::SEHTryStmt();
_S->isCXXTry = S->getIsCXXTry();
_S->tryBlock = static_cast<AST::CompoundStmt*>(WalkStatement(S->getTryBlock()));
_S->handler = static_cast<AST::Stmt*>(WalkStatement(S->getHandler()));
_S->exceptHandler = static_cast<AST::SEHExceptStmt*>(WalkStatement(S->getExceptHandler()));
_S->finallyHandler = static_cast<AST::SEHFinallyStmt*>(WalkStatement(S->getFinallyHandler()));
_Stmt = _S;
break;
}
case clang::Stmt::SEHLeaveStmtClass:
{
auto S = const_cast<clang::SEHLeaveStmt*>(llvm::cast<clang::SEHLeaveStmt>(Stmt));
auto _S = new AST::SEHLeaveStmt();
_Stmt = _S;
break;
}
case clang::Stmt::CapturedStmtClass:
{
auto S = const_cast<clang::CapturedStmt*>(llvm::cast<clang::CapturedStmt>(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<clang::CXXCatchStmt*>(llvm::cast<clang::CXXCatchStmt>(Stmt));
auto _S = new AST::CXXCatchStmt();
_S->caughtType = GetQualifiedType(S->getCaughtType());
_S->handlerBlock = static_cast<AST::Stmt*>(WalkStatement(S->getHandlerBlock()));
_Stmt = _S;
break;
}
case clang::Stmt::CXXTryStmtClass:
{
auto S = const_cast<clang::CXXTryStmt*>(llvm::cast<clang::CXXTryStmt>(Stmt));
auto _S = new AST::CXXTryStmt();
_S->numHandlers = S->getNumHandlers();
_Stmt = _S;
break;
}
case clang::Stmt::CXXForRangeStmtClass:
{
auto S = const_cast<clang::CXXForRangeStmt*>(llvm::cast<clang::CXXForRangeStmt>(Stmt));
auto _S = new AST::CXXForRangeStmt();
_S->init = static_cast<AST::Stmt*>(WalkStatement(S->getInit()));
_S->rangeInit = static_cast<AST::Expr*>(WalkExpression(S->getRangeInit()));
_S->cond = static_cast<AST::Expr*>(WalkExpression(S->getCond()));
_S->inc = static_cast<AST::Expr*>(WalkExpression(S->getInc()));
_S->body = static_cast<AST::Stmt*>(WalkStatement(S->getBody()));
_Stmt = _S;
break;
}
case clang::Stmt::MSDependentExistsStmtClass:
{
auto S = const_cast<clang::MSDependentExistsStmt*>(llvm::cast<clang::MSDependentExistsStmt>(Stmt));
auto _S = new AST::MSDependentExistsStmt();
_S->isIfExists = S->isIfExists();
_S->isIfNotExists = S->isIfNotExists();
_S->subStmt = static_cast<AST::CompoundStmt*>(WalkStatement(S->getSubStmt()));
_Stmt = _S;
break;
}
case clang::Stmt::CoroutineBodyStmtClass:
{
auto S = const_cast<clang::CoroutineBodyStmt*>(llvm::cast<clang::CoroutineBodyStmt>(Stmt));
auto _S = new AST::CoroutineBodyStmt();
_S->hasDependentPromiseType = S->hasDependentPromiseType();
_S->body = static_cast<AST::Stmt*>(WalkStatement(S->getBody()));
_S->promiseDeclStmt = static_cast<AST::Stmt*>(WalkStatement(S->getPromiseDeclStmt()));
_S->initSuspendStmt = static_cast<AST::Stmt*>(WalkStatement(S->getInitSuspendStmt()));
_S->finalSuspendStmt = static_cast<AST::Stmt*>(WalkStatement(S->getFinalSuspendStmt()));
_S->exceptionHandler = static_cast<AST::Stmt*>(WalkStatement(S->getExceptionHandler()));
_S->fallthroughHandler = static_cast<AST::Stmt*>(WalkStatement(S->getFallthroughHandler()));
_S->allocate = static_cast<AST::Expr*>(WalkExpression(S->getAllocate()));
_S->deallocate = static_cast<AST::Expr*>(WalkExpression(S->getDeallocate()));
_S->returnValueInit = static_cast<AST::Expr*>(WalkExpression(S->getReturnValueInit()));
_S->resultDecl = static_cast<AST::Stmt*>(WalkStatement(S->getResultDecl()));
_S->returnStmt = static_cast<AST::Stmt*>(WalkStatement(S->getReturnStmt()));
_S->returnStmtOnAllocFailure = static_cast<AST::Stmt*>(WalkStatement(S->getReturnStmtOnAllocFailure()));
_Stmt = _S;
break;
}
case clang::Stmt::CoreturnStmtClass:
{
auto S = const_cast<clang::CoreturnStmt*>(llvm::cast<clang::CoreturnStmt>(Stmt));
auto _S = new AST::CoreturnStmt();
_S->isImplicit = S->isImplicit();
_S->operand = static_cast<AST::Expr*>(WalkExpression(S->getOperand()));
_S->promiseCall = static_cast<AST::Expr*>(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<clang::Expr>(Stmt));
}
default:
printf("Unhandled statement kind: %s\n", Stmt->getStmtClassName());
}
return _Stmt;
}
} }

5
src/CppParser/Parser.cpp

@ -1439,7 +1439,7 @@ Parser::WalkTemplateArgumentList(const clang::TemplateArgumentList* TAL, @@ -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) @@ -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<MaterializeTemporaryExpr>(Arg);
auto TemporaryExpr = dyn_cast<clang::MaterializeTemporaryExpr>(Arg);
if (TemporaryExpr)
{
auto SubTemporaryExpr = TemporaryExpr->GetTemporaryExpr();
@ -3593,6 +3593,7 @@ AST::ExpressionObsolete* Parser::WalkExpressionObsolete(const clang::Expr* Expr) @@ -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 &&

6
src/CppParser/Parser.h

@ -94,7 +94,7 @@ private: @@ -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: @@ -111,7 +111,7 @@ private:
std::vector<TemplateArgument> WalkTemplateArgumentList(const clang::TemplateArgumentList* TAL, TypeLoc* TSTL);
std::vector<TemplateArgument> 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: @@ -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);

353
src/CppParser/Stmt.cpp

@ -0,0 +1,353 @@ @@ -0,0 +1,353 @@
// ----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
// ----------------------------------------------------------------------------
#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)
{
}
} } }

454
src/CppParser/Stmt.h

@ -7,15 +7,19 @@ @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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;
};
} } }

Loading…
Cancel
Save