Commit 331b6176 authored by Twiga's avatar Twiga
Browse files

Start to use scoped enums and c++17

parent e7490f90
...@@ -8,20 +8,19 @@ EntryFunctionContainer::~EntryFunctionContainer () ...@@ -8,20 +8,19 @@ EntryFunctionContainer::~EntryFunctionContainer ()
// DO NOT free anything. // DO NOT free anything.
} }
EntryFunctionContainer::EntryFunctionContainer ():_entryName ("NONE"), _procType (NONE), _entryMethodDecl (NULL) EntryFunctionContainer::EntryFunctionContainer () :
{ _entryName ("NONE"),
_procType (PROCESS_TYPE::NONE),
_entryMethodDecl (nullptr) {
} }
EntryFunctionContainer::EntryFunctionContainer (string n, PROCESS_TYPE p, CXXMethodDecl * d, Stmt * s) EntryFunctionContainer::EntryFunctionContainer (string n, PROCESS_TYPE p, CXXMethodDecl * d, Stmt * s)
:_entryName (n), _procType (p), _entryMethodDecl (d) :_entryName (n), _procType (p), _entryMethodDecl (d) {
{
} }
EntryFunctionContainer::EntryFunctionContainer (const EntryFunctionContainer & from) {
EntryFunctionContainer::EntryFunctionContainer (const EntryFunctionContainer & from)
{
_entryName = from._entryName; _entryName = from._entryName;
_procType = from._procType; _procType = from._procType;
_entryMethodDecl = from._entryMethodDecl; _entryMethodDecl = from._entryMethodDecl;
...@@ -187,13 +186,13 @@ void EntryFunctionContainer::dump (raw_ostream & os, int tabn) ...@@ -187,13 +186,13 @@ void EntryFunctionContainer::dump (raw_ostream & os, int tabn)
os << "EntryFunctionContainer '" << getName () << "' processType '"; os << "EntryFunctionContainer '" << getName () << "' processType '";
switch (getProcessType ()) switch (getProcessType ())
{ {
case THREAD: case PROCESS_TYPE::THREAD:
os << "SC_THREAD' "; os << "SC_THREAD' ";
break; break;
case METHOD: case PROCESS_TYPE::METHOD:
os << "SC_METHOD' "; os << "SC_METHOD' ";
break; break;
case CTHREAD: case PROCESS_TYPE::CTHREAD:
os << "SC_CTHREAD' "; os << "SC_CTHREAD' ";
break; break;
default: default:
......
...@@ -6,7 +6,7 @@ FindEntryFunctions::FindEntryFunctions( CXXRecordDecl * d, llvm::raw_ostream & o ...@@ -6,7 +6,7 @@ FindEntryFunctions::FindEntryFunctions( CXXRecordDecl * d, llvm::raw_ostream & o
os_{os}, os_{os},
_d{d}, _d{d},
is_entry_function_{false}, is_entry_function_{false},
proc_type_{NONE}, proc_type_{PROCESS_TYPE::NONE},
entry_cxx_record_decl_{nullptr}, entry_cxx_record_decl_{nullptr},
entry_method_decl_{nullptr}, entry_method_decl_{nullptr},
found_entry_decl_{false}, found_entry_decl_{false},
...@@ -51,13 +51,13 @@ bool FindEntryFunctions::VisitMemberExpr (MemberExpr * e) { ...@@ -51,13 +51,13 @@ bool FindEntryFunctions::VisitMemberExpr (MemberExpr * e) {
//os_ << "####: MemberExpr -- " << memberName << "\n"; //os_ << "####: MemberExpr -- " << memberName << "\n";
if ( memberName == "create_method_process" ) { if ( memberName == "create_method_process" ) {
proc_type_ = METHOD; proc_type_ = PROCESS_TYPE::METHOD;
} }
else if ( memberName == "create_thread_process" ) { else if ( memberName == "create_thread_process" ) {
proc_type_ = THREAD; proc_type_ = PROCESS_TYPE::THREAD;
} }
else if ( memberName == "create_cthread_process" ) { else if ( memberName == "create_cthread_process" ) {
proc_type_ = CTHREAD; proc_type_ = PROCESS_TYPE::CTHREAD;
} }
break; break;
} }
...@@ -84,7 +84,7 @@ bool FindEntryFunctions::VisitStringLiteral( StringLiteral * s ) { ...@@ -84,7 +84,7 @@ bool FindEntryFunctions::VisitStringLiteral( StringLiteral * s ) {
ef->setName( entry_name_ ); ef->setName( entry_name_ );
ef->setProcessType( proc_type_ ); ef->setProcessType( proc_type_ );
if ( proc_type_ != 0 ) { if ( proc_type_ != PROCESS_TYPE::NONE ) {
entry_function_list_.push_back( ef ); entry_function_list_.push_back( ef );
} }
/* ef->constructor_stmt_ = constructor_stmt_; /* ef->constructor_stmt_ = constructor_stmt_;
...@@ -163,13 +163,13 @@ void FindEntryFunctions::dump() { ...@@ -163,13 +163,13 @@ void FindEntryFunctions::dump() {
os_ << "\n:> Entry function name: " << ef->getName() << os_ << "\n:> Entry function name: " << ef->getName() <<
", process type: "; ", process type: ";
switch ( ef->getProcessType() ) { switch ( ef->getProcessType() ) {
case THREAD: case PROCESS_TYPE::THREAD:
os_ << " SC_THREAD\n"; os_ << " SC_THREAD\n";
break; break;
case METHOD: case PROCESS_TYPE::METHOD:
os_ << " SC_METHOD\n"; os_ << " SC_METHOD\n";
break; break;
case CTHREAD: case PROCESS_TYPE::CTHREAD:
os_ << " SC_CTHREAD\n"; os_ << " SC_CTHREAD\n";
break; break;
default: default:
......
...@@ -136,15 +136,15 @@ void ModuleDecl::addProcess( FindEntryFunctions::entryFunctionVectorType * efv ) ...@@ -136,15 +136,15 @@ void ModuleDecl::addProcess( FindEntryFunctions::entryFunctionVectorType * efv )
// Set the process type // Set the process type
switch (ef->_procType) { switch (ef->_procType) {
case THREAD: { case PROCESS_TYPE::THREAD: {
entryType = "SC_THREAD"; entryType = "SC_THREAD";
break; break;
} }
case METHOD: { case PROCESS_TYPE::METHOD: {
entryType = "SC_METHOD"; entryType = "SC_METHOD";
break; break;
} }
case CTHREAD: { case PROCESS_TYPE::CTHREAD: {
entryType = "SC_CTHREAD"; entryType = "SC_CTHREAD";
break; break;
} }
......
...@@ -15,16 +15,16 @@ ...@@ -15,16 +15,16 @@
#define _ENUM_H_ #define _ENUM_H_
namespace scpar { namespace scpar {
enum ASTSTATE { enum class ASTSTATE {
EMPTY, DECLSTMT, MEMBEREXPR, CXXOPERATORCALLEXPR, CXXCONSTRUCTEXPR EMPTY, DECLSTMT, MEMBEREXPR, CXXOPERATORCALLEXPR, CXXCONSTRUCTEXPR
}; // End enum ASTSTATE }; // End enum ASTSTATE
enum ReadWrite { enum class ReadWrite {
RWINIT, READ, WRITE RWINIT, READ, WRITE
}; // End enum ReadWrite }; // End enum ReadWrite
enum PROCESS_TYPE { enum class PROCESS_TYPE {
NONE, THREAD, CTHREAD, METHOD NONE, THREAD, CTHREAD, METHOD
}; // End enum PROCESS_TYPE }; // End enum PROCESS_TYPE
} // End namespace scpar } // End namespace scpar
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment