SymbolDatabase: handle method with unknown macro 'void f() MACRO {..}'
This commit is contained in:
parent
c2a8f6f59a
commit
4a02ca8202
|
@ -998,6 +998,7 @@ bool SymbolDatabase::isFunction(const Token *tok, const Scope* outerScope, const
|
||||||
tok->strAt(-1) == "::" || tok->strAt(-1) == "~" || // or a scope qualifier in front of tok
|
tok->strAt(-1) == "::" || tok->strAt(-1) == "~" || // or a scope qualifier in front of tok
|
||||||
outerScope->isClassOrStruct()) && // or a ctor/dtor
|
outerScope->isClassOrStruct()) && // or a ctor/dtor
|
||||||
(Token::Match(tok->next()->link(), ") const| ;|{|=") ||
|
(Token::Match(tok->next()->link(), ") const| ;|{|=") ||
|
||||||
|
(Token::Match(tok->next()->link(), ") %var% ;|{") && tok->next()->link()->next()->isUpperCaseName()) ||
|
||||||
Token::Match(tok->next()->link(), ") : ::| %var% (|::|<|{") ||
|
Token::Match(tok->next()->link(), ") : ::| %var% (|::|<|{") ||
|
||||||
Token::Match(tok->next()->link(), ") = delete|default ;"))) {
|
Token::Match(tok->next()->link(), ") = delete|default ;"))) {
|
||||||
*funcStart = tok;
|
*funcStart = tok;
|
||||||
|
|
|
@ -149,7 +149,8 @@ private:
|
||||||
TEST_CASE(hasGlobalVariables2);
|
TEST_CASE(hasGlobalVariables2);
|
||||||
TEST_CASE(hasGlobalVariables3);
|
TEST_CASE(hasGlobalVariables3);
|
||||||
|
|
||||||
TEST_CASE(checkTypeStartEndToken);
|
TEST_CASE(checkTypeStartEndToken1);
|
||||||
|
TEST_CASE(checkTypeStartEndToken2); // handling for unknown macro: 'void f() MACRO {..'
|
||||||
|
|
||||||
TEST_CASE(functionArgs1);
|
TEST_CASE(functionArgs1);
|
||||||
TEST_CASE(functionArgs2);
|
TEST_CASE(functionArgs2);
|
||||||
|
@ -964,7 +965,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkTypeStartEndToken() {
|
void checkTypeStartEndToken1() {
|
||||||
GET_SYMBOL_DB("static std::string i;\n"
|
GET_SYMBOL_DB("static std::string i;\n"
|
||||||
"static const std::string j;\n"
|
"static const std::string j;\n"
|
||||||
"const std::string* k;\n"
|
"const std::string* k;\n"
|
||||||
|
@ -987,6 +988,22 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void checkTypeStartEndToken2() {
|
||||||
|
GET_SYMBOL_DB("class CodeGenerator {\n"
|
||||||
|
" DiagnosticsEngine Diags;\n"
|
||||||
|
"public:\n"
|
||||||
|
" void Initialize() {\n"
|
||||||
|
" Builder.reset(Diags);\n"
|
||||||
|
" }\n"
|
||||||
|
"\n"
|
||||||
|
" void HandleTagDeclRequiredDefinition() LLVM_OVERRIDE {\n"
|
||||||
|
" if (Diags.hasErrorOccurred())\n"
|
||||||
|
" return;\n"
|
||||||
|
" }\n"
|
||||||
|
"};");
|
||||||
|
ASSERT_EQUALS("DiagnosticsEngine", db->getVariableFromVarId(1)->typeStartToken()->str());
|
||||||
|
}
|
||||||
|
|
||||||
void check(const char code[], bool debug = true) {
|
void check(const char code[], bool debug = true) {
|
||||||
// Clear the error log
|
// Clear the error log
|
||||||
errout.str("");
|
errout.str("");
|
||||||
|
|
Loading…
Reference in New Issue