NewLang Project
Yet another programm language
Loading...
Searching...
No Matches
newlang::Diag Class Reference

#include <diag.h>

Classes

struct  DataDiag
 

Public Types

enum class  State : uint8_t {
  DEFINE_ENUM , none , flag , option ,
  ignored , warning , error
}
 
typedef std::vector< DataDiagDiagListType
 
typedef std::vector< DiagListTypeDiagStackType
 

Public Member Functions

void Push (const TermPtr term=nullptr)
 
void Pop (const TermPtr term=nullptr)
 
bool Apply (const char *name, State state, const TermPtr term=nullptr)
 
Diag::State Test (const char *name)
 
bool TestIgnore (const char *name)
 
bool Emit (const char *name, const TermPtr term=nullptr)
 
bool Register (const char *name, State state, const char *desc=nullptr)
 
virtual ~Diag ()
 
 Diag ()
 
bool ParseArgs (int argc, const char **argv)
 
 Diag (const Diag &)=delete
 
const Diagoperator= (const Diag &)=delete
 

Static Public Member Functions

static const char * toString (State state)
 
static bool IsClang (const std::string name)
 
static bool IsTurnError (const std::string name)
 
static bool IsTurnNoError (const std::string name)
 
static bool IsDisable (const std::string name)
 
static bool IsEnable (const std::string name)
 
static std::string RemoveDiagPrefix (const std::string name)
 
static std::string ChangeState (const std::string name, State from_state, State to_state)
 
static DiagPtr Init (int argc=0, const char **argv=nullptr)
 

Public Attributes

DiagStackType m_diag_stack
 
int m_error_limit
 
int m_error_count
 
bool m_fill_remainder
 

Static Public Attributes

static const char * DIAG_MACRO_NOT_FOUND = "-Wmacro-not-found"
 
static const char * DIAG_MACRO_STORAGE_NOT_EXIST = "-Wmacro-storage-not-exist"
 
static const char * DIAG_ERROR_LIMIT = "-ferror-limit="
 
static const char * DIAG_EXTRA_TOKENS = "-Wextra-tokens"
 
static const char * DIAG_FILL_REMAINDER = "-Wfill-remainder"
 

Detailed Description

Definition at line 32 of file diag.h.

Member Typedef Documentation

◆ DiagListType

typedef std::vector<DataDiag> newlang::Diag::DiagListType

Definition at line 70 of file diag.h.

◆ DiagStackType

Definition at line 71 of file diag.h.

Member Enumeration Documentation

◆ State

enum class newlang::Diag::State : uint8_t
strong
Enumerator
DEFINE_ENUM 
none 
flag 
option 
ignored 
warning 
error 

Definition at line 44 of file diag.h.

Constructor & Destructor Documentation

◆ ~Diag()

virtual newlang::Diag::~Diag ( )
inlinevirtual

Definition at line 145 of file diag.h.

◆ Diag() [1/2]

◆ Diag() [2/2]

newlang::Diag::Diag ( const Diag & )
delete

Member Function Documentation

◆ toString()

static const char * newlang::Diag::toString ( State state)
inlinestatic

Definition at line 50 of file diag.h.

References DEFINE_CASE, and DIAG_STATE.

Referenced by newlang::Parser::PragmaEval().

◆ IsClang()

static bool newlang::Diag::IsClang ( const std::string name)
inlinestatic

Definition at line 80 of file diag.h.

Referenced by RemoveDiagPrefix().

◆ IsTurnError()

static bool newlang::Diag::IsTurnError ( const std::string name)
inlinestatic

Definition at line 84 of file diag.h.

Referenced by IsEnable(), and RemoveDiagPrefix().

◆ IsTurnNoError()

static bool newlang::Diag::IsTurnNoError ( const std::string name)
inlinestatic

Definition at line 88 of file diag.h.

Referenced by IsEnable(), and RemoveDiagPrefix().

◆ IsDisable()

static bool newlang::Diag::IsDisable ( const std::string name)
inlinestatic

Definition at line 92 of file diag.h.

Referenced by IsEnable(), and RemoveDiagPrefix().

◆ IsEnable()

static bool newlang::Diag::IsEnable ( const std::string name)
inlinestatic

Definition at line 96 of file diag.h.

References IsDisable(), IsTurnError(), and IsTurnNoError().

Referenced by RemoveDiagPrefix().

◆ RemoveDiagPrefix()

static std::string newlang::Diag::RemoveDiagPrefix ( const std::string name)
inlinestatic

