summaryrefslogtreecommitdiff
path: root/include/chillAST
diff options
context:
space:
mode:
Diffstat (limited to 'include/chillAST')
-rw-r--r--include/chillAST/chillAST_node.hh21
-rw-r--r--include/chillAST/chillASTs.hh8
2 files changed, 23 insertions, 6 deletions
diff --git a/include/chillAST/chillAST_node.hh b/include/chillAST/chillAST_node.hh
index 761d0e0..bc80e8a 100644
--- a/include/chillAST/chillAST_node.hh
+++ b/include/chillAST/chillAST_node.hh
@@ -40,8 +40,6 @@ protected:
* @param nameMap a mapping from string to the corresponding declarations, stack is used to mimic scoping
*/
void fixReference(std::map<std::string, std::stack<chillAST_Node*> > nameMap);
-public:
- // TODO decide how to hide some data
//! this Node's parent
chillAST_Node *parent;
//! this node's children the only entity that holds childs/subexpressions
@@ -54,6 +52,8 @@ public:
chillAST_TypedefTable *typedefTable;
//! recordDecl scoping
std::vector<chillAST_RecordDecl*> *recordTable;
+public:
+ // TODO decide how to hide some data
//! whether it is from a source file, when false it is from included files
bool isFromSourceFile;
//! the name of file this node from
@@ -180,12 +180,28 @@ public:
virtual bool isAUnion() { return false; };
+ //! Get the symbol table in the contained scope
virtual chillAST_SymbolTable *getSymbolTable() { return symbolTable; }
+ //! Get the typedef table in the contained scope
virtual chillAST_TypedefTable *getTypedefTable() { return typedefTable; }
+ /*!
+ * @brief Add a variable declaration to the contained scope
+ *
+ * This will not automatically link the variable declaration as a child
+ *
+ * @param vd
+ */
virtual void addVariableToScope(chillAST_VarDecl *vd);
+ /*!
+ * @brief Add a typedef to the contained scope
+ *
+ * This will not automatically link the typedef as a child
+ *
+ * @param tdd
+ */
virtual void addTypedefToScope(chillAST_TypedefDecl *tdd);
//! Non recursive version that tries to find the declaration in this node
@@ -207,6 +223,7 @@ public:
* @return The number of subexpressions
*/
virtual int getNumChildren() { return children.size(); };
+
//! Deprecating, return the children as a list not eligible for multiplexing
chillAST_NodeList *getChildren() { return &children; };
/*!
diff --git a/include/chillAST/chillASTs.hh b/include/chillAST/chillASTs.hh
index 25e6855..4b50479 100644
--- a/include/chillAST/chillASTs.hh
+++ b/include/chillAST/chillASTs.hh
@@ -514,9 +514,9 @@ public:
// ADD MYSELF!
loops.push_back(this);
- int n = getBody()->children.size();
+ int n = getBody()->getNumChildren();
for (int i = 0; i < n; i++) {
- getBody()->children[i]->get_deep_loops(loops);
+ getBody()->getChild(i)->get_deep_loops(loops);
}
}
@@ -524,10 +524,10 @@ public:
void find_deepest_loops(std::vector<chillAST_ForStmt *> &loops) {
std::vector<chillAST_ForStmt *> b; // deepest loops below me
- int n = getBody()->children.size();
+ int n = getBody()->getNumChildren();
for (int i = 0; i < n; i++) {
std::vector<chillAST_ForStmt *> l; // deepest loops below one child
- getBody()->children[i]->find_deepest_loops(l);
+ getBody()->getChild(i)->find_deepest_loops(l);
if (l.size() > b.size()) { // a deeper nesting than we've seen
b = l;
}