SymbolDatabase: Function::retDef should not point at "static" or "extern"

This commit is contained in:
PKEuS 2016-11-28 17:21:46 +01:00
parent 7b1ed9f415
commit 36d12d7866
2 changed files with 7 additions and 7 deletions

View File

@ -1899,7 +1899,7 @@ Function* SymbolDatabase::addGlobalFunctionDecl(Scope*& scope, const Token *tok,
tok1 = tok1->previous(); tok1 = tok1->previous();
// find the return type // find the return type
while (tok1 && Token::Match(tok1->next(), "static|extern|const")) { while (Token::Match(tok1, "static|extern|const")) {
if (tok1->str() == "static") if (tok1->str() == "static")
function.isStaticLocal(true); function.isStaticLocal(true);
else if (tok1->str() == "extern") else if (tok1->str() == "extern")

View File

@ -1350,22 +1350,22 @@ private:
if (db) { if (db) {
const Token *f = Token::findsimplematch(tokenizer.tokens(), "f1"); const Token *f = Token::findsimplematch(tokenizer.tokens(), "f1");
ASSERT(f && f->function() && f->function()->isStaticLocal()); ASSERT(f && f->function() && f->function()->isStaticLocal() && f->function()->retDef->str() == "void");
f = Token::findsimplematch(tokenizer.tokens(), "f2"); f = Token::findsimplematch(tokenizer.tokens(), "f2");
ASSERT(f && f->function() && !f->function()->isStaticLocal()); ASSERT(f && f->function() && !f->function()->isStaticLocal() && f->function()->retDef->str() == "void");
f = Token::findsimplematch(tokenizer.tokens(), "f3"); f = Token::findsimplematch(tokenizer.tokens(), "f3");
ASSERT(f && f->function() && f->function()->isExtern()); ASSERT(f && f->function() && f->function()->isExtern() && f->function()->retDef->str() == "void");
f = Token::findsimplematch(tokenizer.tokens(), "f4"); f = Token::findsimplematch(tokenizer.tokens(), "f4");
ASSERT(f && f->function() && !f->function()->isExtern()); ASSERT(f && f->function() && !f->function()->isExtern() && f->function()->retDef->str() == "void");
f = Token::findsimplematch(tokenizer.tokens(), "f5"); f = Token::findsimplematch(tokenizer.tokens(), "f5");
ASSERT(f && f->function() && f->function()->isExtern()); ASSERT(f && f->function() && f->function()->isExtern() && f->function()->retDef->str() == "void");
f = Token::findsimplematch(tokenizer.tokens(), "f6"); f = Token::findsimplematch(tokenizer.tokens(), "f6");
ASSERT(f && f->function() && !f->function()->isExtern()); ASSERT(f && f->function() && !f->function()->isExtern() && f->function()->retDef->str() == "void");
} }
} }