Definition at line 100 of file diag.h.

References ASSERT, IsClang(), IsDisable(), IsEnable(), IsTurnError(), IsTurnNoError(), and result.

Referenced by ChangeState().

◆ ChangeState()

std::string Diag::ChangeState ( const std::string name,
State from_state,
State to_state )
static

Definition at line 106 of file diag.cpp.

References error, flag, ignored, option, RemoveDiagPrefix(), result, and warning.

◆ Init()

static DiagPtr newlang::Diag::Init ( int argc = 0,
const char ** argv = nullptr )
inlinestatic

Definition at line 127 of file diag.h.

References LOG_RUNTIME.

◆ Push()

void Diag::Push ( const TermPtr term = nullptr)

Definition at line 133 of file diag.cpp.

References ASSERT, and m_diag_stack.

◆ Pop()

void Diag::Pop ( const TermPtr term = nullptr)

Definition at line 138 of file diag.cpp.

References LOG_RUNTIME, m_diag_stack, and NL_PARSER.

◆ Apply()

bool Diag::Apply ( const char * name,
State state,
const TermPtr term = nullptr )

Definition at line 149 of file diag.cpp.

References LOG_RUNTIME, and NL_PARSER.

◆ Test()

Diag::State Diag::Test ( const char * name)

Definition at line 158 of file diag.cpp.

References ASSERT, m_diag_stack, and none.

Referenced by Emit(), Register(), and TestIgnore().

◆ TestIgnore()

bool Diag::TestIgnore ( const char * name)

Definition at line 170 of file diag.cpp.

References ignored, none, and Test().

◆ Emit()

bool Diag::Emit ( const char * name,
const TermPtr term = nullptr )

Definition at line 175 of file diag.cpp.

References error, ignored, LOG_LEVEL_WARNING, LOG_RUNTIME, LOG_WARNING, NL_MESSAGE, NL_PARSER, none, Test(), and warning.

◆ Register()

bool Diag::Register ( const char * name,
State state,
const char * desc = nullptr )

Definition at line 95 of file diag.cpp.

References ASSERT, m_diag_stack, none, and Test().

Referenced by Diag().

◆ ParseArgs()

bool newlang::Diag::ParseArgs ( int argc,
const char ** argv )
inline

Definition at line 152 of file diag.h.

◆ operator=()

const Diag & newlang::Diag::operator= ( const Diag & )
delete

Member Data Documentation

◆ DIAG_MACRO_NOT_FOUND

const char* newlang::Diag::DIAG_MACRO_NOT_FOUND = "-Wmacro-not-found"
inlinestatic

Definition at line 74 of file diag.h.

Referenced by Diag(), and newlang::ProcessMacro().

◆ DIAG_MACRO_STORAGE_NOT_EXIST

const char* newlang::Diag::DIAG_MACRO_STORAGE_NOT_EXIST = "-Wmacro-storage-not-exist"
inlinestatic

Definition at line 75 of file diag.h.

Referenced by Diag().

◆ DIAG_ERROR_LIMIT

const char* newlang::Diag::DIAG_ERROR_LIMIT = "-ferror-limit="
inlinestatic

Definition at line 76 of file diag.h.

Referenced by Diag().

◆ DIAG_EXTRA_TOKENS

const char* newlang::Diag::DIAG_EXTRA_TOKENS = "-Wextra-tokens"
inlinestatic

Definition at line 77 of file diag.h.

Referenced by Diag().

◆ DIAG_FILL_REMAINDER

const char* newlang::Diag::DIAG_FILL_REMAINDER = "-Wfill-remainder"
inlinestatic

Definition at line 78 of file diag.h.

Referenced by Diag().

◆ m_diag_stack

DiagStackType newlang::Diag::m_diag_stack

Definition at line 193 of file diag.h.

Referenced by Diag(), Pop(), Push(), Register(), and Test().

◆ m_error_limit

int newlang::Diag::m_error_limit

Definition at line 195 of file diag.h.

Referenced by newlang::AstAnalysis::CheckError(), and Diag().

◆ m_error_count

int newlang::Diag::m_error_count

Definition at line 196 of file diag.h.

Referenced by newlang::AstAnalysis::Analyze(), newlang::AstAnalysis::CheckError(), and Diag().

◆ m_fill_remainder

bool newlang::Diag::m_fill_remainder

Definition at line 197 of file diag.h.

Referenced by Diag().


The documentation for this class was generated from the following files: