Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ target_include_directories(cli_objs PRIVATE ${PROJECT_SOURCE_DIR}/externals/simp

if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14)
# false positive warning in up to Clang 13 - caused by FD_ZERO macro
set_source_files_properties(threadexecutor.cpp PROPERTIES COMPILE_FLAGS -Wno-reserved-identifier)
set_source_files_properties(processexecutor.cpp PROPERTIES COMPILE_FLAGS -Wno-reserved-identifier)
endif()

list(APPEND cppcheck_SOURCES ${hdrs} ${mainfile} $<TARGET_OBJECTS:cli_objs> $<TARGET_OBJECTS:lib_objs> $<TARGET_OBJECTS:simplecpp_objs>)
Expand Down
4 changes: 2 additions & 2 deletions lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2303,11 +2303,11 @@ Function::Function(const Tokenizer *mTokenizer,
nestedIn(scope),
initArgCount(0),
type(eFunction),
access(AccessControl::Public),
noexceptArg(nullptr),
throwArg(nullptr),
templateDef(nullptr),
functionPointerUsage(nullptr),
access(AccessControl::Public),
mFlags(0)
{
// operator function
Expand Down Expand Up @@ -2423,11 +2423,11 @@ Function::Function(const Token *tokenDef, const std::string &clangType)
nestedIn(nullptr),
initArgCount(0),
type(eFunction),
access(AccessControl::Public),
noexceptArg(nullptr),
throwArg(nullptr),
templateDef(nullptr),
functionPointerUsage(nullptr),
access(AccessControl::Public),
mFlags(0)
{
// operator function
Expand Down
2 changes: 1 addition & 1 deletion lib/symboldatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -918,11 +918,11 @@ class CPPCHECKLIB Function {
std::list<Variable> argumentList; ///< argument list
nonneg int initArgCount; ///< number of args with default values
Type type; ///< constructor, destructor, ...
AccessControl access; ///< public/protected/private
const Token *noexceptArg; ///< noexcept token
const Token *throwArg; ///< throw token
const Token *templateDef; ///< points to 'template <' before function
const Token *functionPointerUsage; ///< function pointer usage
AccessControl access; ///< public/protected/private

bool argsMatch(const Scope *scope, const Token *first, const Token *second, const std::string &path, nonneg int path_length) const;

Expand Down
37 changes: 18 additions & 19 deletions lib/token.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,20 @@ struct TokenImpl {
nonneg int mColumn;
nonneg int mExprId;

/**
* A value from 0-100 that provides a rough idea about where in the token
* list this token is located.
*/
nonneg int mProgressValue;

/**
* Token index. Position in token list
*/
nonneg int mIndex;

/** Bitfield bit count. */
unsigned char mBits;

// AST..
Token *mAstOperand1;
Token *mAstOperand2;
Expand All @@ -88,17 +102,6 @@ struct TokenImpl {
const Enumerator *mEnumerator;
};

/**
* A value from 0-100 that provides a rough idea about where in the token
* list this token is located.
*/
nonneg int mProgressValue;

/**
* Token index. Position in token list
*/
nonneg int mIndex;

// original name like size_t
std::string* mOriginalName;

Expand Down Expand Up @@ -126,9 +129,6 @@ struct TokenImpl {
// For memoization, to speed up parsing of huge arrays #8897
enum class Cpp11init {UNKNOWN, CPP11INIT, NOINIT} mCpp11init;

/** Bitfield bit count. */
unsigned char mBits;

TokenDebug mDebug;

void setCppcheckAttribute(CppcheckAttributes::Type type, MathLib::bigint value);
Expand All @@ -140,22 +140,21 @@ struct TokenImpl {
mLineNumber(0),
mColumn(0),
mExprId(0),
mProgressValue(0),
mIndex(0),
mBits(0),
mAstOperand1(nullptr),
mAstOperand2(nullptr),
mAstParent(nullptr),
mScope(nullptr),
mFunction(nullptr) // Initialize whole union
,
mProgressValue(0),
mIndex(0),
mFunction(nullptr), // Initialize whole union
mOriginalName(nullptr),
mValueType(nullptr),
mValues(nullptr),
mTemplateSimplifierPointers(nullptr),
mScopeInfo(nullptr),
mCppcheckAttributes(nullptr),
mCpp11init(Cpp11init::UNKNOWN),
mBits(0),
mDebug(TokenDebug::None)
{}

Expand Down
2 changes: 1 addition & 1 deletion lib/valueflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8526,7 +8526,6 @@ ValueFlow::Value::Value(const Token* c, long long val, Bound b)
intvalue(val),
tokvalue(nullptr),
floatValue(0.0),
moveKind(MoveKind::NonMovedVariable),
varvalue(val),
condition(c),
varId(0),
Expand All @@ -8535,6 +8534,7 @@ ValueFlow::Value::Value(const Token* c, long long val, Bound b)
macro(false),
defaultArg(false),
indirect(0),
moveKind(MoveKind::NonMovedVariable),
path(0),
wideintvalue(0),
subexpressions(),
Expand Down
16 changes: 8 additions & 8 deletions lib/valueflow.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ namespace ValueFlow {
intvalue(val),
tokvalue(nullptr),
floatValue(0.0),
moveKind(MoveKind::NonMovedVariable),
varvalue(val),
condition(nullptr),
varId(0U),
Expand All @@ -102,6 +101,7 @@ namespace ValueFlow {
macro(false),
defaultArg(false),
indirect(0),
moveKind(MoveKind::NonMovedVariable),
path(0),
wideintvalue(val),
subexpressions(),
Expand Down Expand Up @@ -331,9 +331,6 @@ namespace ValueFlow {
/** float value */
double floatValue;

/** kind of moved */
enum class MoveKind {NonMovedVariable, MovedVariable, ForwardedVariable} moveKind;

/** For calculated values - variable value that calculated value depends on */
long long varvalue;

Expand Down Expand Up @@ -361,6 +358,9 @@ namespace ValueFlow {

int indirect;

/** kind of moved */
enum class MoveKind {NonMovedVariable, MovedVariable, ForwardedVariable} moveKind;

/** Path id */
MathLib::bigint path;

Expand Down Expand Up @@ -472,18 +472,18 @@ bool isContainerSizeChanged(const Token* tok, const Settings* settings = nullptr

struct LifetimeToken {
const Token* token;
bool addressOf;
ValueFlow::Value::ErrorPath errorPath;
bool addressOf;
bool inconclusive;

LifetimeToken() : token(nullptr), addressOf(false), errorPath(), inconclusive(false) {}
LifetimeToken() : token(nullptr), errorPath(), addressOf(false), inconclusive(false) {}

LifetimeToken(const Token* token, ValueFlow::Value::ErrorPath errorPath)
: token(token), addressOf(false), errorPath(std::move(errorPath)), inconclusive(false)
: token(token), errorPath(std::move(errorPath)), addressOf(false), inconclusive(false)
{}

LifetimeToken(const Token* token, bool addressOf, ValueFlow::Value::ErrorPath errorPath)
: token(token), addressOf(addressOf), errorPath(std::move(errorPath)), inconclusive(false)
: token(token), errorPath(std::move(errorPath)), addressOf(addressOf), inconclusive(false)
{}

static std::vector<LifetimeToken> setAddressOf(std::vector<LifetimeToken> v, bool b) {
Expand Down