varid: better templates handling
This commit is contained in:
parent
1fd6d36493
commit
5b0551054a
|
@ -2516,6 +2516,10 @@ static void setVarIdStructMembers(Token **tok1,
|
|||
if (struct_varid == 0)
|
||||
continue;
|
||||
|
||||
// Don't set varid for template function
|
||||
if (TemplateSimplifier::templateParameters(tok->next()) > 0)
|
||||
break;
|
||||
|
||||
std::map<unsigned int, std::map<std::string,unsigned int> >::iterator structIterator;
|
||||
structIterator = structMembers->find(struct_varid);
|
||||
if (structIterator == structMembers->end()) {
|
||||
|
|
|
@ -216,6 +216,7 @@ private:
|
|||
TEST_CASE(varid48); // #3785 - return (a*b)
|
||||
TEST_CASE(varid49); // #3799 - void f(std::vector<int>)
|
||||
TEST_CASE(varid50); // #3760 - explicit
|
||||
TEST_CASE(varid51); // don't set varid for template function
|
||||
TEST_CASE(varid_cpp_keywords_in_c_code);
|
||||
TEST_CASE(varidFunctionCall1);
|
||||
TEST_CASE(varidFunctionCall2);
|
||||
|
@ -3267,6 +3268,13 @@ private:
|
|||
tokenizeDebugListing(code, false, "test.cpp"));
|
||||
}
|
||||
|
||||
void varid51() { // don't set varid on template function
|
||||
const std::string code("T t; t.x<0>();");
|
||||
ASSERT_EQUALS("\n\n##file 0\n"
|
||||
"1: T t@1 ; t@1 . x < 0 > ( ) ;\n",
|
||||
tokenizeDebugListing(code, false, "test.cpp"));
|
||||
}
|
||||
|
||||
void varid_cpp_keywords_in_c_code() {
|
||||
const char code[] = "void f() {\n"
|
||||
" delete d;\n"
|
||||
|
|
Loading…
Reference in New Issue