fix hang in simplifyUsing (#3128)
Co-authored-by: Robert Reif <reif@FX6840>
This commit is contained in:
parent
e57a674458
commit
1eafed9e75
|
@ -2293,7 +2293,8 @@ bool Tokenizer::simplifyUsing()
|
|||
|
||||
// We can limit the search to the current function when the type alias
|
||||
// is defined in that function.
|
||||
if (currentScope->type == ScopeInfo3::Other) {
|
||||
if (currentScope->type == ScopeInfo3::Other ||
|
||||
currentScope->type == ScopeInfo3::MemberFunction) {
|
||||
scopeInfo1 = scopeInfo;
|
||||
currentScope1 = scopeInfo.findScope(currentScope);
|
||||
if (!currentScope1)
|
||||
|
|
|
@ -1103,6 +1103,7 @@ private:
|
|||
}
|
||||
|
||||
void simplifyUsing10173() {
|
||||
{
|
||||
const char code[] = "std::ostream & operator<<(std::ostream &s, const Pr<st> p) {\n"
|
||||
" return s;\n"
|
||||
"}\n"
|
||||
|
@ -1125,6 +1126,29 @@ private:
|
|||
ASSERT_EQUALS(exp, tok(code, true));
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
{
|
||||
const char code[] = "namespace defsa {\n"
|
||||
"void xxx::foo() {\n"
|
||||
" using NS1 = v1::l;\n"
|
||||
"}\n"
|
||||
"void xxx::bar() {\n"
|
||||
" using NS1 = v1::l;\n"
|
||||
"}\n"
|
||||
"void xxx::foobar() {\n"
|
||||
" using NS1 = v1::l;\n"
|
||||
"}\n"
|
||||
"}";
|
||||
const char exp[] = "namespace defsa { "
|
||||
"void xxx :: foo ( ) { "
|
||||
"} "
|
||||
"void xxx :: bar ( ) { "
|
||||
"} "
|
||||
"void xxx :: foobar ( ) { "
|
||||
"} "
|
||||
"}";
|
||||
ASSERT_EQUALS(exp, tok(code, true));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestSimplifyUsing)
|
||||
|
|
Loading…
Reference in New Issue