Library: Don't rely on ast in isNotLibraryFunction since it's used in tokenizer
This commit is contained in:
parent
36841cfa41
commit
57ec1aea91
|
@ -681,10 +681,9 @@ const Library::Container* Library::detectContainer(const Token* typeStart) const
|
|||
// returns true if ftok is not a library function
|
||||
bool Library::isNotLibraryFunction(const Token *ftok) const
|
||||
{
|
||||
if (!ftok->astParent())
|
||||
// called from tokenizer, ast is not created properly yet
|
||||
if (Token::Match(ftok->previous(),"::|."))
|
||||
return false;
|
||||
if (ftok->astParent()->str() != "(")
|
||||
return true;
|
||||
|
||||
int callargs = 0;
|
||||
for (const Token *tok = ftok->tokAt(2); tok && tok->str() != ")"; tok = tok->next()) {
|
||||
|
|
|
@ -2280,7 +2280,7 @@ private:
|
|||
" foo::memset(str, 0, 100);\n"
|
||||
" std::memset(str, 0, 100);\n"
|
||||
"}");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:5]: (error) Buffer is accessed out of bounds: str\n", "", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:5]: (error) Buffer is accessed out of bounds: str\n", errout.str());
|
||||
|
||||
// #5257 - check strings
|
||||
checkstd("void f() {\n"
|
||||
|
|
|
@ -2111,10 +2111,10 @@ private:
|
|||
ASSERT_EQUALS("void f ( ) { return ; }", tokWithStdLib(code1));
|
||||
|
||||
const char code2[] = "void f() {\n"
|
||||
" exit();\n"
|
||||
" exit(0);\n"
|
||||
" y();\n"
|
||||
"}";
|
||||
ASSERT_EQUALS("void f ( ) { exit ( ) ; }", tokWithStdLib(code2));
|
||||
ASSERT_EQUALS("void f ( ) { exit ( 0 ) ; }", tokWithStdLib(code2));
|
||||
|
||||
const char code3[] = "void f() {\n"
|
||||
" x.abort();\n"
|
||||
|
|
Loading…
Reference in New Issue