[Lldb-commits] [lldb] [lldb] Better matching of types in anonymous namespaces (PR #102111)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 6 04:34:14 PDT 2024


================
@@ -111,4 +115,22 @@ TEST(Type, CompilerContextPattern) {
               Matches(std::vector{make_class("C")}));
   EXPECT_THAT((std::vector{make_namespace("NS"), make_class("C")}),
               Not(Matches(std::vector{make_any_type("C")})));
+
+  EXPECT_THAT((std::vector{make_namespace(""), make_class("C")}),
+              Matches(std::vector{make_class("C")}));
+  EXPECT_THAT((std::vector{make_namespace(""), make_class("C")}),
+              Not(MatchesWithStrictNamespaces(std::vector{make_class("C")})));
+  EXPECT_THAT((std::vector{make_namespace(""), make_class("C")}),
+              Matches(std::vector{make_namespace(""), make_class("C")}));
+  EXPECT_THAT((std::vector{make_namespace(""), make_class("C")}),
+              MatchesWithStrictNamespaces(
+                  std::vector{make_namespace(""), make_class("C")}));
+  EXPECT_THAT((std::vector{make_class("C")}),
+              Not(Matches(std::vector{make_namespace(""), make_class("C")})));
+  EXPECT_THAT((std::vector{make_class("C")}),
+              Not(MatchesWithStrictNamespaces(
+                  std::vector{make_namespace(""), make_class("C")})));
+  EXPECT_THAT((std::vector{make_namespace(""), make_namespace("NS"),
+                           make_namespace(""), make_class("C")}),
+              Matches(std::vector{make_namespace("NS"), make_class("C")}));
----------------
Michael137 wrote:

These are great!

Could also add a case for:
* consecutive empty anonymous namespace (not sure why that would happen but clang happily generates symbols such as `_ZN2ns12_GLOBAL__N_112_GLOBAL__N_14funcEv` 🤷) 
* mix modules and anonymous namespaces

https://github.com/llvm/llvm-project/pull/102111


More information about the lldb-commits mailing list