Envision
A visual programming IDE for object-oriented languages
|
The expression visitor translates clang expression to envision expression. More...
Public Member Functions | |
ExpressionVisitor (ClangAstVisitor *visitor, ClangHelpers &clang, CppImportLogger *log) | |
void | setUtilities (CppImportUtilities *utils) |
This function should be called directly after instantiating this visitor. More... | |
QList< OOModel::Expression * > | translateArguments (clang::Expr **arguments, int numArguments) |
OOModel::Expression * | translateExpression (clang::Stmt *s) |
Translates the expression s. More... | |
bool | TraverseArraySubscriptExpr (clang::ArraySubscriptExpr *arraySubsrciptExpr) |
bool | TraverseBinAdd (clang::BinaryOperator *binOp) |
bool | TraverseBinAddAssign (clang::CompoundAssignOperator *binOp) |
bool | TraverseBinAnd (clang::BinaryOperator *binOp) |
bool | TraverseBinAndAssign (clang::CompoundAssignOperator *binOp) |
bool | TraverseBinAssign (clang::BinaryOperator *binOp) |
bool | TraverseBinComma (clang::BinaryOperator *binOp) |
bool | TraverseBinDiv (clang::BinaryOperator *binOp) |
bool | TraverseBinDivAssign (clang::CompoundAssignOperator *binOp) |
bool | TraverseBinEQ (clang::BinaryOperator *binOp) |
bool | TraverseBinGE (clang::BinaryOperator *binOp) |
bool | TraverseBinGT (clang::BinaryOperator *binOp) |
bool | TraverseBinLAnd (clang::BinaryOperator *binOp) |
bool | TraverseBinLE (clang::BinaryOperator *binOp) |
bool | TraverseBinLOr (clang::BinaryOperator *binOp) |
bool | TraverseBinLT (clang::BinaryOperator *binOp) |
bool | TraverseBinMul (clang::BinaryOperator *binOp) |
bool | TraverseBinMulAssign (clang::CompoundAssignOperator *binOp) |
bool | TraverseBinNE (clang::BinaryOperator *binOp) |
bool | TraverseBinOr (clang::BinaryOperator *binOp) |
bool | TraverseBinOrAssign (clang::CompoundAssignOperator *binOp) |
bool | TraverseBinPtrMemD (clang::BinaryOperator *binOp) |
bool | TraverseBinPtrMemI (clang::BinaryOperator *binOp) |
bool | TraverseBinRem (clang::BinaryOperator *binOp) |
bool | TraverseBinRemAssign (clang::CompoundAssignOperator *binOp) |
bool | TraverseBinShlAssign (clang::CompoundAssignOperator *binOp) |
bool | TraverseBinShrAssign (clang::CompoundAssignOperator *binOp) |
bool | TraverseBinSub (clang::BinaryOperator *binOp) |
bool | TraverseBinSubAssign (clang::CompoundAssignOperator *binOp) |
bool | TraverseBinXor (clang::BinaryOperator *binOp) |
bool | TraverseBinXorAssign (clang::CompoundAssignOperator *binOp) |
bool | TraverseCallExpr (clang::CallExpr *callExpr) |
bool | TraverseCharacterLiteral (clang::CharacterLiteral *charLiteral) |
bool | TraverseConditionalOperator (clang::ConditionalOperator *conditionalOperator) |
bool | TraverseCStyleCastExpr (clang::CStyleCastExpr *castExpr) |
bool | TraverseCXXBoolLiteralExpr (clang::CXXBoolLiteralExpr *boolLitExpr) |
bool | TraverseCXXConstCastExpr (clang::CXXConstCastExpr *castExpr) |
bool | TraverseCXXConstructExpr (clang::CXXConstructExpr *constructExpr) |
bool | TraverseCXXDeleteExpr (clang::CXXDeleteExpr *deleteExpr) |
bool | TraverseCXXDependentScopeMemberExpr (clang::CXXDependentScopeMemberExpr *dependentScopeMember) |
bool | TraverseCXXDynamicCastExpr (clang::CXXDynamicCastExpr *castExpr) |
bool | TraverseCXXFunctionalCastExpr (clang::CXXFunctionalCastExpr *castExpr) |
bool | TraverseCXXMemberCallExpr (clang::CXXMemberCallExpr *callExpr) |
bool | TraverseCXXNewExpr (clang::CXXNewExpr *newExpr) |
bool | TraverseCXXNullPtrLiteralExpr (clang::CXXNullPtrLiteralExpr *) |
bool | TraverseCXXOperatorCallExpr (clang::CXXOperatorCallExpr *callExpr) |
bool | TraverseCXXReinterpretCastExpr (clang::CXXReinterpretCastExpr *castExpr) |
bool | TraverseCXXStaticCastExpr (clang::CXXStaticCastExpr *castExpr) |
bool | TraverseCXXTemporaryObjectExpr (clang::CXXTemporaryObjectExpr *tempObjectExpr) |
bool | TraverseCXXThisExpr (clang::CXXThisExpr *thisExpr) |
bool | TraverseCXXThrowExpr (clang::CXXThrowExpr *throwExpr) |
bool | TraverseCXXTypeidExpr (clang::CXXTypeidExpr *typeIdExpr) |
bool | TraverseCXXUnresolvedConstructExpr (clang::CXXUnresolvedConstructExpr *unresolvedConstruct) |
bool | TraverseDeclRefExpr (clang::DeclRefExpr *declRefExpr) |
bool | TraverseDependentScopeDeclRefExpr (clang::DependentScopeDeclRefExpr *dependentScope) |
bool | TraverseFloatingLiteral (clang::FloatingLiteral *floatLiteral) |
bool | TraverseInitListExpr (clang::InitListExpr *initListExpr) |
bool | TraverseIntegerLiteral (clang::IntegerLiteral *intLit) |
bool | TraverseLambdaExpr (clang::LambdaExpr *lambdaExpr) |
bool | TraverseMemberExpr (clang::MemberExpr *memberExpr) |
bool | TraverseParenExpr (clang::ParenExpr *parenthesizedExpr) |
bool | TraverseStmt (clang::Stmt *S) |
bool | TraverseStringLiteral (clang::StringLiteral *stringLiteral) |
bool | TraverseUnaryAddrOf (clang::UnaryOperator *uOp) |
bool | TraverseUnaryDeref (clang::UnaryOperator *uOp) |
bool | TraverseUnaryExprOrTypeTraitExpr (clang::UnaryExprOrTypeTraitExpr *typeTrait) |
bool | TraverseUnaryExtension (clang::UnaryOperator *uOp) |
bool | TraverseUnaryImag (clang::UnaryOperator *uOp) |
bool | TraverseUnaryLNot (clang::UnaryOperator *uOp) |
bool | TraverseUnaryMinus (clang::UnaryOperator *uOp) |
bool | TraverseUnaryNot (clang::UnaryOperator *uOp) |
bool | TraverseUnaryPlus (clang::UnaryOperator *uOp) |
bool | TraverseUnaryPostDec (clang::UnaryOperator *uOp) |
bool | TraverseUnaryPostInc (clang::UnaryOperator *uOp) |
bool | TraverseUnaryPreDec (clang::UnaryOperator *uOp) |
bool | TraverseUnaryPreInc (clang::UnaryOperator *uOp) |
bool | TraverseUnaryReal (clang::UnaryOperator *uOp) |
bool | TraverseUnresolvedMemberExpr (clang::UnresolvedMemberExpr *unresolvedMember) |
bool | VisitExpr (clang::Expr *e) |
bool | WalkUpFromOverloadExpr (clang::OverloadExpr *overloadExpr) |
Public Attributes | |
ClangAstVisitor * | baseVisitor_ {} |
Private Types | |
using | Base = clang::RecursiveASTVisitor< ExpressionVisitor > |
Private Member Functions | |
OOModel::ReferenceExpression * | createQualifiedReferenceWithTemplateArguments (clang::SourceRange sourceRange, const clang::NestedNameSpecifierLoc qualifier, const clang::TemplateArgumentLoc *templateArgs=nullptr, unsigned numTArgs=0, clang::Expr *base=nullptr) |
Abstracts common code between all kinds of MemberExpr and DeclRefExpr. More... | |
bool | TraverseAssignment (clang::BinaryOperator *binaryOperator) |
Helper Function for all assign operations as clang has for each operator an own Traverse method. More... | |
bool | TraverseBinaryOp (clang::BinaryOperator *binaryOperator) |
Helper Function for all binary operations as clang has for each operator an own Traverse method. More... | |
bool | TraverseExplCastExpr (clang::ExplicitCastExpr *castExpr, OOModel::CastExpression::CastKind kind) |
Helper Function for all kind of casts. More... | |
bool | TraverseUnaryOp (clang::UnaryOperator *unaryOperator) |
Helper Function for all unary operations as clang has for each operator an own Traverse method. More... | |
Private Attributes | |
ClangHelpers & | clang_ |
const QString | className_ {"ExpressionVisitor"} |
CppImportLogger * | log_ {} |
QStack< OOModel::Expression * > | ooExprStack_ |
CppImportUtilities * | utils_ {} |
The expression visitor translates clang expression to envision expression.
The way to interact it with it is to call TraverseStmt(someExpr) and then get the translated expression with the getLastExpression method
|
private |
CppImport::ExpressionVisitor::ExpressionVisitor | ( | ClangAstVisitor * | visitor, |
ClangHelpers & | clang, | ||
CppImportLogger * | log | ||
) |
|
private |
Abstracts common code between all kinds of MemberExpr and DeclRefExpr.
Creates a reference expression with the name specified and sets prefixes and type arguments if specified.
void CppImport::ExpressionVisitor::setUtilities | ( | CppImportUtilities * | utils | ) |
This function should be called directly after instantiating this visitor.
The two classes have a dependency on each other.
QList< OOModel::Expression * > CppImport::ExpressionVisitor::translateArguments | ( | clang::Expr ** | arguments, |
int | numArguments | ||
) |
OOModel::Expression * CppImport::ExpressionVisitor::translateExpression | ( | clang::Stmt * | s | ) |
Translates the expression s.
Note that s should be an expression it is only declared as stmt for ease of use. Returns the translated expression or an error expression if it could not translate it.
bool CppImport::ExpressionVisitor::TraverseArraySubscriptExpr | ( | clang::ArraySubscriptExpr * | arraySubsrciptExpr | ) |
|
private |
Helper Function for all assign operations as clang has for each operator an own Traverse method.
|
inline |
|
inline |
|
inline |
|
inline |
|
private |
Helper Function for all binary operations as clang has for each operator an own Traverse method.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
bool CppImport::ExpressionVisitor::TraverseCallExpr | ( | clang::CallExpr * | callExpr | ) |
bool CppImport::ExpressionVisitor::TraverseCharacterLiteral | ( | clang::CharacterLiteral * | charLiteral | ) |
bool CppImport::ExpressionVisitor::TraverseConditionalOperator | ( | clang::ConditionalOperator * | conditionalOperator | ) |
|
inline |
bool CppImport::ExpressionVisitor::TraverseCXXBoolLiteralExpr | ( | clang::CXXBoolLiteralExpr * | boolLitExpr | ) |
|
inline |
bool CppImport::ExpressionVisitor::TraverseCXXConstructExpr | ( | clang::CXXConstructExpr * | constructExpr | ) |
bool CppImport::ExpressionVisitor::TraverseCXXDeleteExpr | ( | clang::CXXDeleteExpr * | deleteExpr | ) |
bool CppImport::ExpressionVisitor::TraverseCXXDependentScopeMemberExpr | ( | clang::CXXDependentScopeMemberExpr * | dependentScopeMember | ) |
|
inline |
|
inline |
bool CppImport::ExpressionVisitor::TraverseCXXMemberCallExpr | ( | clang::CXXMemberCallExpr * | callExpr | ) |
bool CppImport::ExpressionVisitor::TraverseCXXNewExpr | ( | clang::CXXNewExpr * | newExpr | ) |
bool CppImport::ExpressionVisitor::TraverseCXXNullPtrLiteralExpr | ( | clang::CXXNullPtrLiteralExpr * | nullLitExpr | ) |
bool CppImport::ExpressionVisitor::TraverseCXXOperatorCallExpr | ( | clang::CXXOperatorCallExpr * | callExpr | ) |
|
inline |
|
inline |
bool CppImport::ExpressionVisitor::TraverseCXXTemporaryObjectExpr | ( | clang::CXXTemporaryObjectExpr * | tempObjectExpr | ) |
bool CppImport::ExpressionVisitor::TraverseCXXThisExpr | ( | clang::CXXThisExpr * | thisExpr | ) |
bool CppImport::ExpressionVisitor::TraverseCXXThrowExpr | ( | clang::CXXThrowExpr * | throwExpr | ) |
bool CppImport::ExpressionVisitor::TraverseCXXTypeidExpr | ( | clang::CXXTypeidExpr * | typeIdExpr | ) |
bool CppImport::ExpressionVisitor::TraverseCXXUnresolvedConstructExpr | ( | clang::CXXUnresolvedConstructExpr * | unresolvedConstruct | ) |
bool CppImport::ExpressionVisitor::TraverseDeclRefExpr | ( | clang::DeclRefExpr * | declRefExpr | ) |
bool CppImport::ExpressionVisitor::TraverseDependentScopeDeclRefExpr | ( | clang::DependentScopeDeclRefExpr * | dependentScope | ) |
|
private |
Helper Function for all kind of casts.
bool CppImport::ExpressionVisitor::TraverseFloatingLiteral | ( | clang::FloatingLiteral * | floatLiteral | ) |
bool CppImport::ExpressionVisitor::TraverseInitListExpr | ( | clang::InitListExpr * | initListExpr | ) |
bool CppImport::ExpressionVisitor::TraverseIntegerLiteral | ( | clang::IntegerLiteral * | intLit | ) |
bool CppImport::ExpressionVisitor::TraverseLambdaExpr | ( | clang::LambdaExpr * | lambdaExpr | ) |
bool CppImport::ExpressionVisitor::TraverseMemberExpr | ( | clang::MemberExpr * | memberExpr | ) |
bool CppImport::ExpressionVisitor::TraverseParenExpr | ( | clang::ParenExpr * | parenthesizedExpr | ) |
bool CppImport::ExpressionVisitor::TraverseStmt | ( | clang::Stmt * | S | ) |
bool CppImport::ExpressionVisitor::TraverseStringLiteral | ( | clang::StringLiteral * | stringLiteral | ) |
|
inline |
|
inline |
bool CppImport::ExpressionVisitor::TraverseUnaryExprOrTypeTraitExpr | ( | clang::UnaryExprOrTypeTraitExpr * | typeTrait | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
private |
Helper Function for all unary operations as clang has for each operator an own Traverse method.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
bool CppImport::ExpressionVisitor::TraverseUnresolvedMemberExpr | ( | clang::UnresolvedMemberExpr * | unresolvedMember | ) |
bool CppImport::ExpressionVisitor::VisitExpr | ( | clang::Expr * | e | ) |
bool CppImport::ExpressionVisitor::WalkUpFromOverloadExpr | ( | clang::OverloadExpr * | overloadExpr | ) |
ClangAstVisitor* CppImport::ExpressionVisitor::baseVisitor_ {} |
|
private |
|
private |
|
private |
|
private |
|
private |