[demangler] Fix node matcher test
authorNathan Sidwell <nathan@acm.org>
Fri, 1 Apr 2022 12:47:35 +0000 (05:47 -0700)
committerNathan Sidwell <nathan@acm.org>
Fri, 1 Apr 2022 12:51:47 +0000 (05:51 -0700)
Move node matcher compilation test to non-anonymous namespace and
avoid using attribute.

llvm/unittests/Demangle/ItaniumDemangleTest.cpp

index ddd988f..5a05711 100644 (file)
@@ -34,7 +34,7 @@ public:
 };
 } // namespace
 
-namespace {
+namespace NodeMatcher {
 // Make sure the node matchers provide constructor parameters. This is a
 // compilation test.
 template <typename NT> struct Ctor {
@@ -50,11 +50,11 @@ template <typename NT> void Visit(const NT *Node) { Node->match(Ctor<NT>{}); }
 NOMATCHER(ForwardTemplateReference)
 #undef NOMATCHER
 
-void __attribute__((used)) Visitor() {
+void Visitor() {
 #define NODE(X) Visit(static_cast<const itanium_demangle::X *>(nullptr));
 #include "llvm/Demangle/ItaniumNodes.def"
 }
-} // namespace
+} // namespace NodeMatcher
 
 TEST(ItaniumDemangle, MethodOverride) {
   struct TestParser : AbstractManglingParser<TestParser, TestAllocator> {