Skip to content

Commit

Permalink
added debug to CMakelists to get symbols, fixed bug
Browse files Browse the repository at this point in the history
causing hNode destructor to fail.
  • Loading branch information
mayagokhale committed Jan 16, 2020
1 parent ffd4eba commit ad5b5fc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ set(CMAKE_CXX_EXTENSIONS OFF)
# Make verbose on?
set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "ON")

# Maya
set(CMAKE_BUILD_TYPE RelWithDebInfo)
# end Maya

# SystemC-Clang versions
set(SCC_MAJOR_VERSION 1)
set(SCC_MINOR_VERSION ${SCC_MAJOR_VERSION}.1)
Expand Down
10 changes: 6 additions & 4 deletions plugins/xlat/XlatEntryMethod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ bool XlatMethod::TraverseCXXOperatorCallExpr(CXXOperatorCallExpr * opcall) {
}
}
os_ << "not yet implemented operator call expr, opc is " << clang::getOperatorSpelling(opcall->getOperator()) << " num arguments " << opcall->getNumArgs() << " skipping\n";
h_ret = new hNode(hNode::hdlopsEnum::hUnimpl);
return true;
}

Expand All @@ -355,7 +356,7 @@ bool XlatMethod::TraverseMemberExpr(MemberExpr *memberexpr){
}

bool XlatMethod::TraverseIfStmt(IfStmt *ifs) {
hNodep h_ifstmt, h_ifc, h_ifthen, h_ifelse;
hNodep h_ifstmt, h_ifc = NULL, h_ifthen = NULL, h_ifelse = NULL;
h_ifstmt = new hNode(hNode::hdlopsEnum::hIfStmt);
if (ifs->getConditionVariable()) {
// Variable declarations are not allowed in if conditions
Expand All @@ -367,13 +368,14 @@ bool XlatMethod::TraverseIfStmt(IfStmt *ifs) {
h_ifc = h_ret;
}
TRY_TO(TraverseStmt(ifs->getThen()));
h_ifthen = h_ret;
if (h_ret != h_ifc) // unchanged if couldn't translate the then clause
h_ifthen = h_ret;

if (ifs->getElse()) {
TRY_TO(TraverseStmt(ifs->getElse()));
h_ifelse = h_ret;
if ((h_ret != h_ifc) && (h_ret != h_ifthen))
h_ifelse = h_ret;
}
else h_ifelse = NULL;
h_ifstmt->child_list.push_back(h_ifc);
h_ifstmt->child_list.push_back(h_ifthen);
if(h_ifelse) h_ifstmt->child_list.push_back(h_ifelse);
Expand Down
7 changes: 5 additions & 2 deletions plugins/xlat/hNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,13 @@ namespace hnode {
~hNode() {
if (!child_list.empty()) {
list<hNodep>::iterator it;
for (it = child_list.begin(); it != child_list.end(); ++it) {
delete *it;
for (it = child_list.begin(); it != child_list.end(); it++) {
//if (*it)
//cout << "child list element " << *it << "\n";
if (*it) delete *it;
}
}
//else cout << printname(h_op) << " '" << h_name << "' NOLIST\n";
//cout << "visited hNode destructor\n";

}
Expand Down

0 comments on commit ad5b5fc

Please sign in to comment.