diff --git a/lldb/test/lang/cpp/namespace/TestNamespace.py b/lldb/test/lang/cpp/namespace/TestNamespace.py index 35bb9321fcc3..91c8461f9cde 100644 --- a/lldb/test/lang/cpp/namespace/TestNamespace.py +++ b/lldb/test/lang/cpp/namespace/TestNamespace.py @@ -106,6 +106,16 @@ class NamespaceTestCase(TestBase): self.expect("expression -- A::B::j", VARIABLES_DISPLAYED_CORRECTLY, patterns = [' = 4$']) + # expression command with function in anonymous namespace + self.expect("expression -- myanonfunc(3)", + patterns = [' = 6']) + + # global namespace qualification with function in anonymous namespace + self.expect("expression -- ::myanonfunc(4)", + patterns = [' = 8']) + + self.expect("p myanonfunc", + patterns = ['\(anonymous namespace\)::myanonfunc\(int\)']) if __name__ == '__main__': import atexit diff --git a/lldb/test/lang/cpp/namespace/main.cpp b/lldb/test/lang/cpp/namespace/main.cpp index dfa7a69c4e67..9f3583b47e27 100644 --- a/lldb/test/lang/cpp/namespace/main.cpp +++ b/lldb/test/lang/cpp/namespace/main.cpp @@ -10,6 +10,11 @@ namespace { typedef unsigned int my_uint_t; int i; // Find the line number for anonymous namespace variable i. + + int myanonfunc (int a) + { + return a + a; + } } namespace A { @@ -62,6 +67,7 @@ int Foo::myfunc(int a) j = 4; printf("::i=%d\n", ::i); printf("A::B::j=%d\n", A::B::j); + myanonfunc(3); return myfunc2(3) + j + i + a + 2 + anon_uint + a_uint + b_uint + y_uint; // Set break point at this line. }