Fixed #9449 (SymbolDatabase: Function lookup fails when string literal is converted to bool)
This commit is contained in:
parent
b96a347914
commit
6d1c84e3a6
|
@ -6105,6 +6105,8 @@ ValueType::MatchResult ValueType::matchParameter(const ValueType *call, const Va
|
|||
if (call->pointer != func->pointer) {
|
||||
if (call->pointer > 1 && func->pointer == 1 && func->type == ValueType::Type::VOID)
|
||||
return ValueType::MatchResult::FALLBACK1;
|
||||
if (call->pointer == 1 && func->pointer == 0 && func->isIntegral() && func->sign != ValueType::Sign::SIGNED)
|
||||
return ValueType::MatchResult::FALLBACK1;
|
||||
if (call->pointer == 1 && call->type == ValueType::Type::CHAR && func->pointer == 0 && func->container && func->container->stdStringLike)
|
||||
return ValueType::MatchResult::FALLBACK2;
|
||||
return ValueType::MatchResult::NOMATCH; // TODO
|
||||
|
|
|
@ -357,6 +357,7 @@ private:
|
|||
TEST_CASE(findFunction28);
|
||||
TEST_CASE(findFunction29);
|
||||
TEST_CASE(findFunction30);
|
||||
TEST_CASE(findFunction31);
|
||||
TEST_CASE(findFunctionContainer);
|
||||
TEST_CASE(findFunctionExternC);
|
||||
TEST_CASE(findFunctionGlobalScope); // ::foo
|
||||
|
@ -5375,7 +5376,7 @@ private:
|
|||
ASSERT_EQUALS(true, f && f->function() && f->function()->tokenDef->linenr() == 3);
|
||||
|
||||
f = Token::findsimplematch(tokenizer.tokens(), "foo ( ccp ) ;");
|
||||
ASSERT_EQUALS(true, f && f->function() == nullptr);
|
||||
ASSERT_EQUALS(true, f && f->function() && f->function()->tokenDef->linenr() == 5);
|
||||
|
||||
f = Token::findsimplematch(tokenizer.tokens(), "foo ( f ) ;");
|
||||
ASSERT_EQUALS(true, f && f->function() && f->function()->tokenDef->linenr() == 4);
|
||||
|
@ -5822,6 +5823,17 @@ private:
|
|||
ASSERT(!bar->function());
|
||||
}
|
||||
|
||||
void findFunction31() {
|
||||
GET_SYMBOL_DB("void foo(bool);\n"
|
||||
"void foo(std::string s);\n"
|
||||
"void bar() { foo(\"123\"); }");
|
||||
const Token *foo = Token::findsimplematch(tokenizer.tokens(), "foo ( \"123\" ) ;");
|
||||
ASSERT(foo);
|
||||
ASSERT(foo->function());
|
||||
ASSERT(foo->function()->tokenDef);
|
||||
ASSERT_EQUALS(1, foo->function()->tokenDef->linenr());
|
||||
}
|
||||
|
||||
void findFunctionContainer() {
|
||||
{
|
||||
GET_SYMBOL_DB("void dostuff(std::vector<int> v);\n"
|
||||
|
|
Loading…
Reference in New Issue