Fixed #7706 ((debug) Executable scope 'foo' with unknown function.)
This commit is contained in:
parent
86a6723a84
commit
62ac40fc5e
|
@ -9215,10 +9215,10 @@ void Tokenizer::simplifyQtSignalsSlots()
|
|||
else
|
||||
--indentlevel;
|
||||
}
|
||||
|
||||
if (tok2->strAt(1) == "Q_OBJECT") {
|
||||
if (tok2->strAt(1) == "Q_OBJECT")
|
||||
tok2->deleteNext();
|
||||
} else if (Token::Match(tok2->next(), "public|protected|private slots|Q_SLOTS :")) {
|
||||
|
||||
if (Token::Match(tok2->next(), "public|protected|private slots|Q_SLOTS :")) {
|
||||
tok2 = tok2->next();
|
||||
tok2->str(tok2->str() + ":");
|
||||
tok2->deleteNext(2);
|
||||
|
|
|
@ -279,6 +279,7 @@ private:
|
|||
TEST_CASE(findFunction8);
|
||||
TEST_CASE(findFunction9);
|
||||
TEST_CASE(findFunction10); // #7673
|
||||
TEST_CASE(findFunction11);
|
||||
|
||||
TEST_CASE(noexceptFunction1);
|
||||
TEST_CASE(noexceptFunction2);
|
||||
|
@ -3417,6 +3418,19 @@ private:
|
|||
ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 2);
|
||||
}
|
||||
|
||||
void findFunction11() {
|
||||
GET_SYMBOL_DB("class Fred : public QObject {\n"
|
||||
" Q_OBJECT\n"
|
||||
"private slots:\n"
|
||||
" void foo();\n"
|
||||
"};\n"
|
||||
"void Fred::foo() { }");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
const Token *f = Token::findsimplematch(tokenizer.tokens(), "foo ( ) {");
|
||||
ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 4);
|
||||
}
|
||||
|
||||
#define FUNC(x) const Function *x = findFunctionByName(#x, &db->scopeList.front()); \
|
||||
ASSERT_EQUALS(true, x != nullptr); \
|
||||
if (x) ASSERT_EQUALS(true, x->isNoExcept());
|
||||
|
|
|
@ -5625,6 +5625,16 @@ private:
|
|||
|
||||
ASSERT_EQUALS(result3, tokenizeAndStringify(code3,false));
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
const char code4[] = "class MyObject : public QObject {"
|
||||
" Q_OBJECT "
|
||||
"public slots:"
|
||||
"};";
|
||||
const char result4[] = "class MyObject : public QObject { "
|
||||
"public: "
|
||||
"} ;";
|
||||
|
||||
ASSERT_EQUALS(result4, tokenizeAndStringify(code4,false));
|
||||
}
|
||||
|
||||
void simplifySQL() {
|
||||
|
|
Loading…
Reference in New Issue