[patch] Render anonymous entities with "(anonymous thing)" rather than "<anonymous thing>"

David Blaikie dblaikie at gmail.com
Tue Mar 11 00:08:15 PDT 2014


Partly out of consistency with GCC's anonymous namespace rendering
("(anonymous namespace)") and just a desire not to have angle brackets
be confused with a template argument list, this patch changes all our
anonymous things to use parens.

Not entirely consistent with GCC (GCC still uses angles for
"<anonymous struct>" and other cases), but Chandler and Richard seemed
to prefer consistency between the different kinds of names, rather
than consistency with GCC here.

I haven't added an actual debug info test, though that was my initial
motivation - I can add one if someone thinks that's valuable.

Any other thoughts?

- David
-------------- next part --------------
commit c727d2235d2479844af60665c3979f18adcec621
Author: David Blaikie <dblaikie at gmail.com>
Date:   Tue Mar 11 00:01:02 2014 -0700

    Render anonymous entities as '(anonymous <thing>)' (and lambdas as '(lambda at ... )')
    
    For namespaces, this is consistent with mangling and GCC's debug info
    behavior. For structs, GCC uses <anonymous struct> but we prefer
    consistency between all anonymous entities but don't want to confuse
    them with template arguments, etc, so we'll just go with parens in all
    cases.

diff --git include/clang/AST/PrettyPrinter.h include/clang/AST/PrettyPrinter.h
index 37a4df7..e719213 100644
--- include/clang/AST/PrettyPrinter.h
+++ include/clang/AST/PrettyPrinter.h
@@ -126,7 +126,7 @@ struct PrintingPolicy {
   
   /// \brief When printing an anonymous tag name, also print the location of
   /// that entity (e.g., "enum <anonymous at t.h:10:5>"). Otherwise, just 
-  /// prints "<anonymous>" for the name.
+  /// prints "(anonymous)" for the name.
   bool AnonymousTagLocations : 1;
   
   /// \brief When true, suppress printing of the __strong lifetime qualifier in
diff --git lib/AST/Decl.cpp lib/AST/Decl.cpp
index 89f7291..0b0cc9b 100644
--- lib/AST/Decl.cpp
+++ lib/AST/Decl.cpp
@@ -1303,12 +1303,12 @@ void NamedDecl::printQualifiedName(raw_ostream &OS,
                                                             P);
     } else if (const NamespaceDecl *ND = dyn_cast<NamespaceDecl>(*I)) {
       if (ND->isAnonymousNamespace())
-        OS << "<anonymous namespace>";
+        OS << "(anonymous namespace)";
       else
         OS << *ND;
     } else if (const RecordDecl *RD = dyn_cast<RecordDecl>(*I)) {
       if (!RD->getIdentifier())
-        OS << "<anonymous " << RD->getKindName() << '>';
+        OS << "(anonymous " << RD->getKindName() << ')';
       else
         OS << *RD;
     } else if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(*I)) {
@@ -1341,7 +1341,7 @@ void NamedDecl::printQualifiedName(raw_ostream &OS,
   if (getDeclName())
     OS << *this;
   else
-    OS << "<anonymous>";
+    OS << "(anonymous)";
 }
 
 void NamedDecl::getNameForDiagnostic(raw_ostream &OS,
diff --git lib/AST/TemplateBase.cpp lib/AST/TemplateBase.cpp
index 16efb79..843aad2 100644
--- lib/AST/TemplateBase.cpp
+++ lib/AST/TemplateBase.cpp
@@ -345,7 +345,7 @@ void TemplateArgument::print(const PrintingPolicy &Policy,
                              raw_ostream &Out) const {
   switch (getKind()) {
   case Null:
-    Out << "<no value>";
+    Out << "(no value)";
     break;
     
   case Type: {
@@ -362,7 +362,7 @@ void TemplateArgument::print(const PrintingPolicy &Policy,
       // FIXME: distinguish between pointer and reference args?
       ND->printQualifiedName(Out);
     } else {
-      Out << "<anonymous>";
+      Out << "(anonymous)";
     }
     break;
   }
diff --git lib/AST/TypePrinter.cpp lib/AST/TypePrinter.cpp
index 26c3c99..0cbf56c 100644
--- lib/AST/TypePrinter.cpp
+++ lib/AST/TypePrinter.cpp
@@ -848,7 +848,7 @@ void TypePrinter::AppendScope(DeclContext *DC, raw_ostream &OS) {
     if (NS->getIdentifier())
       OS << NS->getName() << "::";
     else
-      OS << "<anonymous namespace>::";
+      OS << "(anonymous namespace)::";
   } else if (ClassTemplateSpecializationDecl *Spec
                = dyn_cast<ClassTemplateSpecializationDecl>(DC)) {
     IncludeStrongLifetimeRAII Strong(Policy);
@@ -900,13 +900,13 @@ void TypePrinter::printTag(TagDecl *D, raw_ostream &OS) {
     OS << Typedef->getIdentifier()->getName();
   } else {
     // Make an unambiguous representation for anonymous types, e.g.
-    //   <anonymous enum at /usr/include/string.h:120:9>
+    //   (anonymous enum at /usr/include/string.h:120:9)
     
     if (isa<CXXRecordDecl>(D) && cast<CXXRecordDecl>(D)->isLambda()) {
-      OS << "<lambda";
+      OS << "(lambda";
       HasKindDecoration = true;
     } else {
-      OS << "<anonymous";
+      OS << "(anonymous";
     }
     
     if (Policy.AnonymousTagLocations) {
@@ -925,7 +925,7 @@ void TypePrinter::printTag(TagDecl *D, raw_ostream &OS) {
       }
     }
     
-    OS << '>';
+    OS << ')';
   }
 
   // If this is a class template specialization, print the template
diff --git lib/Parse/ParseDeclCXX.cpp lib/Parse/ParseDeclCXX.cpp
index c7c8625..3af1651 100644
--- lib/Parse/ParseDeclCXX.cpp
+++ lib/Parse/ParseDeclCXX.cpp
@@ -2515,7 +2515,7 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc,
             << /*ErrorType=*/6
             << (isa<NamedDecl>(TagDecl)
                   ? cast<NamedDecl>(TagDecl)->getQualifiedNameAsString()
-                  : "<anonymous>");
+                  : "(anonymous)");
         }
         break;
       }
diff --git lib/Sema/SemaTemplate.cpp lib/Sema/SemaTemplate.cpp
index 94627aa..0489a88 100644
--- lib/Sema/SemaTemplate.cpp
+++ lib/Sema/SemaTemplate.cpp
@@ -2515,7 +2515,7 @@ DeclResult Sema::ActOnVarTemplateSpecialization(
                 << Param->getDeclName();
           else
             Diag(Param->getLocation(), diag::note_partial_spec_unused_parameter)
-                << "<anonymous>";
+                << "(anonymous)";
         }
       }
     }
