Commit 34cf087e authored by rmrf's avatar rmrf
Browse files

untabify and indent.

parent 26c5fb05
......@@ -13,163 +13,123 @@
#include "clang/AST/Expr.h"
#include <stdio.h>
namespace scpar {
using namespace clang;
using namespace std;
class Node {
public:
typedef pair < int, Node * >connectPairType;
typedef map < int, Node * >connectMapType;
Node (
);
Node (int
);
void addSuccessor (Node *
);
void addPredecessor (Node *
);
vector < int >getSuccessors (int
);
vector < int >getPredecessors (int
);
int getId (
);
void dump (raw_ostream &, int
);
protected:
int _id;
connectMapType _preds;
connectMapType _succs;
};
class Edge {
public:
typedef pair < unsigned int, unsigned int >timePairType;
typedef vector < timePairType > timeAdvanceVectorType;
Edge (Node *, Node *
);
Edge (Node *, Node *, int
);
void updateSuspensionTime (timePairType
);
int getId (
);
int getToId (
);
int getFromId (
);
timeAdvanceVectorType getTimeAdvanceVector (
);
void dump (raw_ostream &, int
);
protected:
int _id;
timeAdvanceVectorType _timeAdvanceVector;
Node *_from;
Node *_to;
};
class Graph {
public:
typedef vector < int >nodeIDVector;
typedef vector < int >edgeIDVector;
typedef vector < Node * >nodeVector;
typedef vector < Edge * >edgeVector;
typedef map < int, Node * >nodeMapType;
typedef pair < int, Node * >nodePairType;
typedef map < int, Edge * >edgeMapType;
typedef pair < int, Edge * >edgePairType;
typedef pair < int, int >twoNodePairType;
typedef pair < twoNodePairType, Edge * >adjPairType;
typedef map < twoNodePairType, Edge * >adjMapType;
typedef pair < int, vector < Edge * > >adjEdgesPairType;
typedef map < int, vector < Edge * > >adjEdgesMapType;
Graph (
);
~Graph (
);
Node *addNode (
);
Node *addNode (int
);
Edge *addEdge (Node *, Node *
);
Edge *addEdge (int, int
);
int getEdgeID (Edge *
);
int getEdgeID (Node *, Node *
);
int getEdgeID (int, int
);
int getNodeID (Node *
);
Edge *getEdge (Node *, Node *
);
Edge *getEdge (int, int
);
Node *getNode (int
);
vector < Edge * >getEdgesFromSource (int
);
vector < Edge * >getEdgesFromSource (Node *
);
vector < Edge * >getEdgesFromDest (int
);
vector < Edge * >getEdgesFromDest (Node *
);
adjMapType returnAdjList (
);
nodeIDVector returnNodeIDs (
);
edgeIDVector returnEdgeIDs (
);
nodeVector returnNodes (
);
edgeVector returnEdges (
);
edgeVector returnEdgeVector (
);
nodeVector returnNodeVector (
);
void dump (raw_ostream &, int tabn = 0);
void dumpSauto (raw_ostream &, int tabn = 0);
protected:
adjMapType _adjList;
nodeMapType _nodeMap;
edgeMapType _edgeMap;
adjEdgesMapType _adjEdges;
int _nNodes;
int _nEdges;
nodeIDVector _nodeIDVector;
edgeIDVector _edgeIDVector;
nodeVector _nodeVector;
edgeVector _edgeVector;
};
using namespace clang;
using namespace std;
class Node {
public:
typedef pair < int, Node * >connectPairType;
typedef map < int, Node * >connectMapType;
Node ( );
Node (int );
void addSuccessor (Node * );
void addPredecessor (Node * );
vector < int >getSuccessors (int );
vector < int >getPredecessors (int );
int getId( );
void dump (raw_ostream &, int );
protected:
int _id;
connectMapType _preds;
connectMapType _succs;
};
class Edge {
public:
typedef pair < unsigned int, unsigned int >timePairType;
typedef vector < timePairType > timeAdvanceVectorType;
Edge (Node *, Node * );
Edge (Node *, Node *, int );
void updateSuspensionTime(timePairType );
int getId();
int getToId();
int getFromId();
timeAdvanceVectorType getTimeAdvanceVector();
void dump (raw_ostream &, int);
protected:
int _id;
timeAdvanceVectorType _timeAdvanceVector;
Node *_from;
Node *_to;
};
class Graph {
public:
typedef vector < int >nodeIDVector;
typedef vector < int >edgeIDVector;
typedef vector < Node * >nodeVector;
typedef vector < Edge * >edgeVector;
typedef map < int, Node * >nodeMapType;
typedef pair < int, Node * >nodePairType;
typedef map < int, Edge * >edgeMapType;
typedef pair < int, Edge * >edgePairType;
typedef pair < int, int >twoNodePairType;
typedef pair < twoNodePairType, Edge * >adjPairType;
typedef map < twoNodePairType, Edge * >adjMapType;
typedef pair < int, vector < Edge * > >adjEdgesPairType;
typedef map < int, vector < Edge * > >adjEdgesMapType;
Graph();
~Graph();
Node *addNode();
Node *addNode(int );
Edge *addEdge(Node *, Node * );
Edge *addEdge(int, int );
int getEdgeID(Edge * );
int getEdgeID (Node *, Node * );
int getEdgeID (int, int );
int getNodeID (Node * );
Edge *getEdge (Node *, Node * );
Edge *getEdge (int, int );
Node *getNode (int );
vector < Edge * >getEdgesFromSource (int );
vector < Edge * >getEdgesFromSource (Node * );
vector < Edge * >getEdgesFromDest (int );
vector < Edge * >getEdgesFromDest (Node * );
adjMapType returnAdjList();
nodeIDVector returnNodeIDs();
edgeIDVector returnEdgeIDs();
nodeVector returnNodes();
edgeVector returnEdges();
edgeVector returnEdgeVector();
nodeVector returnNodeVector();
void dump (raw_ostream &, int tabn = 0);
void dumpSauto (raw_ostream &, int tabn = 0);
protected:
adjMapType _adjList;
nodeMapType _nodeMap;
edgeMapType _edgeMap;
adjEdgesMapType _adjEdges;
int _nNodes;
int _nEdges;
nodeIDVector _nodeIDVector;
edgeIDVector _edgeIDVector;
nodeVector _nodeVector;
edgeVector _edgeVector;
};
}
#endif
......@@ -27,66 +27,65 @@
#include "SuspensionAutomata.h"
namespace scpar {
using namespace clang;
using namespace std;
using namespace clang;
using namespace std;
class EntryFunctionContainer {
public:
// typedefs
typedef vector < WaitContainer * >waitContainerListType;
typedef vector < NotifyContainer *> notifyContainerListType;
typedef pair<int, SuspensionAutomata::transitionVectorType> instanceSautoPairType;
typedef map<int, SuspensionAutomata::transitionVectorType> instanceSautoMapType;
class EntryFunctionContainer {
public:
// typedefs
typedef vector < WaitContainer * >waitContainerListType;
typedef vector < NotifyContainer *> notifyContainerListType;
typedef pair <int, SuspensionAutomata::susCFGVectorType> instanceSusCFGPairType;
typedef map <int, SuspensionAutomata::susCFGVectorType> instanceSusCFGMapType;
EntryFunctionContainer ();
EntryFunctionContainer (string, PROCESS_TYPE, CXXMethodDecl *, Stmt *);
EntryFunctionContainer (const EntryFunctionContainer &);
~EntryFunctionContainer ();
typedef pair<int, SuspensionAutomata::transitionVectorType> instanceSautoPairType;
typedef map<int, SuspensionAutomata::transitionVectorType> instanceSautoMapType;
// Accessors.
string getName ();
CXXMethodDecl *getEntryMethod ();
//Stmt *getConstructorStmt ();
PROCESS_TYPE getProcessType ();
typedef pair <int, SuspensionAutomata::susCFGVectorType> instanceSusCFGPairType;
typedef map <int, SuspensionAutomata::susCFGVectorType> instanceSusCFGMapType;
waitContainerListType getWaitCalls ();
notifyContainerListType getNotifyCalls();
FindSensitivity::senseMapType getSenseMap();
SuspensionAutomata::susCFGVectorType getSusCFG();
SuspensionAutomata::transitionVectorType getSusAuto();
instanceSautoMapType getInstanceSautoMap();
instanceSusCFGMapType getInstanceSusCFGMap();
EntryFunctionContainer();
EntryFunctionContainer(string, PROCESS_TYPE, CXXMethodDecl *, Stmt *);
EntryFunctionContainer(const EntryFunctionContainer &);
~EntryFunctionContainer();
// Add waits.
void addSensitivityInfo(FindSensitivity &);
void addWaits (FindWait &);
void addNotifys(FindNotify &);
void addSusCFGAuto(SuspensionAutomata &);
//void setConstructorStmt (Stmt *);
void setName (string);
void setProcessType (PROCESS_TYPE);
void setEntryMethod (CXXMethodDecl *);
void dumpSusCFG(raw_ostream &);
void dumpSauto(raw_ostream &);
void dump (raw_ostream &, int);
// Accessors.
string getName();
CXXMethodDecl *getEntryMethod();
//Stmt *getConstructorStmt ();
PROCESS_TYPE getProcessType();
waitContainerListType getWaitCalls();
notifyContainerListType getNotifyCalls();
FindSensitivity::senseMapType getSenseMap();
SuspensionAutomata::susCFGVectorType getSusCFG();
SuspensionAutomata::transitionVectorType getSusAuto();
instanceSautoMapType getInstanceSautoMap();
instanceSusCFGMapType getInstanceSusCFGMap();
//private:
string _entryName;
PROCESS_TYPE _procType;
CXXMethodDecl *_entryMethodDecl;
// Add waits.
void addSensitivityInfo(FindSensitivity &);
void addWaits (FindWait &);
void addNotifys(FindNotify &);
void addSusCFGAuto(SuspensionAutomata &);
//void setConstructorStmt (Stmt *);
void setName (string);
void setProcessType (PROCESS_TYPE);
void setEntryMethod (CXXMethodDecl *);
void dumpSusCFG(raw_ostream &);
void dumpSauto(raw_ostream &);
void dump (raw_ostream &, int);
// Hold all the waits.
waitContainerListType _waitCalls;
notifyContainerListType _notifyCalls;
FindSensitivity::senseMapType _senseMap;
vector<Transition*> _susAuto;
vector<SusCFG*> _susCFG;
};
//private:
string _entryName;
PROCESS_TYPE _procType;
CXXMethodDecl *_entryMethodDecl;
// Hold all the waits.
waitContainerListType _waitCalls;
notifyContainerListType _notifyCalls;
FindSensitivity::senseMapType _senseMap;
vector<Transition*> _susAuto;
vector<SusCFG*> _susCFG;
};
}
#endif
......@@ -20,28 +20,28 @@
#include "llvm/Support/raw_ostream.h"
namespace scpar {
using namespace clang;
using namespace std;
using namespace clang;
using namespace std;
class EventContainer {
public:
EventContainer();
EventContainer( string, VarDecl * );
class EventContainer {
public:
EventContainer();
EventContainer( string, VarDecl * );
~EventContainer();
~EventContainer();
// Copy constructor.
EventContainer( const EventContainer & );
// Copy constructor.
EventContainer( const EventContainer & );
string getEventName() const;
string getEventName() const;
VarDecl *getASTNode() const;
void dump ( llvm::raw_ostream & os, int tabn = 0 );
void dump ( llvm::raw_ostream & os, int tabn = 0 );
private:
// Name of port on which the binding happens.
private:
// Name of port on which the binding happens.
string event_name_;
VarDecl *ast_node_;
};
VarDecl *ast_node_;
};
}
#endif
......@@ -7,37 +7,37 @@
#include "Utility.h"
namespace scpar {
using namespace clang;
using namespace std;
using namespace clang;
using namespace std;
class EventDecl {
public:
// Typedefs.
// typedef pair < string, FieldDecl * >eventPairType;
// typedef map < string, FieldDecl * >eventMapType;
class EventDecl {
public:
// Typedefs.
// typedef pair < string, FieldDecl * >eventPairType;
// typedef map < string, FieldDecl * >eventMapType;
// Constructors.
// Constructors.
EventDecl();
EventDecl( const string &, FieldDecl * );
// Copy constructor.
// Copy constructor.
EventDecl( const EventDecl & );
// Destructor.
// Destructor.
~EventDecl();
/// Get parameters
string getName();
FieldDecl *getASTNode();
// Print
void dump (raw_ostream &, int tabn = 0);
/// Get parameters
string getName();
FieldDecl *getASTNode();
// Print
void dump (raw_ostream &, int tabn = 0);
private:
void ptrCheck();
private:
void ptrCheck();
private:
private:
string _name;
FieldDecl *_astNode;
};
FieldDecl *_astNode;
};
}
#endif
......@@ -11,55 +11,55 @@
namespace scpar {
using namespace clang;
using namespace std;
using namespace clang;
using namespace std;
class FindEntryFunctions : public RecursiveASTVisitor < FindEntryFunctions > {
public:
class FindEntryFunctions : public RecursiveASTVisitor < FindEntryFunctions > {
public:
/// Typedefs
typedef vector < EntryFunctionContainer * > entryFunctionVectorType;
/// Typedefs
typedef vector < EntryFunctionContainer * > entryFunctionVectorType;
typedef pair < string, vector < string > > entryFunctionLHSPairType;
typedef map < string, vector < string > > entryFunctionLHSMapType;
typedef pair < string, vector < string > > entryFunctionLHSPairType;
typedef map < string, vector < string > > entryFunctionLHSMapType;
FindEntryFunctions( CXXRecordDecl * d, llvm::raw_ostream & os );
virtual ~FindEntryFunctions();
/// Virtual methods from RecursiveASTVisitor
virtual bool VisitStringLiteral( StringLiteral * l );
virtual bool VisitCXXMethodDecl( CXXMethodDecl * d );
virtual bool VisitMemberExpr( MemberExpr * e );
/// Virtual methods from RecursiveASTVisitor
virtual bool VisitStringLiteral( StringLiteral * l );
virtual bool VisitCXXMethodDecl( CXXMethodDecl * d );
virtual bool VisitMemberExpr( MemberExpr * e );
// Access Methods
CXXRecordDecl *getEntryCXXRecordDecl();
CXXMethodDecl *getEntryMethodDecl();
string getEntryName();
entryFunctionVectorType *getEntryFunctions();
// Access Methods
CXXRecordDecl *getEntryCXXRecordDecl();
CXXMethodDecl *getEntryMethodDecl();
string getEntryName();
entryFunctionVectorType *getEntryFunctions();
vector < CXXMethodDecl * > getOtherFunctions();
void dump();
void dump();
private:
private:
llvm::raw_ostream &os_;
CXXRecordDecl * _d;
bool is_entry_function_;
PROCESS_TYPE proc_type_;
string entry_name_;
CXXRecordDecl *entry_cxx_record_decl_;
CXXMethodDecl *entry_method_decl_;
bool found_entry_decl_;
Stmt *constructor_stmt_;
EntryFunctionContainer *ef;
int pass_;
entryFunctionVectorType entry_function_list_;
entryFunctionLHSMapType entry_function_map_;
bool is_entry_function_;
PROCESS_TYPE proc_type_;
string entry_name_;
CXXRecordDecl *entry_cxx_record_decl_;
CXXMethodDecl *entry_method_decl_;
bool found_entry_decl_;
Stmt *constructor_stmt_;
EntryFunctionContainer *ef;
int pass_;
entryFunctionVectorType entry_function_list_;
entryFunctionLHSMapType entry_function_map_;
vector< CXXMethodDecl * > other_function_list_;
// Disallow constructor with no argument
// Disallow constructor with no argument
FindEntryFunctions( llvm::raw_ostream &os );
};
};
}
#endif
......@@ -10,33 +10,33 @@
//#include "ReflectionContainerClass.h"
namespace scpar {
using namespace clang;
using namespace std;
using namespace clang;
using namespace std;
class FindEvents : public RecursiveASTVisitor < FindEvents > {
public:
/// typedefs
typedef map < string, FieldDecl * > classEventMapType;
typedef pair < string, FieldDecl * > kvType;
class FindEvents : public RecursiveASTVisitor < FindEvents > {
public:
/// typedefs
typedef map < string, FieldDecl * > classEventMapType;
typedef pair < string, FieldDecl * > kvType;
FindEvents(CXXRecordDecl *, llvm::raw_ostream &);
FindEvents(const FindEvents &);
virtual ~FindEvents();
/// RecursiveASTVisitor methods
virtual bool VisitFieldDecl (FieldDecl *);
/// RecursiveASTVisitor methods
virtual bool VisitFieldDecl (FieldDecl *);
/// Access methods
classEventMapType getInClassEvents();
/// Access methods