Skip to content
Draft
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
7 changes: 7 additions & 0 deletions lib/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,13 @@
# define RET_NONNULL
#endif

// lifetimebound
#if __has_cpp_attribute (clang::lifetimebound)
# define LIFETIMEBOUND [[clang::lifetimebound]]
#else
# define LIFETIMEBOUND
#endif

#define REQUIRES(msg, ...) class=typename std::enable_if<__VA_ARGS__::value>::type

// Use the nonneg macro when you want to assert that a variable/argument is not negative
Expand Down
2 changes: 1 addition & 1 deletion lib/cppcheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static const CWE CWE398(398U); // Indicator of Poor Code Quality
class CppCheck::CppCheckLogger : public ErrorLogger
{
public:
CppCheckLogger(ErrorLogger& errorLogger, const Settings& settings, Suppressions& suppressions, bool useGlobalSuppressions)
CppCheckLogger(ErrorLogger& errorLogger LIFETIMEBOUND, const Settings& settings LIFETIMEBOUND, Suppressions& suppressions LIFETIMEBOUND, bool useGlobalSuppressions)
: mErrorLogger(errorLogger)
, mSettings(settings)
, mSuppressions(suppressions)
Expand Down
6 changes: 3 additions & 3 deletions lib/cppcheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ class CPPCHECKLIB CppCheck {
/**
* @brief Constructor.
*/
CppCheck(const Settings& settings,
Suppressions& supprs,
ErrorLogger &errorLogger,
CppCheck(const Settings& settings LIFETIMEBOUND,
Suppressions& supprs LIFETIMEBOUND,
ErrorLogger &errorLogger LIFETIMEBOUND,
bool useGlobalSuppressions,
ExecuteCmdFn executeCommand);

Expand Down
2 changes: 1 addition & 1 deletion lib/fwdanalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Settings;
*/
class FwdAnalysis {
public:
explicit FwdAnalysis(const Settings &settings) : mSettings(settings) {}
explicit FwdAnalysis(const Settings &settings LIFETIMEBOUND) : mSettings(settings) {}

bool hasOperand(const Token *tok, const Token *lhs) const;

Expand Down
2 changes: 1 addition & 1 deletion lib/preprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class CPPCHECKLIB WARN_UNUSED Preprocessor {
/** character that is inserted in expanded macros */
static char macroChar;

Preprocessor(simplecpp::TokenList& tokens, const Settings& settings, ErrorLogger &errorLogger, Standards::Language lang);
Preprocessor(simplecpp::TokenList& tokens LIFETIMEBOUND, const Settings& settings LIFETIMEBOUND, ErrorLogger &errorLogger LIFETIMEBOUND, Standards::Language lang);

void inlineSuppressions(SuppressionList &suppressions);

Expand Down
6 changes: 3 additions & 3 deletions lib/symboldatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -1038,8 +1038,8 @@ class CPPCHECKLIB Scope {
const Scope *scope;
};

Scope(const SymbolDatabase &symdb_, const Token *classDef_, const Scope *nestedIn_);
Scope(const SymbolDatabase &symdb_, const Token *classDef_, const Scope *nestedIn_, ScopeType type_, const Token *start_);
Scope(const SymbolDatabase &symdb_ LIFETIMEBOUND, const Token *classDef_, const Scope *nestedIn_);
Scope(const SymbolDatabase &symdb_ LIFETIMEBOUND, const Token *classDef_, const Scope *nestedIn_, ScopeType type_, const Token *start_);

const SymbolDatabase& symdb;
std::string className;
Expand Down Expand Up @@ -1327,7 +1327,7 @@ class CPPCHECKLIB ValueType {
class CPPCHECKLIB SymbolDatabase {
friend class TestSymbolDatabase;
public:
explicit SymbolDatabase(Tokenizer& tokenizer);
explicit SymbolDatabase(Tokenizer& tokenizer LIFETIMEBOUND);
~SymbolDatabase();

/** @brief Information about all namespaces/classes/structures */
Expand Down
2 changes: 1 addition & 1 deletion lib/templatesimplifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class CPPCHECKLIB TemplateSimplifier {
friend class TestSimplifyTemplate;

public:
explicit TemplateSimplifier(Tokenizer &tokenizer);
explicit TemplateSimplifier(Tokenizer &tokenizer LIFETIMEBOUND);

const std::string& dump() const {
return mDump;
Expand Down
2 changes: 1 addition & 1 deletion lib/token.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class CPPCHECKLIB Token {
eNone
};

Token(const TokenList& tokenlist, std::shared_ptr<TokensFrontBack> tokensFrontBack);
Token(const TokenList& tokenlist LIFETIMEBOUND, std::shared_ptr<TokensFrontBack> tokensFrontBack);
// for usage in CheckIO::ArgumentInfo only
explicit Token(const Token *tok);
~Token();
Expand Down
2 changes: 1 addition & 1 deletion lib/tokenize.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class CPPCHECKLIB Tokenizer {
friend class SymbolDatabase;

public:
Tokenizer(TokenList tokenList, ErrorLogger &errorLogger);
Tokenizer(TokenList tokenList, ErrorLogger &errorLogger LIFETIMEBOUND);
~Tokenizer();

void setTimerResults(TimerResults *tr) {
Expand Down
2 changes: 1 addition & 1 deletion lib/tokenlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct TokensFrontBack {

class CPPCHECKLIB TokenList {
public:
explicit TokenList(const Settings& settings, Standards::Language lang);
explicit TokenList(const Settings& settings LIFETIMEBOUND, Standards::Language lang);
~TokenList();

TokenList(const TokenList &) = delete;
Expand Down