"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/frontend/SageIII/astMerge/delete.C" between
rose-0.11.53.0.tar.gz and rose-0.11.54.0.tar.gz

About: ROSE is a compiler infrastructure to build source-to-source program transformation and analysis tools for large-scale C, C++, UPC, Fortran, OpenMP, Java, Python and PHP applications.

delete.C  (rose-0.11.53.0):delete.C  (rose-0.11.54.0)
#include "sage3basic.h" #include "sage3basic.h"
#include "fixupTraversal.h" #include "fixupTraversal.h"
#define DEBUG_DeleteDisconnectedNode 0
#define DEBUG_DeleteDisconnectedNode_ordered_delete 0 #define DEBUG_DeleteDisconnectedNode_ordered_delete 0
#if DEBUG_DeleteDisconnectedNode_ordered_delete #if DEBUG_DeleteDisconnectedNode_ordered_delete
# include "wholeAST_API.h" # include "wholeAST_API.h"
# include "memory-pool-snapshot.h" # include "memory-pool-snapshot.h"
#endif #endif
namespace Rose { namespace Rose {
namespace AST { namespace AST {
struct DeleteDisconnectedNode : public ROSE_VisitTraversal { struct DeleteDisconnectedNode : public ROSE_VisitTraversal {
std::set<SgNode*> saves; std::set<SgNode*> saves;
std::vector<SgNode*> deletes; std::vector<SgNode*> deletes;
void visit (SgNode* node) { void visit (SgNode* node) {
// if (isSgStorageModifier(node)) return; // FIXME idk why? if (saves.find(node) == saves.end()) {
if (
saves.find(node) == saves.end() || // part
of the `saves` nodes
( isSg_File_Info(node) && isSgTypeDefault(node->get_parent()) ) // or s
ignature of a Sg_File_Info object that is used as the location in a Preprocessin
gInfo object
) {
deletes.push_back(node); deletes.push_back(node);
} }
} }
// Recursively traverse all data members of AST nodes that are AST nodes thems elves (not restricted to actual tree structure) // Recursively traverse all data members of AST nodes that are AST nodes thems elves (not restricted to actual tree structure)
void recursive_saves( SgNode* node) { void recursive_saves( SgNode* node) {
// Stop on sinks and loops // Stop on sinks and loops
if (node == NULL || !saves.insert(node).second) return; if (node == NULL || !saves.insert(node).second) return;
std::vector<std::pair<SgNode*, std::string> > data_members = node->returnDat auto data_members = node->returnDataMemberPointers();
aMemberPointers(); for (auto dm: data_members) {
for (std::vector<std::pair<SgNode*, std::string> >::iterator i = data_member recursive_saves(dm.first);
s.begin(); i != data_members.end(); ++i) { }
recursive_saves(i->first); SgLocatedNode * lnode = isSgLocatedNode(node);
if (lnode != nullptr) {
AttachedPreprocessingInfoType * comments = lnode->getAttachedPreprocessing
Info();
if (comments != NULL) {
for (auto comment: *comments) {
#if DEBUG_DeleteDisconnectedNode
std::cout << "Comment with FI: " << std::hex << comment->get_file_info
() << std::endl;
#endif
recursive_saves(comment->get_file_info());
}
}
} }
} }
// Prevent double deletes by traversing the various subtree in a top down fash ion // Prevent double deletes by traversing the various subtree in a top down fash ion
void ordered_delete() { void ordered_delete() {
std::map< SgNode *, std::vector<SgNode *> > descendants; // direct descendan ts std::map< SgNode *, std::vector<SgNode *> > descendants; // direct descendan ts
for (std::vector<SgNode *>::const_iterator i = deletes.begin(); i != deletes .end(); ++i) { for (std::vector<SgNode *>::const_iterator i = deletes.begin(); i != deletes .end(); ++i) {
descendants.insert(std::pair< SgNode *, std::vector<SgNode *> >(*i, std::v ector<SgNode *>())); descendants.insert(std::pair< SgNode *, std::vector<SgNode *> >(*i, std::v ector<SgNode *>()));
} }
 End of changes. 3 change blocks. 
13 lines changed or deleted 19 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)