Envision
A visual programming IDE for object-oriented languages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
CppImport::MacroImporter Class Reference

uses the information provided by the ClangAstVisitor and the Preprocessor to transform a completely expanded Envision AST without macros into an Envision AST with MetaDefinitions and MetaCalls. More...

Public Member Functions

 MacroImporter (OOModel::Project *root, ClangHelpers &clang)
 
void endEntireImport ()
 insert top level meta calls and remove nodes generated from top level expansions. More...
 
void endTranslationUnit ()
 invoked after every imported translation unit to perform macro import. More...
 
void startTranslationUnit ()
 

Private Member Functions

void allArguments (Model::Node *node, QList< MacroArgumentInfo > &result, NodeToCloneMap &mapping)
 return all arguments which are associated to children of node. More...
 
QList< MacroArgumentLocationargumentHistory (clang::SourceRange range)
 
QList< MacroArgumentLocationargumentHistory (Model::Node *node)
 
Model::NodebestContext (MacroExpansion *expansion)
 if a macro expansion does not generate any nodes this method can be used to infer the best context the corresponding meta call can be put in based on its presumed location. More...
 
void clear ()
 clear all information for the current translation unit. More...
 
void handleMacroExpansion (QList< Model::Node * > nodes, MacroExpansion *expansion, NodeToCloneMap &mapping, QList< MacroArgumentInfo > &arguments)
 
void handleQEmit (MacroExpansion *emitExpansion, Model::Node *context)
 
void handleQSignals (clang::SourceLocation signalsLocation, OOModel::Class *classContext)
 adds predefined meta calls to all signaling methods in classContext. More...
 
void insertArguments (QList< MacroArgumentInfo > &allArguments)
 insert gathered argument nodes at their original (logical) location. More...
 
bool insertMetaCall (MacroExpansion *expansion)
 

Private Attributes

AllMetaDefinitions allMetaDefinitions_
 
ClangHelpersclang_
 
QHash< Model::Node *, MacroExpansion * > finalizationMetaCalls
 
MacroDefinitions macroDefinitions_
 
MacroExpansions macroExpansions_
 
QHash< QString, OOModel::MetaCallExpression * > metaCalls_
 
QSet< Model::Node * > nodesToBeRemoved_
 
QSet< Model::Node * > nodesToBeRetained_
 
OOModel::Projectroot_ {}
 

Detailed Description

uses the information provided by the ClangAstVisitor and the Preprocessor to transform a completely expanded Envision AST without macros into an Envision AST with MetaDefinitions and MetaCalls.

Constructor & Destructor Documentation

◆ MacroImporter()

CppImport::MacroImporter::MacroImporter ( OOModel::Project root,
ClangHelpers clang 
)

Member Function Documentation

◆ allArguments()

void CppImport::MacroImporter::allArguments ( Model::Node node,
QList< MacroArgumentInfo > &  result,
NodeToCloneMap mapping 
)
private

return all arguments which are associated to children of node.

◆ argumentHistory() [1/2]

QList< MacroArgumentLocation > CppImport::MacroImporter::argumentHistory ( clang::SourceRange  range)
private

◆ argumentHistory() [2/2]

QList< MacroArgumentLocation > CppImport::MacroImporter::argumentHistory ( Model::Node node)
private

◆ bestContext()

Model::Node * CppImport::MacroImporter::bestContext ( MacroExpansion expansion)
private

if a macro expansion does not generate any nodes this method can be used to infer the best context the corresponding meta call can be put in based on its presumed location.

◆ clear()

void CppImport::MacroImporter::clear ( )
private

clear all information for the current translation unit.

◆ endEntireImport()

void CppImport::MacroImporter::endEntireImport ( )

insert top level meta calls and remove nodes generated from top level expansions.

invoked after all translation units have been processed.

◆ endTranslationUnit()

void CppImport::MacroImporter::endTranslationUnit ( )

invoked after every imported translation unit to perform macro import.

◆ handleMacroExpansion()

void CppImport::MacroImporter::handleMacroExpansion ( QList< Model::Node * >  nodes,
MacroExpansion expansion,
NodeToCloneMap mapping,
QList< MacroArgumentInfo > &  arguments 
)
private

◆ handleQEmit()

void CppImport::MacroImporter::handleQEmit ( MacroExpansion emitExpansion,
Model::Node context 
)
private

◆ handleQSignals()

void CppImport::MacroImporter::handleQSignals ( clang::SourceLocation  signalsLocation,
OOModel::Class classContext 
)
private

adds predefined meta calls to all signaling methods in classContext.

a method is determined to be signaling if it appears after the signalsLocation and there is no other class access specifier (private:, protected:, public:) on a separate line between the signalsLocation and the candidate method.

◆ insertArguments()

void CppImport::MacroImporter::insertArguments ( QList< MacroArgumentInfo > &  allArguments)
private

insert gathered argument nodes at their original (logical) location.

◆ insertMetaCall()

bool CppImport::MacroImporter::insertMetaCall ( MacroExpansion expansion)
private

◆ startTranslationUnit()

void CppImport::MacroImporter::startTranslationUnit ( )

Member Data Documentation

◆ allMetaDefinitions_

AllMetaDefinitions CppImport::MacroImporter::allMetaDefinitions_
private

◆ clang_

ClangHelpers& CppImport::MacroImporter::clang_
private

◆ finalizationMetaCalls

QHash<Model::Node*, MacroExpansion*> CppImport::MacroImporter::finalizationMetaCalls
private

◆ macroDefinitions_

MacroDefinitions CppImport::MacroImporter::macroDefinitions_
private

◆ macroExpansions_

MacroExpansions CppImport::MacroImporter::macroExpansions_
private

◆ metaCalls_

QHash<QString, OOModel::MetaCallExpression*> CppImport::MacroImporter::metaCalls_
private

◆ nodesToBeRemoved_

QSet<Model::Node*> CppImport::MacroImporter::nodesToBeRemoved_
private

◆ nodesToBeRetained_

QSet<Model::Node*> CppImport::MacroImporter::nodesToBeRetained_
private

◆ root_

OOModel::Project* CppImport::MacroImporter::root_ {}
private