This commit is contained in:
chrchr-github 2022-03-07 10:44:46 +01:00 committed by GitHub
parent 1d2beb0431
commit 461d797094
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 34 additions and 23 deletions

View File

@ -6882,8 +6882,8 @@ private:
ASSERT_EQUALS(exp, tokenizeAndStringify(code, /*simplify=*/ true)); ASSERT_EQUALS(exp, tokenizeAndStringify(code, /*simplify=*/ true));
} }
void simplifyKnownVariablesNamespace() { // #10059 void simplifyKnownVariablesNamespace() {
{ { // #10059
const char code[] = "namespace N {\n" const char code[] = "namespace N {\n"
" const int n = 0;\n" " const int n = 0;\n"
" namespace M { const int m = 0; }\n" " namespace M { const int m = 0; }\n"
@ -6907,29 +6907,40 @@ private:
"10: int l ( N :: M :: m@2 ) ;\n"; "10: int l ( N :: M :: m@2 ) ;\n";
ASSERT_EQUALS(exp, tokenizeDebugListing(code)); ASSERT_EQUALS(exp, tokenizeDebugListing(code));
} }
{ // #10835
{ const char code[] = "using namespace X;\n"
const char code[] = "struct S {\n" "namespace N {\n"
" S() { f(); }\n" " struct A {\n"
" static int i;\n"
" struct B {\n"
" double x;\n"
" void f();\n" " void f();\n"
" int i;\n" " };\n"
"};\n" " };\n"
"namespace N { int j; }\n" "}\n"
"using namespace N;\n" "namespace N {\n"
"void S::f() {\n" " int A::i = 0;\n"
" i = 0;\n" " void A::B::f() {\n"
" x = 0;\n"
" }\n"
"}\n"; "}\n";
const char exp[] = "\n\n##file 0\n" const char exp[] = "\n\n##file 0\n"
"1: struct S {\n" "1: using namespace X ;\n"
"2: S ( ) { f ( ) ; }\n" "2: namespace N {\n"
"3: void f ( ) ;\n" "3: struct A {\n"
"4: int i@1 ;\n" "4: static int i@1 ;\n"
"5: } ;\n" "5: struct B {\n"
"6: namespace N { int j@2 ; }\n" "6: double x@2 ;\n"
"7: using namespace N ;\n" "7: void f ( ) ;\n"
"8: void S :: f ( ) {\n" "8: } ;\n"
"9: i@1 = 0 ;\n" "9: } ;\n"
"10: }\n"; "10: }\n"
"11: namespace N {\n"
"12: int A :: i@1 = 0 ;\n"
"13: void A :: B :: f ( ) {\n"
"14: x@2 = 0 ;\n"
"15: }\n"
"16: }\n";
ASSERT_EQUALS(exp, tokenizeDebugListing(code)); ASSERT_EQUALS(exp, tokenizeDebugListing(code));
} }
} }