]> granicus.if.org Git - clang/commitdiff
Consistently print anonymous namespace names as "<anonymous namespace>"
authorDavid Blaikie <dblaikie@gmail.com>
Fri, 14 Feb 2014 22:12:54 +0000 (22:12 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Fri, 14 Feb 2014 22:12:54 +0000 (22:12 +0000)
For some reason we have two bits of code handling this printing:

lib/AST/Decl.cpp:        OS << "<anonymous namespace>";
lib/AST/TypePrinter.cpp:      OS << "<anonymous namespace>::";

it would be nice if we only had one...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201437 91177308-0d34-0410-b5e6-96231b3b80d8

test/Modules/namespaces.cpp
test/SemaCXX/undefined-internal.cpp
unittests/ASTMatchers/ASTMatchersTest.cpp

index 8c225e051bdead033611bdfda8805268b0f1d0c9..003c7d36b8dc656f9baf6a29d4088a46b1fa5088 100644 (file)
@@ -69,8 +69,8 @@ void testMergedMerged() {
 // Test merging when using anonymous namespaces, which does not
 // actually perform any merging.
 void testAnonymousNotMerged() {
-  N11::consumeFoo(N11::getFoo()); // expected-error{{cannot initialize a parameter of type 'N11::<anonymous>::Foo *' with an rvalue of type 'N11::<anonymous>::Foo *'}}
-  N12::consumeFoo(N12::getFoo()); // expected-error{{cannot initialize a parameter of type 'N12::<anonymous>::Foo *' with an rvalue of type 'N12::<anonymous>::Foo *'}}  
+  N11::consumeFoo(N11::getFoo()); // expected-error{{cannot initialize a parameter of type 'N11::<anonymous namespace>::Foo *' with an rvalue of type 'N11::<anonymous namespace>::Foo *'}}
+  N12::consumeFoo(N12::getFoo()); // expected-error{{cannot initialize a parameter of type 'N12::<anonymous namespace>::Foo *' with an rvalue of type 'N12::<anonymous namespace>::Foo *'}}  
 }
 
 // expected-note@Inputs/namespaces-right.h:60 {{passing argument to parameter here}}
index 9d3048dc2e26a82c1e2b2b50f6eb6900e4f0ef26..67ad110fb34d9c39945173c530dd4c3d094ed894 100644 (file)
@@ -78,8 +78,8 @@ namespace test5 {
   }
 
   template <class N> struct B {
-    static int var; // expected-warning {{variable 'test5::B<test5::<anonymous>::A>::var' has internal linkage but is not defined}}
-    static void foo(); // expected-warning {{function 'test5::B<test5::<anonymous>::A>::foo' has internal linkage but is not defined}}
+    static int var; // expected-warning {{variable 'test5::B<test5::<anonymous namespace>::A>::var' has internal linkage but is not defined}}
+    static void foo(); // expected-warning {{function 'test5::B<test5::<anonymous namespace>::A>::foo' has internal linkage but is not defined}}
   };
 
   void test() {
index 5c9753f9336b869ff4c6fb5d83a1b71ec2153f62..669978b8a9f54551cfa94431689dda995527f085 100644 (file)
@@ -1038,7 +1038,7 @@ TEST(HasType, MatchesAsString) {
   EXPECT_TRUE(matches("namespace ns { struct A {}; }  struct B { ns::A a; };",
       fieldDecl(hasType(asString("ns::A")))));
   EXPECT_TRUE(matches("namespace { struct A {}; }  struct B { A a; };",
-      fieldDecl(hasType(asString("struct <anonymous>::A")))));
+      fieldDecl(hasType(asString("struct <anonymous namespace>::A")))));
 }
 
 TEST(Matcher, OverloadedOperatorCall) {