Add (disabled) function in SymbolDatabase to check variable list (e.g. find variables w/o scope). Fix some doxygen warnings.
This commit is contained in:
parent
d12197ce1a
commit
d45f5c94cb
|
@ -33,8 +33,8 @@ class Settings;
|
|||
|
||||
/**
|
||||
* @brief A preprocessor directive
|
||||
* Each preprocessor directive (#include, #define, #undef,#if, #ifdef,
|
||||
* #else, #endif) will be recorded as an instance of this class.
|
||||
* Each preprocessor directive (\#include, \#define, \#undef, \#if, \#ifdef, \#else, \#endif)
|
||||
* will be recorded as an instance of this class.
|
||||
*
|
||||
* file and linenr denote the location where where the directive is defined.
|
||||
*
|
||||
|
|
|
@ -1372,13 +1372,12 @@ bool SymbolDatabase::isFunction(const Token *tok, const Scope* outerScope, const
|
|||
return false;
|
||||
}
|
||||
|
||||
void SymbolDatabase::validate() const
|
||||
void SymbolDatabase::validateExecutableScopes() const
|
||||
{
|
||||
if (_settings->debugwarnings) {
|
||||
const std::size_t functions = functionScopes.size();
|
||||
for (std::size_t i = 0; i < functions; ++i) {
|
||||
const Scope* scope = functionScopes[i];
|
||||
const Function* function = scope->function;
|
||||
const Scope* const scope = functionScopes[i];
|
||||
const Function* const function = scope->function;
|
||||
if (scope->isExecutable() && !function) {
|
||||
const std::list<const Token*> callstack(1, scope->classDef);
|
||||
const std::string msg = std::string("Executable scope '") + scope->classDef->str() + "' with unknown function.";
|
||||
|
@ -1388,11 +1387,26 @@ void SymbolDatabase::validate() const
|
|||
false);
|
||||
_errorLogger->reportErr(errmsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SymbolDatabase::validateVariables() const
|
||||
{
|
||||
for (std::vector<const Variable *>::const_iterator iter = _variableList.begin(); iter!=_variableList.end(); ++iter) {
|
||||
if (*iter && !(*iter)->scope()) {
|
||||
throw InternalError((*iter)->nameToken(), "Analysis failed (variable without scope). If the code is valid then please report this failure.", InternalError::INTERNAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SymbolDatabase::validate() const
|
||||
{
|
||||
if (_settings->debugwarnings) {
|
||||
validateExecutableScopes();
|
||||
}
|
||||
//validateVariables();
|
||||
}
|
||||
|
||||
bool Variable::isPointerArray() const
|
||||
{
|
||||
return isArray() && nameToken() && nameToken()->previous() && (nameToken()->previous()->str() == "*");
|
||||
|
|
|
@ -1026,6 +1026,12 @@ public:
|
|||
*/
|
||||
void validate() const;
|
||||
|
||||
void validateExecutableScopes() const;
|
||||
/**
|
||||
* @brief Check variable list, e.g. variables w/o scope
|
||||
*/
|
||||
void validateVariables() const;
|
||||
|
||||
/** Set valuetype in provided tokenlist */
|
||||
static void setValueTypeInTokenList(Token *tokens, bool cpp, char defaultSignedness);
|
||||
|
||||
|
|
Loading…
Reference in New Issue