#6900 segmentation fault (invalid code) in CheckStl::runSimplifiedChecks.
This commit is contained in:
parent
7422366ebc
commit
4400f2ac85
|
@ -3777,10 +3777,7 @@ bool Tokenizer::simplifyTokenList2()
|
|||
|
||||
// Create symbol database and then remove const keywords
|
||||
createSymbolDatabase();
|
||||
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
||||
if (Token::simpleMatch(tok, "* const"))
|
||||
tok->deleteNext();
|
||||
}
|
||||
simplifyPointerConst();
|
||||
|
||||
list.createAst();
|
||||
|
||||
|
@ -3794,6 +3791,14 @@ bool Tokenizer::simplifyTokenList2()
|
|||
return true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void Tokenizer::simplifyPointerConst()
|
||||
{
|
||||
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
||||
if (Token::Match(tok, "* const %name%|*"))
|
||||
tok->deleteNext();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void Tokenizer::printDebugOutput(unsigned int simplification) const
|
||||
{
|
||||
|
|
|
@ -277,6 +277,12 @@ public:
|
|||
*/
|
||||
void simplifyCompoundAssignment();
|
||||
|
||||
|
||||
/**
|
||||
* Simplify "* const" to "*"
|
||||
*/
|
||||
void simplifyPointerConst();
|
||||
|
||||
/**
|
||||
* Simplify the location of "static" and "const" qualifiers in
|
||||
* a variable declaration or definition.
|
||||
|
|
|
@ -148,6 +148,8 @@ private:
|
|||
TEST_CASE(garbageCode106);
|
||||
TEST_CASE(garbageCode107);
|
||||
TEST_CASE(garbageCode108);
|
||||
TEST_CASE(garbageCode109);
|
||||
TEST_CASE(garbageCode110);
|
||||
|
||||
TEST_CASE(garbageValueFlow);
|
||||
TEST_CASE(garbageSymbolDatabase);
|
||||
|
@ -834,6 +836,15 @@ private:
|
|||
checkCode("A( ) { } bool f( ) { ( ) F; ( ) { ( == ) if ( !=< || ( !A( ) && r[2] ) ) ( !A( ) ) ( ) } }");
|
||||
}
|
||||
|
||||
void garbageCode109() { // #6900 "segmentation fault (invalid code) in CheckStl::runSimplifiedChecks"
|
||||
checkCode("( *const<> (( ) ) { } ( *const ( ) ( ) ) { } ( * const<> ( size_t )) ) { } ( * const ( ) ( ) ) { }");
|
||||
}
|
||||
|
||||
void garbageCode110() { // #6902 "segmentation fault (invalid code) in CheckStl::string_c_str"
|
||||
checkCode("( *const<> ( size_t ) ; foo ) { } * ( *const ( size_t ) ( ) ;> foo )< { }");
|
||||
}
|
||||
|
||||
|
||||
|
||||
void garbageValueFlow() {
|
||||
// #6089
|
||||
|
|
Loading…
Reference in New Issue