@@ -6117,7 +6117,7 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec,
           else
             Diag(Param->getLocation(),
                  diag::note_partial_spec_unused_parameter)
-              << "<anonymous>";
+              << "(anonymous)";
         }
       }
     }
diff --git test/Analysis/cfg.cpp test/Analysis/cfg.cpp
index 1f3bfac..65060b1 100644
--- test/Analysis/cfg.cpp
+++ test/Analysis/cfg.cpp
@@ -51,7 +51,7 @@ void checkWrap(int i) {
 // CHECK-NEXT: CXXConstructExpr
 // CHECK-NEXT:   9: struct standalone myStandalone;
 // CHECK-NEXT: CXXConstructExpr
-// CHECK-NEXT:  11: struct <anonymous struct at {{.*}}> myAnon;
+// CHECK-NEXT:  11: struct (anonymous struct at {{.*}}) myAnon;
 // CHECK-NEXT: CXXConstructExpr
 // CHECK-NEXT:  13: struct named myNamed;
 // CHECK-NEXT:   Preds (1): B2
diff --git test/CXX/expr/expr.prim/expr.prim.lambda/p19.cpp test/CXX/expr/expr.prim/expr.prim.lambda/p19.cpp
index 8a6e792..35b7789 100644
--- test/CXX/expr/expr.prim/expr.prim.lambda/p19.cpp
+++ test/CXX/expr/expr.prim/expr.prim.lambda/p19.cpp
@@ -10,7 +10,7 @@ void test_special_member_functions(MoveOnly mo, int i) {
   auto lambda1 = [i]() { }; // expected-note 2 {{lambda expression begins here}}
 
   // Default constructor
-  decltype(lambda1) lambda2; // expected-error{{call to implicitly-deleted default constructor of 'decltype(lambda1)' (aka '<lambda}}
+  decltype(lambda1) lambda2; // expected-error{{call to implicitly-deleted default constructor of 'decltype(lambda1)' (aka '(lambda}}
 
   // Copy assignment operator
   lambda1 = lambda1; // expected-error{{copy assignment operator is implicitly deleted}}
diff --git test/CodeGenCXX/destructors.cpp test/CodeGenCXX/destructors.cpp
index 9bd2754..5c43048 100644
--- test/CodeGenCXX/destructors.cpp
+++ test/CodeGenCXX/destructors.cpp
@@ -381,7 +381,7 @@ namespace test10 {
 
 // Checks from test3:
 
-  // CHECK-LABEL: define internal void @_ZN5test312_GLOBAL__N_11DD0Ev(%"struct.test3::<anonymous namespace>::D"* %this) unnamed_addr
+  // CHECK-LABEL: define internal void @_ZN5test312_GLOBAL__N_11DD0Ev(%"struct.test3::(anonymous namespace)::D"* %this) unnamed_addr
   // CHECK: invoke void {{.*}} @_ZN5test312_GLOBAL__N_11CD2Ev
   // CHECK: call void @_ZdlPv({{.*}}) [[NUW:#[0-9]+]]
   // CHECK: ret void
@@ -405,7 +405,7 @@ namespace test10 {
   // CHECK: call void @_ZN5test312_GLOBAL__N_11CD2Ev(
   // CHECK: ret void
 
-  // CHECK-LABEL: define internal void @_ZN5test312_GLOBAL__N_11CD2Ev(%"struct.test3::<anonymous namespace>::C"* %this) unnamed_addr
+  // CHECK-LABEL: define internal void @_ZN5test312_GLOBAL__N_11CD2Ev(%"struct.test3::(anonymous namespace)::C"* %this) unnamed_addr
   // CHECK: invoke void @_ZN5test31BD2Ev(
   // CHECK: call void @_ZN5test31AD2Ev(
   // CHECK: ret void
@@ -413,7 +413,7 @@ namespace test10 {
   // CHECK: declare void @_ZN5test31BD2Ev(
   // CHECK: declare void @_ZN5test31AD2Ev(
 
-  // CHECK-LABEL: define internal void @_ZN5test312_GLOBAL__N_11CD0Ev(%"struct.test3::<anonymous namespace>::C"* %this) unnamed_addr
+  // CHECK-LABEL: define internal void @_ZN5test312_GLOBAL__N_11CD0Ev(%"struct.test3::(anonymous namespace)::C"* %this) unnamed_addr
   // CHECK: invoke void @_ZN5test312_GLOBAL__N_11CD2Ev(
   // CHECK: call void @_ZdlPv({{.*}}) [[NUW]]
   // CHECK: ret void
diff --git test/CodeGenCXX/microsoft-abi-structors.cpp test/CodeGenCXX/microsoft-abi-structors.cpp
index 85b9a7d..b79da8d 100644
--- test/CodeGenCXX/microsoft-abi-structors.cpp
+++ test/CodeGenCXX/microsoft-abi-structors.cpp
@@ -417,6 +417,6 @@ void *getA() {
   return (void*)new A();
 }
 // CHECK: define internal x86_thiscallcc void @"\01??_GA@?A@@UAEPAXI at Z"
-// CHECK:               (%"struct.<anonymous namespace>::A"* %this, i32 %should_call_delete)
+// CHECK:               (%"struct.(anonymous namespace)::A"* %this, i32 %should_call_delete)
 // CHECK: define internal x86_thiscallcc void @"\01??1A@?A@@UAE at XZ"
-// CHECK:               (%"struct.<anonymous namespace>::A"* %this)
+// CHECK:               (%"struct.(anonymous namespace)::A"* %this)
diff --git test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp
index 879e1d9..1546e6c 100644
--- test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp
+++ test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp
@@ -35,14 +35,14 @@ void f() {
 // CHECK32: store i8* bitcast (void (%struct.C*)* @"\01??_9C@@$BA at AE" to i8*), i8** %ptr
 // CHECK32: store i8* bitcast (i32 (%struct.C*, i32, double)* @"\01??_9C@@$B3AE" to i8*), i8** %ptr2
 // CHECK32: store i8* bitcast (void (%struct.S*, %struct.C*, i32)* @"\01??_9C@@$B7AE" to i8*), i8** %ptr3
-// CHECK32: store i8* bitcast (void (%"struct.<anonymous namespace>::D"*)* @"\01??_9D@?A@@$BA at AE" to i8*), i8** %ptr4
+// CHECK32: store i8* bitcast (void (%"struct.(anonymous namespace)::D"*)* @"\01??_9D@?A@@$BA at AE" to i8*), i8** %ptr4
 // CHECK32: }
 //
 // CHECK64-LABEL: define void @"\01?f@@YAXXZ"()
 // CHECK64: store i8* bitcast (void (%struct.C*)* @"\01??_9C@@$BA at AA" to i8*), i8** %ptr
 // CHECK64: store i8* bitcast (i32 (%struct.C*, i32, double)* @"\01??_9C@@$B7AA" to i8*), i8** %ptr2
 // CHECK64: store i8* bitcast (void (%struct.S*, %struct.C*, i32)* @"\01??_9C@@$BBA at AA" to i8*), i8** %ptr3
-// CHECK64: store i8* bitcast (void (%"struct.<anonymous namespace>::D"*)* @"\01??_9D@?A@@$BA at AA" to i8*), i8** %ptr
+// CHECK64: store i8* bitcast (void (%"struct.(anonymous namespace)::D"*)* @"\01??_9D@?A@@$BA at AA" to i8*), i8** %ptr
 // CHECK64: }
 }
 
@@ -93,16 +93,16 @@ void f() {
 // CHECK64: }
 
 // Thunk for calling the virtual function in internal class D.
-// CHECK32-LABEL: define internal x86_thiscallcc void @"\01??_9D@?A@@$BA at AE"(%"struct.<anonymous namespace>::D"* %this) unnamed_addr
-// CHECK32: [[VPTR:%.*]] = getelementptr inbounds void (%"struct.<anonymous namespace>::D"*)** %{{.*}}, i64 0
-// CHECK32: [[CALLEE:%.*]] = load void (%"struct.<anonymous namespace>::D"*)** [[VPTR]]
-// CHECK32: call x86_thiscallcc void [[CALLEE]](%"struct.<anonymous namespace>::D"* %{{.*}})
+// CHECK32-LABEL: define internal x86_thiscallcc void @"\01??_9D@?A@@$BA at AE"(%"struct.(anonymous namespace)::D"* %this) unnamed_addr
+// CHECK32: [[VPTR:%.*]] = getelementptr inbounds void (%"struct.(anonymous namespace)::D"*)** %{{.*}}, i64 0
+// CHECK32: [[CALLEE:%.*]] = load void (%"struct.(anonymous namespace)::D"*)** [[VPTR]]
+// CHECK32: call x86_thiscallcc void [[CALLEE]](%"struct.(anonymous namespace)::D"* %{{.*}})
 // CHECK32: ret void
 // CHECK32: }
 //
-// CHECK64-LABEL: define internal void @"\01??_9D@?A@@$BA at AA"(%"struct.<anonymous namespace>::D"* %this) unnamed_addr
-// CHECK64: [[VPTR:%.*]] = getelementptr inbounds void (%"struct.<anonymous namespace>::D"*)** %{{.*}}, i64 0
-// CHECK64: [[CALLEE:%.*]] = load void (%"struct.<anonymous namespace>::D"*)** [[VPTR]]
-// CHECK64: call void [[CALLEE]](%"struct.<anonymous namespace>::D"* %{{.*}})
+// CHECK64-LABEL: define internal void @"\01??_9D@?A@@$BA at AA"(%"struct.(anonymous namespace)::D"* %this) unnamed_addr
+// CHECK64: [[VPTR:%.*]] = getelementptr inbounds void (%"struct.(anonymous namespace)::D"*)** %{{.*}}, i64 0
+// CHECK64: [[CALLEE:%.*]] = load void (%"struct.(anonymous namespace)::D"*)** [[VPTR]]
+// CHECK64: call void [[CALLEE]](%"struct.(anonymous namespace)::D"* %{{.*}})
 // CHECK64: ret void
 // CHECK64: }
diff --git test/CodeGenCXX/predefined-expr.cpp test/CodeGenCXX/predefined-expr.cpp
index b2b1ba3..f901467 100644
--- test/CodeGenCXX/predefined-expr.cpp
+++ test/CodeGenCXX/predefined-expr.cpp
@@ -10,7 +10,7 @@
 // CHECK: private unnamed_addr constant [122 x i8] c"static void ClassWithTemplateTemplateParam<char, NS::ClassTemplate>::staticMember() [T = char, Param = NS::ClassTemplate]\00"
 // CHECK: private unnamed_addr constant [106 x i8] c"void OuterClass<int *>::MiddleClass::InnerClass<float>::memberFunction(T, U) const [T = int *, U = float]\00"
 // CHECK: private unnamed_addr constant [51 x i8] c"void functionTemplateWithCapturedStmt(T) [T = int]\00"
-// CHECK: private unnamed_addr constant [76 x i8] c"auto functionTemplateWithLambda(int)::<anonymous class>::operator()() const\00"
+// CHECK: private unnamed_addr constant [76 x i8] c"auto functionTemplateWithLambda(int)::(anonymous class)::operator()() const\00"
 // CHECK: private unnamed_addr constant [65 x i8] c"void functionTemplateWithUnnamedTemplateParameter(T) [T = float]\00"
 
 // CHECK: private unnamed_addr constant [60 x i8] c"void functionTemplateExplicitSpecialization(T) [T = double]\00"
@@ -28,13 +28,13 @@
 // CHECK: private unnamed_addr constant [46 x i8] c"void NS::Base::functionTemplate1(T) [T = int]\00"
 
 // CHECK: private unnamed_addr constant [23 x i8] c"anonymousUnionFunction\00"
-// CHECK: private unnamed_addr constant [83 x i8] c"void NS::ContainerForAnonymousRecords::<anonymous union>::anonymousUnionFunction()\00"
+// CHECK: private unnamed_addr constant [83 x i8] c"void NS::ContainerForAnonymousRecords::(anonymous union)::anonymousUnionFunction()\00"
 
 // CHECK: private unnamed_addr constant [24 x i8] c"anonymousStructFunction\00"
-// CHECK: private unnamed_addr constant [85 x i8] c"void NS::ContainerForAnonymousRecords::<anonymous struct>::anonymousStructFunction()\00"
+// CHECK: private unnamed_addr constant [85 x i8] c"void NS::ContainerForAnonymousRecords::(anonymous struct)::anonymousStructFunction()\00"
 
 // CHECK: private unnamed_addr constant [23 x i8] c"anonymousClassFunction\00"
-// CHECK: private unnamed_addr constant [83 x i8] c"void NS::ContainerForAnonymousRecords::<anonymous class>::anonymousClassFunction()\00"
+// CHECK: private unnamed_addr constant [83 x i8] c"void NS::ContainerForAnonymousRecords::(anonymous class)::anonymousClassFunction()\00"
 
 // CHECK: private unnamed_addr constant [12 x i8] c"~Destructor\00"
 // CHECK: private unnamed_addr constant [30 x i8] c"NS::Destructor::~Destructor()\00"
@@ -93,7 +93,7 @@
 // CHECK: private unnamed_addr constant [59 x i8] c"void ClassInTopLevelNamespace::topLevelNamespaceFunction()\00"
 
 // CHECK: private unnamed_addr constant [27 x i8] c"anonymousNamespaceFunction\00"
-// CHECK: private unnamed_addr constant [84 x i8] c"void <anonymous namespace>::ClassInAnonymousNamespace::anonymousNamespaceFunction()\00"
+// CHECK: private unnamed_addr constant [84 x i8] c"void (anonymous namespace)::ClassInAnonymousNamespace::anonymousNamespaceFunction()\00"
 
 // CHECK: private unnamed_addr constant [19 x i8] c"localClassFunction\00"
 // CHECK: private unnamed_addr constant [59 x i8] c"void NS::localClass(int)::LocalClass::localClassFunction()\00"
diff --git test/Layout/ms-x86-alias-avoidance-padding.cpp test/Layout/ms-x86-alias-avoidance-padding.cpp
index f95c78b..aac6521 100644
--- test/Layout/ms-x86-alias-avoidance-padding.cpp
+++ test/Layout/ms-x86-alias-avoidance-padding.cpp
@@ -56,8 +56,8 @@ struct AT3 : AT2, AT1 {
 // CHECK-NEXT:    0 | struct AT3
 // CHECK-NEXT:    0 |   struct AT2 (base)
 // CHECK-NEXT:    0 |     struct AT0 t
-// CHECK-NEXT:    0 |       union AT0::<anonymous at {{.*}} x
-// CHECK-NEXT:    0 |         struct AT0::<anonymous at {{.*}} y
+// CHECK-NEXT:    0 |       union AT0::(anonymous at {{.*}} x
+// CHECK-NEXT:    0 |         struct AT0::(anonymous at {{.*}} y
 // CHECK-NEXT:    0 |           int a
 // CHECK-NEXT:    4 |           struct AT t (empty)
 // CHECK:         0 |         int b
@@ -81,8 +81,8 @@ struct AT3 : AT2, AT1 {
 // CHECK-X64-NEXT:    0 | struct AT3
 // CHECK-X64-NEXT:    0 |   struct AT2 (base)
 // CHECK-X64-NEXT:    0 |     struct AT0 t
-// CHECK-X64-NEXT:    0 |       union AT0::<anonymous at {{.*}} x
-// CHECK-X64-NEXT:    0 |         struct AT0::<anonymous at {{.*}} y
+// CHECK-X64-NEXT:    0 |       union AT0::(anonymous at {{.*}} x
+// CHECK-X64-NEXT:    0 |         struct AT0::(anonymous at {{.*}} y
 // CHECK-X64-NEXT:    0 |           int a
 // CHECK-X64-NEXT:    4 |           struct AT t (empty)
 // CHECK-X64:         0 |         int b
diff --git test/Modules/namespaces.cpp test/Modules/namespaces.cpp
index 003c7d3..5e4bc22 100644
--- test/Modules/namespaces.cpp
+++ test/Modules/namespaces.cpp
@@ -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 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 *'}}  
+  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 at Inputs/namespaces-right.h:60 {{passing argument to parameter here}}
diff --git test/OpenMP/threadprivate_messages.cpp test/OpenMP/threadprivate_messages.cpp
index 4e50c6f..4b4f9e0 100644
--- test/OpenMP/threadprivate_messages.cpp
+++ test/OpenMP/threadprivate_messages.cpp
@@ -99,9 +99,9 @@ static __thread int t; // expected-note {{'t' defined here}}
 int o; // expected-note {{candidate found by name lookup is 'o'}}
 #pragma omp threadprivate (o)
 namespace {
-int o; // expected-note {{candidate found by name lookup is '<anonymous namespace>::o'}}
+int o; // expected-note {{candidate found by name lookup is '(anonymous namespace)::o'}}
 #pragma omp threadprivate (o)
-#pragma omp threadprivate (o) // expected-error {{'#pragma omp threadprivate' must precede all references to variable '<anonymous namespace>::o'}}
+#pragma omp threadprivate (o) // expected-error {{'#pragma omp threadprivate' must precede all references to variable '(anonymous namespace)::o'}}
 }
 #pragma omp threadprivate (o) // expected-error {{reference to 'o' is ambiguous}}
 #pragma omp threadprivate (::o) // expected-error {{'#pragma omp threadprivate' must precede all references to variable 'o'}}
diff --git test/Parser/cxx0x-lambda-expressions.cpp test/Parser/cxx0x-lambda-expressions.cpp
index 289d03c..00d1222 100644
--- test/Parser/cxx0x-lambda-expressions.cpp
+++ test/Parser/cxx0x-lambda-expressions.cpp
@@ -34,7 +34,7 @@ class C {
     typedef int T; 
     const int b = 0; 
     const int c = 1;
-    int a1[1] = {[b] (T()) {}}; // expected-error{{no viable conversion from '<lambda}}
+    int a1[1] = {[b] (T()) {}}; // expected-error{{no viable conversion from '(lambda}}
     int a2[1] = {[b] = 1 };
     int a3[1] = {[b,c] = 1 }; // expected-error{{expected body of lambda expression}}
     int a4[1] = {[&b] = 1 }; // expected-error{{integral constant expression must have integral or unscoped enumeration type, not 'const int *'}}
diff --git test/Sema/switch.c test/Sema/switch.c
index a2f87b9..092378d 100644
--- test/Sema/switch.c
+++ test/Sema/switch.c
@@ -109,14 +109,14 @@ void test7() {
   switch(a) {
     case A:
     case B:
-    case 3: // expected-warning{{case value not in enumerated type 'enum <anonymous enum}}
+    case 3: // expected-warning{{case value not in enumerated type 'enum (anonymous enum}}
       break;
   }
   switch(a) {
     case A:
     case B:
-    case 3 ... //expected-warning{{case value not in enumerated type 'enum <anonymous enum}}
-        4: //expected-warning{{case value not in enumerated type 'enum <anonymous enum}}
+    case 3 ... //expected-warning{{case value not in enumerated type 'enum (anonymous enum}}
+        4: //expected-warning{{case value not in enumerated type 'enum (anonymous enum}}
       break;
   }
   switch(a) {
@@ -124,16 +124,16 @@ void test7() {
       break;
   }
   switch(a) {
-    case 0 ... 2: //expected-warning{{case value not in enumerated type 'enum <anonymous enum}}
+    case 0 ... 2: //expected-warning{{case value not in enumerated type 'enum (anonymous enum}}
       break;
   }
   switch(a) {
-    case 1 ... 3: //expected-warning{{case value not in enumerated type 'enum <anonymous enum}}
+    case 1 ... 3: //expected-warning{{case value not in enumerated type 'enum (anonymous enum}}
       break;
   }
   switch(a) {
-    case 0 ...  //expected-warning{{case value not in enumerated type 'enum <anonymous enum}}
-      3:  //expected-warning{{case value not in enumerated type 'enum <anonymous enum}}
+    case 0 ...  //expected-warning{{case value not in enumerated type 'enum (anonymous enum}}
+      3:  //expected-warning{{case value not in enumerated type 'enum (anonymous enum}}
       break;
   }
 
@@ -167,11 +167,11 @@ void test9() {
     C = 1
   } a;
   switch(a) {
-    case 0: //expected-warning{{case value not in enumerated type 'enum <anonymous enum}}
+    case 0: //expected-warning{{case value not in enumerated type 'enum (anonymous enum}}
     case 1:
-    case 2: //expected-warning{{case value not in enumerated type 'enum <anonymous enum}}
+    case 2: //expected-warning{{case value not in enumerated type 'enum (anonymous enum}}
     case 3:
-    case 4: //expected-warning{{case value not in enumerated type 'enum <anonymous enum}}
+    case 4: //expected-warning{{case value not in enumerated type 'enum (anonymous enum}}
       break;
   }
 }
@@ -184,14 +184,14 @@ void test10() {
     D = 12
   } a;
   switch(a) {
-    case 0 ...  //expected-warning{{case value not in enumerated type 'enum <anonymous enum}}
-	    1:  //expected-warning{{case value not in enumerated type 'enum <anonymous enum}}
+    case 0 ...  //expected-warning{{case value not in enumerated type 'enum (anonymous enum}}
+	    1:  //expected-warning{{case value not in enumerated type 'enum (anonymous enum}}
     case 2 ... 4:
-    case 5 ...  //expected-warning{{case value not in enumerated type 'enum <anonymous enum}}	
-	      9:  //expected-warning{{case value not in enumerated type 'enum <anonymous enum}}
+    case 5 ...  //expected-warning{{case value not in enumerated type 'enum (anonymous enum}}	
+	      9:  //expected-warning{{case value not in enumerated type 'enum (anonymous enum}}
     case 10 ... 12:
-    case 13 ...  //expected-warning{{case value not in enumerated type 'enum <anonymous enum}}
-              16: //expected-warning{{case value not in enumerated type 'enum <anonymous enum}}
+    case 13 ...  //expected-warning{{case value not in enumerated type 'enum (anonymous enum}}
+              16: //expected-warning{{case value not in enumerated type 'enum (anonymous enum}}
       break;
   }
 }
diff --git test/SemaCXX/ms-interface.cpp test/SemaCXX/ms-interface.cpp
index 3625f70..e7386ce 100644
--- test/SemaCXX/ms-interface.cpp
+++ test/SemaCXX/ms-interface.cpp
@@ -10,7 +10,7 @@ __interface I1 {
   bool operator!();
   // expected-error at +1 {{operator 'operator int' is not permitted within an interface type}}
   operator int();
-  // expected-error at +1 {{nested class I1::<anonymous> is not permitted within an interface type}}
+  // expected-error at +1 {{nested class I1::(anonymous) is not permitted within an interface type}}
   struct { int a; };
   void fn2() {
     struct A { }; // should be ignored: not a nested class
diff --git test/SemaCXX/undefined-internal.cpp test/SemaCXX/undefined-internal.cpp
index 67ad110..1cb0708 100644
--- test/SemaCXX/undefined-internal.cpp
+++ test/SemaCXX/undefined-internal.cpp
@@ -18,9 +18,9 @@ namespace test1 {
 
 namespace test2 {
   namespace {
-    void foo(); // expected-warning {{function 'test2::<anonymous namespace>::foo' has internal linkage but is not defined}}
-    extern int var; // expected-warning {{variable 'test2::<anonymous namespace>::var' has internal linkage but is not defined}}
-    template <class T> void bar(); // expected-warning {{function 'test2::<anonymous namespace>::bar<int>' has internal linkage but is not defined}}
+    void foo(); // expected-warning {{function 'test2::(anonymous namespace)::foo' has internal linkage but is not defined}}
+    extern int var; // expected-warning {{variable 'test2::(anonymous namespace)::var' has internal linkage but is not defined}}
+    template <class T> void bar(); // expected-warning {{function 'test2::(anonymous namespace)::bar<int>' has internal linkage but is not defined}}
   }
   void test() {
     foo(); // expected-note {{used here}}
@@ -52,11 +52,11 @@ namespace test3 {
 namespace test4 {
   namespace {
     struct A {
-      A(); // expected-warning {{function 'test4::<anonymous namespace>::A::A' has internal linkage but is not defined}}
-      ~A();// expected-warning {{function 'test4::<anonymous namespace>::A::~A' has internal linkage but is not defined}}
-      virtual void foo(); // expected-warning {{function 'test4::<anonymous namespace>::A::foo' has internal linkage but is not defined}}
+      A(); // expected-warning {{function 'test4::(anonymous namespace)::A::A' has internal linkage but is not defined}}
+      ~A();// expected-warning {{function 'test4::(anonymous namespace)::A::~A' has internal linkage but is not defined}}
+      virtual void foo(); // expected-warning {{function 'test4::(anonymous namespace)::A::foo' has internal linkage but is not defined}}
       virtual void bar() = 0;
-      virtual void baz(); // expected-warning {{function 'test4::<anonymous namespace>::A::baz' has internal linkage but is not defined}}
+      virtual void baz(); // expected-warning {{function 'test4::(anonymous namespace)::A::baz' has internal linkage but is not defined}}
     };
   }
 
@@ -78,8 +78,8 @@ namespace test5 {
   }
 
   template <class N> struct B {
-    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}}
+    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() {
@@ -178,7 +178,7 @@ namespace cxx11_odr_rules {
 namespace OverloadUse {
   namespace {
     void f();
-    void f(int); // expected-warning {{function 'OverloadUse::<anonymous namespace>::f' has internal linkage but is not defined}}
+    void f(int); // expected-warning {{function 'OverloadUse::(anonymous namespace)::f' has internal linkage but is not defined}}
   }
   template<void x()> void t(int*) { x(); }
   template<void x(int)> void t(long*) { x(10); } // expected-note {{used here}}
@@ -196,7 +196,7 @@ namespace test7 {
 
 namespace test8 {
   typedef struct {
-    void bar(); // expected-warning {{function 'test8::<anonymous struct>::bar' has internal linkage but is not defined}}
+    void bar(); // expected-warning {{function 'test8::(anonymous struct)::bar' has internal linkage but is not defined}}
     void foo() {
       bar(); // expected-note {{used here}}
     }
@@ -207,7 +207,7 @@ namespace test9 {
   namespace {
     struct X {
       virtual void notused() = 0;
-      virtual void used() = 0; // expected-warning {{function 'test9::<anonymous namespace>::X::used' has internal linkage but is not defined}}
+      virtual void used() = 0; // expected-warning {{function 'test9::(anonymous namespace)::X::used' has internal linkage but is not defined}}
     };
   }
   void test(X &x) {
@@ -220,7 +220,7 @@ namespace test10 {
   namespace {
     struct X {
       virtual void notused() = 0;
-      virtual void used() = 0; // expected-warning {{function 'test10::<anonymous namespace>::X::used' has internal linkage but is not defined}}
+      virtual void used() = 0; // expected-warning {{function 'test10::(anonymous namespace)::X::used' has internal linkage but is not defined}}
 
       void test() {
         notused();
@@ -247,11 +247,11 @@ namespace test11 {
     };
 
     struct B {
-      bool operator()() const;  // expected-warning {{function 'test11::<anonymous namespace>::B::operator()' has internal linkage but is not defined}}
-      void operator!() const;  // expected-warning {{function 'test11::<anonymous namespace>::B::operator!' has internal linkage but is not defined}}
-      bool operator+(const B&) const;  // expected-warning {{function 'test11::<anonymous namespace>::B::operator+' has internal linkage but is not defined}}
-      int operator[](int) const;  // expected-warning {{function 'test11::<anonymous namespace>::B::operator[]' has internal linkage but is not defined}}
-      const B* operator->() const;  // expected-warning {{function 'test11::<anonymous namespace>::B::operator->' has internal linkage but is not defined}}
+      bool operator()() const;  // expected-warning {{function 'test11::(anonymous namespace)::B::operator()' has internal linkage but is not defined}}
+      void operator!() const;  // expected-warning {{function 'test11::(anonymous namespace)::B::operator!' has internal linkage but is not defined}}
+      bool operator+(const B&) const;  // expected-warning {{function 'test11::(anonymous namespace)::B::operator+' has internal linkage but is not defined}}
+      int operator[](int) const;  // expected-warning {{function 'test11::(anonymous namespace)::B::operator[]' has internal linkage but is not defined}}
+      const B* operator->() const;  // expected-warning {{function 'test11::(anonymous namespace)::B::operator->' has internal linkage but is not defined}}
       int member;
     };
   }
@@ -281,18 +281,18 @@ namespace test12 {
     struct Cls {
       virtual void f(int) = 0;
       virtual void f(int, double) = 0;
-      void g(int);  // expected-warning {{function 'test12::<anonymous namespace>::Cls::g' has internal linkage but is not defined}}
+      void g(int);  // expected-warning {{function 'test12::(anonymous namespace)::Cls::g' has internal linkage but is not defined}}
       void g(int, double);
       virtual operator T1() = 0;
       virtual operator T2() = 0;
       virtual operator T3&() = 0;
-      operator T4();  // expected-warning {{function 'test12::<anonymous namespace>::Cls::operator T4' has internal linkage but is not defined}}
-      operator T5();  // expected-warning {{function 'test12::<anonymous namespace>::Cls::operator T5' has internal linkage but is not defined}}
-      operator T6&();  // expected-warning {{function 'test12::<anonymous namespace>::Cls::operator test12::T6 &' has internal linkage but is not defined}}
+      operator T4();  // expected-warning {{function 'test12::(anonymous namespace)::Cls::operator T4' has internal linkage but is not defined}}
+      operator T5();  // expected-warning {{function 'test12::(anonymous namespace)::Cls::operator T5' has internal linkage but is not defined}}
+      operator T6&();  // expected-warning {{function 'test12::(anonymous namespace)::Cls::operator test12::T6 &' has internal linkage but is not defined}}
     };
 
     struct Cls2 {
-      Cls2(T7);  // expected-warning {{function 'test12::<anonymous namespace>::Cls2::Cls2' has internal linkage but is not defined}}
+      Cls2(T7);  // expected-warning {{function 'test12::(anonymous namespace)::Cls2::Cls2' has internal linkage but is not defined}}
     };
   }
 
diff --git test/SemaCXX/warn-shadow.cpp test/SemaCXX/warn-shadow.cpp
index 68e9467..5ad2233 100644
--- test/SemaCXX/warn-shadow.cpp
+++ test/SemaCXX/warn-shadow.cpp
@@ -22,7 +22,7 @@ using namespace xx;
 using namespace yy;
 
 void foo() {
-  int i; // expected-warning {{declaration shadows a variable in namespace '<anonymous>'}}
+  int i; // expected-warning {{declaration shadows a variable in namespace '(anonymous)'}}
   int j; // expected-warning {{declaration shadows a variable in namespace 'one::two'}}
   int m;
 }
diff --git test/SemaCXX/warn-sign-conversion.cpp test/SemaCXX/warn-sign-conversion.cpp
index ba2bc9b..746b124 100644
--- test/SemaCXX/warn-sign-conversion.cpp
+++ test/SemaCXX/warn-sign-conversion.cpp
@@ -25,23 +25,23 @@ namespace test1 {
     int c1 = 1 ? i : Foo<bool>::C;
     int c2 = 1 ? Foo<bool>::C : i;
 
-    int d1a = 1 ? i : Foo<bool>::D; // expected-warning {{test1::Foo<bool>::<anonymous enum at }}
-    int d1b = 1 ? i : Foo<bool>::D; // expected-warning {{warn-sign-conversion.cpp:13:5>' to 'int'}}
-    int d2a = 1 ? Foo<bool>::D : i; // expected-warning {{operand of ? changes signedness: 'test1::Foo<bool>::<anonymous enum at }}
-    int d2b = 1 ? Foo<bool>::D : i; // expected-warning {{warn-sign-conversion.cpp:13:5>' to 'int'}}
-    int d3a = 1 ? B : Foo<bool>::D; // expected-warning {{operand of ? changes signedness: 'test1::Foo<bool>::<anonymous enum at }}
-    int d3b = 1 ? B : Foo<bool>::D; // expected-warning {{warn-sign-conversion.cpp:13:5>' to 'int'}}
-    int d4a = 1 ? Foo<bool>::D : B; // expected-warning {{operand of ? changes signedness: 'test1::Foo<bool>::<anonymous enum at }}
-    int d4b = 1 ? Foo<bool>::D : B; // expected-warning {{warn-sign-conversion.cpp:13:5>' to 'int'}}
-
-    int e1a = 1 ? i : E; // expected-warning {{operand of ? changes signedness: 'test1::<anonymous enum at }}
-    int e1b = 1 ? i : E; // expected-warning {{warn-sign-conversion.cpp:16:3>' to 'int'}}
-    int e2a = 1 ? E : i; // expected-warning {{operand of ? changes signedness: 'test1::<anonymous enum at }}
-    int e2b = 1 ? E : i; // expected-warning {{warn-sign-conversion.cpp:16:3>' to 'int'}}
-    int e3a = 1 ? E : B; // expected-warning {{operand of ? changes signedness: 'test1::<anonymous enum at }}
-    int e3b = 1 ? E : B; // expected-warning {{warn-sign-conversion.cpp:16:3>' to 'int'}}
-    int e4a = 1 ? B : E; // expected-warning {{operand of ? changes signedness: 'test1::<anonymous enum at }}
-    int e4b = 1 ? B : E; // expected-warning {{warn-sign-conversion.cpp:16:3>' to 'int'}}
+    int d1a = 1 ? i : Foo<bool>::D; // expected-warning {{test1::Foo<bool>::(anonymous enum at }}
+    int d1b = 1 ? i : Foo<bool>::D; // expected-warning {{warn-sign-conversion.cpp:13:5)' to 'int'}}
+    int d2a = 1 ? Foo<bool>::D : i; // expected-warning {{operand of ? changes signedness: 'test1::Foo<bool>::(anonymous enum at }}
+    int d2b = 1 ? Foo<bool>::D : i; // expected-warning {{warn-sign-conversion.cpp:13:5)' to 'int'}}
+    int d3a = 1 ? B : Foo<bool>::D; // expected-warning {{operand of ? changes signedness: 'test1::Foo<bool>::(anonymous enum at }}
+    int d3b = 1 ? B : Foo<bool>::D; // expected-warning {{warn-sign-conversion.cpp:13:5)' to 'int'}}
+    int d4a = 1 ? Foo<bool>::D : B; // expected-warning {{operand of ? changes signedness: 'test1::Foo<bool>::(anonymous enum at }}
+    int d4b = 1 ? Foo<bool>::D : B; // expected-warning {{warn-sign-conversion.cpp:13:5)' to 'int'}}
+
+    int e1a = 1 ? i : E; // expected-warning {{operand of ? changes signedness: 'test1::(anonymous enum at }}
+    int e1b = 1 ? i : E; // expected-warning {{warn-sign-conversion.cpp:16:3)' to 'int'}}
+    int e2a = 1 ? E : i; // expected-warning {{operand of ? changes signedness: 'test1::(anonymous enum at }}
+    int e2b = 1 ? E : i; // expected-warning {{warn-sign-conversion.cpp:16:3)' to 'int'}}
+    int e3a = 1 ? E : B; // expected-warning {{operand of ? changes signedness: 'test1::(anonymous enum at }}
+    int e3b = 1 ? E : B; // expected-warning {{warn-sign-conversion.cpp:16:3)' to 'int'}}
+    int e4a = 1 ? B : E; // expected-warning {{operand of ? changes signedness: 'test1::(anonymous enum at }}
+    int e4b = 1 ? B : E; // expected-warning {{warn-sign-conversion.cpp:16:3)' to 'int'}}
   }
 }
 
diff --git unittests/ASTMatchers/ASTMatchersTest.cpp unittests/ASTMatchers/ASTMatchersTest.cpp
index f1b7921..9ff59f1 100644
--- unittests/ASTMatchers/ASTMatchersTest.cpp
+++ unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -1040,7 +1040,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 namespace>::A")))));
+      fieldDecl(hasType(asString("struct (anonymous namespace)::A")))));
 }
 
 TEST(Matcher, OverloadedOperatorCall) {


More information about the cfe-commits mailing list