SymbolDatabase: Better ValueType handling for containers
This commit is contained in:
parent
052c02f8ee
commit
dedee2b173
|
@ -5681,7 +5681,10 @@ void SymbolDatabase::setValueTypeInTokenList(bool reportDebugWarnings)
|
||||||
// library type/function
|
// library type/function
|
||||||
else if (tok->previous()) {
|
else if (tok->previous()) {
|
||||||
if (tok->astParent() && Token::Match(tok->astOperand1(), "%name%|::")) {
|
if (tok->astParent() && Token::Match(tok->astOperand1(), "%name%|::")) {
|
||||||
if (const Library::Container *c = mSettings->library.detectContainer(tok->astOperand1())) {
|
const Token *typeStartToken = tok->astOperand1();
|
||||||
|
while (typeStartToken && typeStartToken->str() == "::")
|
||||||
|
typeStartToken = typeStartToken->astOperand1();
|
||||||
|
if (const Library::Container *c = mSettings->library.detectContainer(typeStartToken)) {
|
||||||
ValueType vt;
|
ValueType vt;
|
||||||
vt.pointer = 0;
|
vt.pointer = 0;
|
||||||
vt.container = c;
|
vt.container = c;
|
||||||
|
|
|
@ -6618,6 +6618,7 @@ private:
|
||||||
string.arrayLike_indexOp = string.stdStringLike = true;
|
string.arrayLike_indexOp = string.stdStringLike = true;
|
||||||
set.library.containers["test::string"] = string;
|
set.library.containers["test::string"] = string;
|
||||||
ASSERT_EQUALS("signed int", typeOf("Vector<int> v; v[0]=3;", "[", "test.cpp", &set));
|
ASSERT_EQUALS("signed int", typeOf("Vector<int> v; v[0]=3;", "[", "test.cpp", &set));
|
||||||
|
ASSERT_EQUALS("container(test :: string)", typeOf("return test::string();", "(", "test.cpp", &set));
|
||||||
ASSERT_EQUALS("container(test :: string)", typeOf("void foo(Vector<test::string> v) { for (auto s: v) { x=s+s; } }", "s", "test.cpp", &set));
|
ASSERT_EQUALS("container(test :: string)", typeOf("void foo(Vector<test::string> v) { for (auto s: v) { x=s+s; } }", "s", "test.cpp", &set));
|
||||||
ASSERT_EQUALS("container(test :: string)", typeOf("void foo(Vector<test::string> v) { for (auto s: v) { x=s+s; } }", "+", "test.cpp", &set));
|
ASSERT_EQUALS("container(test :: string)", typeOf("void foo(Vector<test::string> v) { for (auto s: v) { x=s+s; } }", "+", "test.cpp", &set));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue