Fixed #7767 (SymbolDatabase: function not analysed when unknown macros are in front of function definition)
This commit is contained in:
parent
8a0f3009ff
commit
f25d205999
|
@ -1459,7 +1459,7 @@ bool SymbolDatabase::isFunction(const Token *tok, const Scope* outerScope, const
|
|||
}
|
||||
|
||||
// skip over modifiers and other stuff
|
||||
while (Token::Match(tok1, "const|static|extern|template|virtual|struct|class|enum"))
|
||||
while (Token::Match(tok1, "const|static|extern|template|virtual|struct|class|enum|%name%"))
|
||||
tok1 = tok1->previous();
|
||||
|
||||
// should be at a sequence point if this is a function
|
||||
|
|
|
@ -253,6 +253,7 @@ private:
|
|||
TEST_CASE(symboldatabase52); // #6581
|
||||
TEST_CASE(symboldatabase53); // #7124 (library podtype)
|
||||
TEST_CASE(symboldatabase54); // #7257
|
||||
TEST_CASE(symboldatabase55); // #7767 (return unknown macro)
|
||||
|
||||
TEST_CASE(enum1);
|
||||
TEST_CASE(enum2);
|
||||
|
@ -2652,6 +2653,18 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
void symboldatabase55() { // #7767
|
||||
GET_SYMBOL_DB("PRIVATE S32 testfunc(void) {\n"
|
||||
" return 0;\n"
|
||||
"}");
|
||||
|
||||
ASSERT(db != nullptr);
|
||||
if (db) {
|
||||
ASSERT_EQUALS(1U, db->functionScopes.size());
|
||||
ASSERT_EQUALS("testfunc", db->functionScopes.front()->className);
|
||||
}
|
||||
}
|
||||
|
||||
void enum1() {
|
||||
GET_SYMBOL_DB("enum BOOL { FALSE, TRUE }; enum BOOL b;");
|
||||
|
||||
|
|
Loading…
Reference in New Issue