Fixed #3768 (Tokenizer::setVarId: no varid for 'std::string' parameter after a 'std::string' parameter called 'string')
This commit is contained in:
parent
005ce81689
commit
11614021e8
|
@ -2754,7 +2754,7 @@ static bool setVarIdParseDeclaration(const Token **tok, const std::map<std::stri
|
|||
typeCount = 0;
|
||||
} else if (tok2->str() == "const") {
|
||||
; // just skip "const"
|
||||
} else if (!hasstruct && variableId.find(tok2->str()) != variableId.end()) {
|
||||
} else if (!hasstruct && variableId.find(tok2->str()) != variableId.end() && tok2->previous()->str() != "::") {
|
||||
++typeCount;
|
||||
tok2 = tok2->next();
|
||||
if (tok2->str() != "::")
|
||||
|
|
|
@ -210,6 +210,7 @@ private:
|
|||
TEST_CASE(varid44);
|
||||
TEST_CASE(varid45); // #3466
|
||||
TEST_CASE(varid46); // struct varname
|
||||
TEST_CASE(varid47); // function parameters
|
||||
TEST_CASE(varid_cpp_keywords_in_c_code);
|
||||
TEST_CASE(varidFunctionCall1);
|
||||
TEST_CASE(varidFunctionCall2);
|
||||
|
@ -3215,6 +3216,13 @@ private:
|
|||
tokenizeDebugListing(code, false, "test.c"));
|
||||
}
|
||||
|
||||
void varid47() { // #3768
|
||||
const std::string code("void f(std::string &string, std::string &len) {}");
|
||||
ASSERT_EQUALS("\n\n##file 0\n"
|
||||
"1: void f ( std :: string & string@1 , std :: string & len@2 ) { }\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