SymbolDatabase: Fix Variable pointer property for 'std::string x(*p)'
This commit is contained in:
parent
2998382c86
commit
8b5865055a
|
@ -6242,7 +6242,7 @@ static const Token * parsedecl(const Token *type, ValueType * const valuetype, V
|
|||
} else if (const Library::Container *container = settings->library.detectContainer(type)) {
|
||||
valuetype->type = ValueType::Type::CONTAINER;
|
||||
valuetype->container = container;
|
||||
while (Token::Match(type, "%name%|::|<")) {
|
||||
while (Token::Match(type, "%type%|::|<")) {
|
||||
if (type->str() == "<" && type->link()) {
|
||||
if (container->type_templateArgNo >= 0) {
|
||||
const Token *templateType = type->next();
|
||||
|
|
|
@ -137,6 +137,7 @@ private:
|
|||
TEST_CASE(test_isVariableDeclarationIdentifiesScopedStdDeclaration);
|
||||
TEST_CASE(test_isVariableDeclarationIdentifiesManyScopes);
|
||||
TEST_CASE(test_isVariableDeclarationIdentifiesPointers);
|
||||
TEST_CASE(test_isVariableDeclarationIdentifiesPointers2);
|
||||
TEST_CASE(test_isVariableDeclarationDoesNotIdentifyConstness);
|
||||
TEST_CASE(test_isVariableDeclarationIdentifiesFirstOfManyVariables);
|
||||
TEST_CASE(test_isVariableDeclarationIdentifiesScopedPointerDeclaration);
|
||||
|
@ -655,6 +656,18 @@ private:
|
|||
ASSERT(false == v3.isReference());
|
||||
}
|
||||
|
||||
void test_isVariableDeclarationIdentifiesPointers2() {
|
||||
|
||||
GET_SYMBOL_DB("void slurpInManifest() {\n"
|
||||
" std::string tmpiostring(*tI);\n"
|
||||
" if(tmpiostring==\"infoonly\"){}\n"
|
||||
"}");
|
||||
|
||||
const Token *tok = Token::findsimplematch(tokenizer.tokens(), "tmpiostring ==");
|
||||
ASSERT(tok->variable());
|
||||
ASSERT(!tok->variable()->isPointer());
|
||||
}
|
||||
|
||||
void test_isVariableDeclarationDoesNotIdentifyConstness() {
|
||||
reset();
|
||||
givenACodeSampleToTokenize constness("const int* cp;");
|
||||
|
|
Loading…
Reference in New Issue