Commit 331b6176 authored by Twiga's avatar Twiga

Start to use scoped enums and c++17

parent e7490f90
......@@ -8,20 +8,19 @@ EntryFunctionContainer::~EntryFunctionContainer ()
// 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)
:_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;
_procType = from._procType;
_entryMethodDecl = from._entryMethodDecl;
......@@ -187,13 +186,13 @@ void EntryFunctionContainer::dump (raw_ostream & os, int tabn)
os << "EntryFunctionContainer '" << getName () << "' processType '";
switch (getProcessType ())
{
case THREAD:
case PROCESS_TYPE::THREAD:
os << "SC_THREAD' ";
break;
case METHOD:
case PROCESS_TYPE::METHOD:
os << "SC_METHOD' ";
break;
case CTHREAD:
case PROCESS_TYPE::CTHREAD:
os << "SC_CTHREAD' ";
break;
default:
......
......@@ -6,7 +6,7 @@ FindEntryFunctions::FindEntryFunctions( CXXRecordDecl * d, llvm::raw_ostream & o
os_{os},
_d{d},
is_entry_function_{false},
proc_type_{NONE},
proc_type_{PROCESS_TYPE::NONE},
entry_cxx_record_decl_{nullptr},
entry_method_decl_{nullptr},
found_entry_decl_{false},
......@@ -51,13 +51,13 @@ bool FindEntryFunctions::VisitMemberExpr (MemberExpr * e) {
//os_ << "####: MemberExpr -- " << memberName << "\n";
if ( memberName == "create_method_process" ) {
proc_type_ = METHOD;
proc_type_ = PROCESS_TYPE::METHOD;
}
else if ( memberName == "create_thread_process" ) {
proc_type_ = THREAD;
proc_type_ = PROCESS_TYPE::THREAD;
}
else if ( memberName == "create_cthread_process" ) {
proc_type_ = CTHREAD;
proc_type_ = PROCESS_TYPE::CTHREAD;
}
break;
}
......@@ -84,7 +84,7 @@ bool FindEntryFunctions::VisitStringLiteral( StringLiteral * s ) {
ef->setName( entry_name_ );
ef->setProcessType( proc_type_ );
if ( proc_type_ != 0 ) {
if ( proc_type_ != PROCESS_TYPE::NONE ) {
entry_function_list_.push_back( ef );
}
/* ef->constructor_stmt_ = constructor_stmt_;
......@@ -163,13 +163,13 @@ void FindEntryFunctions::dump() {
os_ << "\n:> Entry function name: " << ef->getName() <<
", process type: ";
switch ( ef->getProcessType() ) {
case THREAD:
case PROCESS_TYPE::THREAD:
os_ << " SC_THREAD\n";
break;
case METHOD:
case PROCESS_TYPE::METHOD:
os_ << " SC_METHOD\n";
break;
case CTHREAD:
case PROCESS_TYPE::CTHREAD:
os_ << " SC_CTHREAD\n";
break;
default:
......
......@@ -136,15 +136,15 @@ void ModuleDecl::addProcess( FindEntryFunctions::entryFunctionVectorType * efv )
// Set the process type
switch (ef->_procType) {
case THREAD: {
case PROCESS_TYPE::THREAD: {
entryType = "SC_THREAD";
break;
}
case METHOD: {
case PROCESS_TYPE::METHOD: {
entryType = "SC_METHOD";
break;
}
case CTHREAD: {
case PROCESS_TYPE::CTHREAD: {
entryType = "SC_CTHREAD";
break;
}
......
......@@ -15,16 +15,16 @@
#define _ENUM_H_
namespace scpar {
enum ASTSTATE {
enum class ASTSTATE {
EMPTY, DECLSTMT, MEMBEREXPR, CXXOPERATORCALLEXPR, CXXCONSTRUCTEXPR
}; // End enum ASTSTATE
enum ReadWrite {
enum class ReadWrite {
RWINIT, READ, WRITE
}; // End enum ReadWrite
enum PROCESS_TYPE {
enum class PROCESS_TYPE {
NONE, THREAD, CTHREAD, METHOD
}; // End enum PROCESS_TYPE
} // 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