|
Cppcheck
|
Class that the preprocessor uses when it expands macros. More...
Public Member Functions | |
| PreprocessorMacro (const std::string ¯o) | |
| Constructor for PreprocessorMacro. | |
| const Token * | tokens () const |
| return tokens of this macro | |
| const std::vector< std::string > & | params () const |
| read parameters of this macro | |
| bool | variadic () const |
| check if this is macro has a variable number of parameters | |
| bool | nopar () const |
| Check if this macro has parentheses but no parameters. | |
| const std::string & | name () const |
| name of macro | |
| bool | code (const std::vector< std::string > ¶ms2, const std::map< std::string, PreprocessorMacro * > ¯os, std::string ¯ocode) const |
| get expanded code for this macro | |
Private Member Functions | |
| void | operator= (const PreprocessorMacro &) |
| disabled assignment operator | |
| std::vector< std::string > | expandInnerMacros (const std::vector< std::string > ¶ms1, const std::map< std::string, PreprocessorMacro * > ¯os) const |
| expand inner macro | |
Private Attributes | |
| Settings | settings |
| Tokenizer | tokenizer |
| tokens of this macro | |
| std::vector< std::string > | _params |
| macro parameters | |
| std::string | _name |
| name of macro | |
| const std::string | _macro |
| macro definition in plain text | |
| const std::string | _prefix |
| prefix that is used by cppcheck to separate macro parameters. | |
| bool | _variadic |
| does this macro take a variable number of parameters? | |
| bool | _nopar |
| The macro has parentheses but no parameters. | |
Class that the preprocessor uses when it expands macros.
This class represents a preprocessor macro
Definition at line 2349 of file preprocessor.cpp.
| PreprocessorMacro::PreprocessorMacro | ( | const std::string & | macro | ) | [inline, explicit] |
Constructor for PreprocessorMacro.
This is the "setter" for this class - everything is setup here.
| macro | The code after define, until end of line, e.g. "A(x) foo(x);" |
Definition at line 2436 of file preprocessor.cpp.
References _name, _nopar, _params, _variadic, TokenList::createTokens(), Tokenizer::list, Token::Match(), Token::next(), Tokenizer::setSettings(), settings, Token::simpleMatch(), Token::str(), tokenizer, and tokens().
| bool PreprocessorMacro::code | ( | const std::vector< std::string > & | params2, |
| const std::map< std::string, PreprocessorMacro * > & | macros, | ||
| std::string & | macrocode | ||
| ) | const [inline] |
get expanded code for this macro
| params2 | macro parameters |
| macros | macro definitions (recursion) |
| macrocode | output string |
Definition at line 2509 of file preprocessor.cpp.
References _macro, _nopar, _params, _variadic, expandInnerMacros(), Token::isName(), Token::Match(), Token::next(), Token::simpleMatch(), Token::str(), Token::strAt(), and tokens().
Referenced by expandInnerMacros(), and Preprocessor::expandMacros().
| std::vector<std::string> PreprocessorMacro::expandInnerMacros | ( | const std::vector< std::string > & | params1, |
| const std::map< std::string, PreprocessorMacro * > & | macros | ||
| ) | const [inline, private] |
expand inner macro
Definition at line 2378 of file preprocessor.cpp.
References code(), Token::findsimplematch(), getparams(), Token::Match(), Token::strAt(), Token::tokAt(), and tokens().
Referenced by code().
| const std::string& PreprocessorMacro::name | ( | ) | const [inline] |
name of macro
Definition at line 2498 of file preprocessor.cpp.
References _name.
Referenced by Preprocessor::expandMacros().
| bool PreprocessorMacro::nopar | ( | ) | const [inline] |
Check if this macro has parentheses but no parameters.
Definition at line 2493 of file preprocessor.cpp.
References _nopar.
Referenced by Preprocessor::expandMacros().
| void PreprocessorMacro::operator= | ( | const PreprocessorMacro & | ) | [private] |
disabled assignment operator
| const std::vector<std::string>& PreprocessorMacro::params | ( | ) | const [inline] |
read parameters of this macro
Definition at line 2483 of file preprocessor.cpp.
References _params.
Referenced by Preprocessor::expandMacros().
| const Token* PreprocessorMacro::tokens | ( | ) | const [inline] |
return tokens of this macro
Definition at line 2478 of file preprocessor.cpp.
References tokenizer, and Tokenizer::tokens().
Referenced by code(), expandInnerMacros(), and PreprocessorMacro().
| bool PreprocessorMacro::variadic | ( | ) | const [inline] |
check if this is macro has a variable number of parameters
Definition at line 2488 of file preprocessor.cpp.
References _variadic.
Referenced by Preprocessor::expandMacros().
const std::string PreprocessorMacro::_macro [private] |
macro definition in plain text
Definition at line 2363 of file preprocessor.cpp.
Referenced by code().
std::string PreprocessorMacro::_name [private] |
name of macro
Definition at line 2360 of file preprocessor.cpp.
Referenced by name(), and PreprocessorMacro().
bool PreprocessorMacro::_nopar [private] |
The macro has parentheses but no parameters.
. "AAA()"
Definition at line 2372 of file preprocessor.cpp.
Referenced by code(), nopar(), and PreprocessorMacro().
std::vector<std::string> PreprocessorMacro::_params [private] |
macro parameters
Definition at line 2357 of file preprocessor.cpp.
Referenced by code(), params(), and PreprocessorMacro().
const std::string PreprocessorMacro::_prefix [private] |
prefix that is used by cppcheck to separate macro parameters.
Always "__cppcheck__"
Definition at line 2366 of file preprocessor.cpp.
bool PreprocessorMacro::_variadic [private] |
does this macro take a variable number of parameters?
Definition at line 2369 of file preprocessor.cpp.
Referenced by code(), PreprocessorMacro(), and variadic().
Settings PreprocessorMacro::settings [private] |
Definition at line 2351 of file preprocessor.cpp.
Referenced by PreprocessorMacro().
Tokenizer PreprocessorMacro::tokenizer [private] |
tokens of this macro
Definition at line 2354 of file preprocessor.cpp.
Referenced by PreprocessorMacro(), and tokens().
1.7.6.1