Running astlye [ci skip]
This commit is contained in:
parent
ef6c0e6a43
commit
bb451ca289
|
@ -65,8 +65,8 @@ void TestCppcheckLibraryData::podtypeValid()
|
|||
QCOMPARE(libraryData.podtypes[0].sign.isEmpty(), true);
|
||||
QCOMPARE(libraryData.podtypes[0].size.isEmpty(), true);
|
||||
|
||||
QCOMPARE(libraryData.podtypes[1].name, "ulong");
|
||||
QCOMPARE(libraryData.podtypes[1].stdtype, "uint32_t");
|
||||
QCOMPARE(libraryData.podtypes[1].name, "ulong");
|
||||
QCOMPARE(libraryData.podtypes[1].stdtype, "uint32_t");
|
||||
QCOMPARE(libraryData.podtypes[1].sign, "u");
|
||||
QCOMPARE(libraryData.podtypes[1].size, "4");
|
||||
|
||||
|
|
|
@ -1741,7 +1741,7 @@ void CheckStl::missingComparison()
|
|||
if (!tok3)
|
||||
break;
|
||||
} else if (Token::simpleMatch(tok3->astParent(), "++"))
|
||||
incrementToken = tok3;
|
||||
incrementToken = tok3;
|
||||
else if (Token::simpleMatch(tok3->astParent(), "+")) {
|
||||
if (Token::Match(tok3->astSibling(), "%num%")) {
|
||||
const Token* tokenGrandParent = tok3->astParent()->astParent();
|
||||
|
|
|
@ -21,8 +21,7 @@ struct ForwardTraversal {
|
|||
bool analyzeOnly;
|
||||
Terminate terminate = Terminate::None;
|
||||
|
||||
Progress Break(Terminate t = Terminate::None)
|
||||
{
|
||||
Progress Break(Terminate t = Terminate::None) {
|
||||
if (!analyzeOnly && t != Terminate::None)
|
||||
terminate = t;
|
||||
return Progress::Break;
|
||||
|
@ -225,15 +224,14 @@ struct ForwardTraversal {
|
|||
ft.updateRange(start, end);
|
||||
}
|
||||
|
||||
std::vector<ForwardTraversal> forkScope(Token* endBlock, bool isModified = false)
|
||||
{
|
||||
std::vector<ForwardTraversal> forkScope(Token* endBlock, bool isModified = false) {
|
||||
if (analyzer->updateScope(endBlock, isModified)) {
|
||||
ForwardTraversal ft = *this;
|
||||
ft.analyzer->forkScope(endBlock);
|
||||
ft.updateRange(endBlock->link(), endBlock);
|
||||
return {ft};
|
||||
}
|
||||
return std::vector<ForwardTraversal>{};
|
||||
return std::vector<ForwardTraversal> {};
|
||||
}
|
||||
|
||||
static bool hasGoto(const Token* endBlock) {
|
||||
|
@ -270,8 +268,7 @@ struct ForwardTraversal {
|
|||
return a;
|
||||
}
|
||||
|
||||
void continueUpdateRangeAfterLoop(std::vector<ForwardTraversal>& ftv, Token* start, const Token* endToken)
|
||||
{
|
||||
void continueUpdateRangeAfterLoop(std::vector<ForwardTraversal>& ftv, Token* start, const Token* endToken) {
|
||||
for (ForwardTraversal& ft : ftv) {
|
||||
// If analysis has terminated normally, then continue analysis
|
||||
if (ft.terminate == Terminate::None)
|
||||
|
@ -283,8 +280,7 @@ struct ForwardTraversal {
|
|||
Token* endBlock,
|
||||
Token* condTok,
|
||||
Token* initTok = nullptr,
|
||||
Token* stepTok = nullptr)
|
||||
{
|
||||
Token* stepTok = nullptr) {
|
||||
const bool isDoWhile = precedes(endBlock, condTok);
|
||||
Analyzer::Action bodyAnalysis = analyzeScope(endBlock);
|
||||
Analyzer::Action allAnalysis = bodyAnalysis;
|
||||
|
|
|
@ -10,7 +10,10 @@
|
|||
#include <limits>
|
||||
#include <memory>
|
||||
|
||||
void ProgramMemory::setValue(MathLib::bigint exprid, const ValueFlow::Value& value) { values[exprid] = value; }
|
||||
void ProgramMemory::setValue(MathLib::bigint exprid, const ValueFlow::Value& value)
|
||||
{
|
||||
values[exprid] = value;
|
||||
}
|
||||
const ValueFlow::Value* ProgramMemory::getValue(MathLib::bigint exprid) const
|
||||
{
|
||||
const ProgramMemory::Map::const_iterator it = values.find(exprid);
|
||||
|
@ -61,7 +64,10 @@ void ProgramMemory::setUnknown(MathLib::bigint exprid)
|
|||
values[exprid].valueType = ValueFlow::Value::ValueType::UNINIT;
|
||||
}
|
||||
|
||||
bool ProgramMemory::hasValue(MathLib::bigint exprid) { return values.find(exprid) != values.end(); }
|
||||
bool ProgramMemory::hasValue(MathLib::bigint exprid)
|
||||
{
|
||||
return values.find(exprid) != values.end();
|
||||
}
|
||||
|
||||
void ProgramMemory::swap(ProgramMemory &pm)
|
||||
{
|
||||
|
|
|
@ -1310,7 +1310,9 @@ public:
|
|||
return const_cast<Scope *>(this->findScope(tok, const_cast<const Scope *>(startScope)));
|
||||
}
|
||||
|
||||
bool isVarId(nonneg int varid) const { return varid < mVariableList.size(); }
|
||||
bool isVarId(nonneg int varid) const {
|
||||
return varid < mVariableList.size();
|
||||
}
|
||||
|
||||
const Variable *getVariableFromVarId(nonneg int varId) const {
|
||||
return mVariableList.at(varId);
|
||||
|
|
|
@ -128,17 +128,17 @@ void Token::update_property_info()
|
|||
}
|
||||
|
||||
static const std::unordered_set<std::string> stdTypes = { "bool"
|
||||
, "_Bool"
|
||||
, "char"
|
||||
, "double"
|
||||
, "float"
|
||||
, "int"
|
||||
, "long"
|
||||
, "short"
|
||||
, "size_t"
|
||||
, "void"
|
||||
, "wchar_t"
|
||||
};
|
||||
, "_Bool"
|
||||
, "char"
|
||||
, "double"
|
||||
, "float"
|
||||
, "int"
|
||||
, "long"
|
||||
, "short"
|
||||
, "size_t"
|
||||
, "void"
|
||||
, "wchar_t"
|
||||
};
|
||||
|
||||
void Token::update_property_isStandardType()
|
||||
{
|
||||
|
|
|
@ -563,7 +563,7 @@ void Tokenizer::simplifyUsingToTypedef()
|
|||
// using a::b; => typedef a::b b;
|
||||
if ((Token::Match(tok, "[;{}] using %name% :: %name% ::|;") && !tok->tokAt(2)->isKeyword()) ||
|
||||
(Token::Match(tok, "[;{}] using :: %name% :: %name% ::|;") && !tok->tokAt(3)->isKeyword())) {
|
||||
Token *endtok = tok->tokAt(5);
|
||||
Token *endtok = tok->tokAt(5);
|
||||
if (Token::Match(endtok, "%name%"))
|
||||
endtok = endtok->next();
|
||||
while (Token::Match(endtok, ":: %name%"))
|
||||
|
@ -3437,8 +3437,8 @@ void Tokenizer::setVarId()
|
|||
#define NOTSTART_C "NOT", "case", "default", "goto", "not", "return", "sizeof", "typedef"
|
||||
static const std::unordered_set<std::string> notstart_c = { NOTSTART_C };
|
||||
static const std::unordered_set<std::string> notstart_cpp = { NOTSTART_C,
|
||||
"delete", "friend", "new", "throw", "using", "virtual", "explicit", "const_cast", "dynamic_cast", "reinterpret_cast", "static_cast", "template"
|
||||
};
|
||||
"delete", "friend", "new", "throw", "using", "virtual", "explicit", "const_cast", "dynamic_cast", "reinterpret_cast", "static_cast", "template"
|
||||
};
|
||||
|
||||
void Tokenizer::setVarIdPass1()
|
||||
{
|
||||
|
@ -9824,15 +9824,15 @@ void Tokenizer::findGarbageCode() const
|
|||
|
||||
// Keywords in global scope
|
||||
static const std::unordered_set<std::string> nonGlobalKeywords{"break",
|
||||
"continue",
|
||||
"for",
|
||||
"goto",
|
||||
"if",
|
||||
"return",
|
||||
"switch",
|
||||
"while",
|
||||
"try",
|
||||
"catch"};
|
||||
"continue",
|
||||
"for",
|
||||
"goto",
|
||||
"if",
|
||||
"return",
|
||||
"switch",
|
||||
"while",
|
||||
"try",
|
||||
"catch"};
|
||||
for (const Token *tok = tokens(); tok; tok = tok->next()) {
|
||||
if (tok->str() == "{")
|
||||
tok = tok->link();
|
||||
|
|
|
@ -1742,7 +1742,7 @@ static bool bifurcateVariableChanged(const Variable* var,
|
|||
bool result = false;
|
||||
const Token* tok = start;
|
||||
while ((tok = findVariableChanged(
|
||||
tok->next(), end, var->isPointer(), var->declarationId(), var->isGlobal(), settings, true))) {
|
||||
tok->next(), end, var->isPointer(), var->declarationId(), var->isGlobal(), settings, true))) {
|
||||
if (Token::Match(tok->astParent(), "%assign%")) {
|
||||
if (!bifurcate(tok->astParent()->astOperand2(), varids, settings, depth - 1))
|
||||
return true;
|
||||
|
@ -2312,8 +2312,7 @@ struct ExpressionAnalyzer : SingleValueFlowAnalyzer {
|
|||
return unknown;
|
||||
}
|
||||
|
||||
virtual ProgramState getProgramState() const OVERRIDE
|
||||
{
|
||||
virtual ProgramState getProgramState() const OVERRIDE {
|
||||
ProgramState ps;
|
||||
ps[expr->exprId()] = value;
|
||||
return ps;
|
||||
|
|
Loading…
Reference in New Issue