From abe1a398e33bac03596116c97a7375d074101903 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Wed, 2 Apr 2014 05:58:29 +0000 Subject: [PATCH] Render anonymous entities as '(anonymous )' (and lambdas as '(lambda at ... )') For namespaces, this is consistent with mangling and GCC's debug info behavior. For structs, GCC uses 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. llvm-svn: 205398 --- clang/include/clang/AST/PrettyPrinter.h | 2 +- clang/lib/AST/Decl.cpp | 6 +-- clang/lib/AST/TemplateBase.cpp | 4 +- clang/lib/AST/TypePrinter.cpp | 10 ++-- clang/lib/Parse/ParseDeclCXX.cpp | 2 +- clang/lib/Sema/SemaTemplate.cpp | 4 +- clang/test/Analysis/cfg.cpp | 2 +- .../expr/expr.prim/expr.prim.lambda/p19.cpp | 2 +- clang/test/CodeGenCXX/destructors.cpp | 6 +-- .../CodeGenCXX/microsoft-abi-structors.cpp | 4 +- .../microsoft-abi-virtual-member-pointers.cpp | 20 ++++---- clang/test/CodeGenCXX/predefined-expr.cpp | 10 ++-- .../Layout/ms-x86-alias-avoidance-padding.cpp | 8 ++-- clang/test/Modules/namespaces.cpp | 4 +- clang/test/OpenMP/threadprivate_messages.cpp | 4 +- .../test/Parser/cxx0x-lambda-expressions.cpp | 2 +- clang/test/Sema/switch.c | 32 ++++++------- clang/test/SemaCXX/ms-interface.cpp | 2 +- clang/test/SemaCXX/undefined-internal.cpp | 46 +++++++++---------- clang/test/SemaCXX/warn-shadow.cpp | 2 +- clang/test/SemaCXX/warn-sign-conversion.cpp | 32 ++++++------- .../unittests/ASTMatchers/ASTMatchersTest.cpp | 2 +- 22 files changed, 103 insertions(+), 103 deletions(-) diff --git a/clang/include/clang/AST/PrettyPrinter.h b/clang/include/clang/AST/PrettyPrinter.h index 8f89379d4a0d..349f4c44a4e0 100644 --- a/clang/include/clang/AST/PrettyPrinter.h +++ b/clang/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 "). Otherwise, just - /// prints "" for the name. + /// prints "(anonymous)" for the name. bool AnonymousTagLocations : 1; /// \brief When true, suppress printing of the __strong lifetime qualifier in diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index c2e1a848c138..83cbb44f7f91 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -1303,12 +1303,12 @@ void NamedDecl::printQualifiedName(raw_ostream &OS, P); } else if (const NamespaceDecl *ND = dyn_cast(*I)) { if (ND->isAnonymousNamespace()) - OS << ""; + OS << "(anonymous namespace)"; else OS << *ND; } else if (const RecordDecl *RD = dyn_cast(*I)) { if (!RD->getIdentifier()) - OS << "getKindName() << '>'; + OS << "(anonymous " << RD->getKindName() << ')'; else OS << *RD; } else if (const FunctionDecl *FD = dyn_cast(*I)) { @@ -1341,7 +1341,7 @@ void NamedDecl::printQualifiedName(raw_ostream &OS, if (getDeclName()) OS << *this; else - OS << ""; + OS << "(anonymous)"; } void NamedDecl::getNameForDiagnostic(raw_ostream &OS, diff --git a/clang/lib/AST/TemplateBase.cpp b/clang/lib/AST/TemplateBase.cpp index b068ffafef50..52f95bf25afd 100644 --- a/clang/lib/AST/TemplateBase.cpp +++ b/clang/lib/AST/TemplateBase.cpp @@ -345,7 +345,7 @@ void TemplateArgument::print(const PrintingPolicy &Policy, raw_ostream &Out) const { switch (getKind()) { case Null: - Out << ""; + 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 << ""; + Out << "(anonymous)"; } break; } diff --git a/clang/lib/AST/TypePrinter.cpp b/clang/lib/AST/TypePrinter.cpp index 8f18f4c6c2a0..89ec8d6bbc4d 100644 --- a/clang/lib/AST/TypePrinter.cpp +++ b/clang/lib/AST/TypePrinter.cpp @@ -848,7 +848,7 @@ void TypePrinter::AppendScope(DeclContext *DC, raw_ostream &OS) { if (NS->getIdentifier()) OS << NS->getName() << "::"; else - OS << "::"; + OS << "(anonymous namespace)::"; } else if (ClassTemplateSpecializationDecl *Spec = dyn_cast(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) if (isa(D) && cast(D)->isLambda()) { - OS << "'; + OS << ')'; } // If this is a class template specialization, print the template diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index c84bdcbf35b2..cef748f2aae5 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -2517,7 +2517,7 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc, << /*ErrorType=*/6 << (isa(TagDecl) ? cast(TagDecl)->getQualifiedNameAsString() - : ""); + : "(anonymous)"); } break; } diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 2b88bf9bf0b0..9be7189ba90f 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -2515,7 +2515,7 @@ DeclResult Sema::ActOnVarTemplateSpecialization( << Param->getDeclName(); else Diag(Param->getLocation(), diag::note_partial_spec_unused_parameter) - << ""; + << "(anonymous)"; } } } @@ -6115,7 +6115,7 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, else Diag(Param->getLocation(), diag::note_partial_spec_unused_parameter) - << ""; + << "(anonymous)"; } } } diff --git a/clang/test/Analysis/cfg.cpp b/clang/test/Analysis/cfg.cpp index 1f3bfac2c380..65060b168744 100644 --- a/clang/test/Analysis/cfg.cpp +++ b/clang/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 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 a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p19.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p19.cpp index 8a6e79273d55..35b77896c868 100644 --- a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p19.cpp +++ b/clang/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 '::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::::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::::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 a/clang/test/CodeGenCXX/microsoft-abi-structors.cpp b/clang/test/CodeGenCXX/microsoft-abi-structors.cpp index 85b9a7df63cf..b79da8d6cb18 100644 --- a/clang/test/CodeGenCXX/microsoft-abi-structors.cpp +++ b/clang/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@Z" -// CHECK: (%"struct.::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@XZ" -// CHECK: (%"struct.::A"* %this) +// CHECK: (%"struct.(anonymous namespace)::A"* %this) diff --git a/clang/test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp b/clang/test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp index 879e1d9cfde3..1546e6ce561d 100644 --- a/clang/test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp +++ b/clang/test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp @@ -35,14 +35,14 @@ void f() { // CHECK32: store i8* bitcast (void (%struct.C*)* @"\01??_9C@@$BA@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.::D"*)* @"\01??_9D@?A@@$BA@AE" to i8*), i8** %ptr4 +// CHECK32: store i8* bitcast (void (%"struct.(anonymous namespace)::D"*)* @"\01??_9D@?A@@$BA@AE" to i8*), i8** %ptr4 // CHECK32: } // // CHECK64-LABEL: define void @"\01?f@@YAXXZ"() // CHECK64: store i8* bitcast (void (%struct.C*)* @"\01??_9C@@$BA@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@AA" to i8*), i8** %ptr3 -// CHECK64: store i8* bitcast (void (%"struct.::D"*)* @"\01??_9D@?A@@$BA@AA" to i8*), i8** %ptr +// CHECK64: store i8* bitcast (void (%"struct.(anonymous namespace)::D"*)* @"\01??_9D@?A@@$BA@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@AE"(%"struct.::D"* %this) unnamed_addr -// CHECK32: [[VPTR:%.*]] = getelementptr inbounds void (%"struct.::D"*)** %{{.*}}, i64 0 -// CHECK32: [[CALLEE:%.*]] = load void (%"struct.::D"*)** [[VPTR]] -// CHECK32: call x86_thiscallcc void [[CALLEE]](%"struct.::D"* %{{.*}}) +// CHECK32-LABEL: define internal x86_thiscallcc void @"\01??_9D@?A@@$BA@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@AA"(%"struct.::D"* %this) unnamed_addr -// CHECK64: [[VPTR:%.*]] = getelementptr inbounds void (%"struct.::D"*)** %{{.*}}, i64 0 -// CHECK64: [[CALLEE:%.*]] = load void (%"struct.::D"*)** [[VPTR]] -// CHECK64: call void [[CALLEE]](%"struct.::D"* %{{.*}}) +// CHECK64-LABEL: define internal void @"\01??_9D@?A@@$BA@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 a/clang/test/CodeGenCXX/predefined-expr.cpp b/clang/test/CodeGenCXX/predefined-expr.cpp index b2b1ba3030cf..f901467c4f4b 100644 --- a/clang/test/CodeGenCXX/predefined-expr.cpp +++ b/clang/test/CodeGenCXX/predefined-expr.cpp @@ -10,7 +10,7 @@ // CHECK: private unnamed_addr constant [122 x i8] c"static void ClassWithTemplateTemplateParam::staticMember() [T = char, Param = NS::ClassTemplate]\00" // CHECK: private unnamed_addr constant [106 x i8] c"void OuterClass::MiddleClass::InnerClass::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)::::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::::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::::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::::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 ::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 a/clang/test/Layout/ms-x86-alias-avoidance-padding.cpp b/clang/test/Layout/ms-x86-alias-avoidance-padding.cpp index f95c78b6de60..aac652135a44 100644 --- a/clang/test/Layout/ms-x86-alias-avoidance-padding.cpp +++ b/clang/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::::Foo *' with an rvalue of type 'N11::::Foo *'}} - N12::consumeFoo(N12::getFoo()); // expected-error{{cannot initialize a parameter of type 'N12::::Foo *' with an rvalue of type 'N12::::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}} diff --git a/clang/test/OpenMP/threadprivate_messages.cpp b/clang/test/OpenMP/threadprivate_messages.cpp index 4e50c6f9d46b..4b4f9e014632 100644 --- a/clang/test/OpenMP/threadprivate_messages.cpp +++ b/clang/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 '::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 '::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 a/clang/test/Parser/cxx0x-lambda-expressions.cpp b/clang/test/Parser/cxx0x-lambda-expressions.cpp index 9ce24cbb04ae..53ea05ea8609 100644 --- a/clang/test/Parser/cxx0x-lambda-expressions.cpp +++ b/clang/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 ' is not permitted within an interface type}} + // expected-error@+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 a/clang/test/SemaCXX/undefined-internal.cpp b/clang/test/SemaCXX/undefined-internal.cpp index 67ad110fb34d..1cb0708a5320 100644 --- a/clang/test/SemaCXX/undefined-internal.cpp +++ b/clang/test/SemaCXX/undefined-internal.cpp @@ -18,9 +18,9 @@ namespace test1 { namespace test2 { namespace { - void foo(); // expected-warning {{function 'test2::::foo' has internal linkage but is not defined}} - extern int var; // expected-warning {{variable 'test2::::var' has internal linkage but is not defined}} - template void bar(); // expected-warning {{function 'test2::::bar' 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 void bar(); // expected-warning {{function 'test2::(anonymous namespace)::bar' 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::::A::A' has internal linkage but is not defined}} - ~A();// expected-warning {{function 'test4::::A::~A' has internal linkage but is not defined}} - virtual void foo(); // expected-warning {{function 'test4::::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::::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 struct B { - static int var; // expected-warning {{variable 'test5::B::A>::var' has internal linkage but is not defined}} - static void foo(); // expected-warning {{function 'test5::B::A>::foo' has internal linkage but is not defined}} + static int var; // expected-warning {{variable 'test5::B::var' has internal linkage but is not defined}} + static void foo(); // expected-warning {{function 'test5::B::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::::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 t(int*) { x(); } template 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::::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::::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::::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::::B::operator()' has internal linkage but is not defined}} - void operator!() const; // expected-warning {{function 'test11::::B::operator!' has internal linkage but is not defined}} - bool operator+(const B&) const; // expected-warning {{function 'test11::::B::operator+' has internal linkage but is not defined}} - int operator[](int) const; // expected-warning {{function 'test11::::B::operator[]' has internal linkage but is not defined}} - const B* operator->() const; // expected-warning {{function 'test11::::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::::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::::Cls::operator T4' has internal linkage but is not defined}} - operator T5(); // expected-warning {{function 'test12::::Cls::operator T5' has internal linkage but is not defined}} - operator T6&(); // expected-warning {{function 'test12::::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::::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 a/clang/test/SemaCXX/warn-shadow.cpp b/clang/test/SemaCXX/warn-shadow.cpp index 68e9467a937b..5ad2233d234a 100644 --- a/clang/test/SemaCXX/warn-shadow.cpp +++ b/clang/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 ''}} + 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 a/clang/test/SemaCXX/warn-sign-conversion.cpp b/clang/test/SemaCXX/warn-sign-conversion.cpp index ba2bc9b3d026..746b1242fe1b 100644 --- a/clang/test/SemaCXX/warn-sign-conversion.cpp +++ b/clang/test/SemaCXX/warn-sign-conversion.cpp @@ -25,23 +25,23 @@ namespace test1 { int c1 = 1 ? i : Foo::C; int c2 = 1 ? Foo::C : i; - int d1a = 1 ? i : Foo::D; // expected-warning {{test1::Foo::::D; // expected-warning {{warn-sign-conversion.cpp:13:5>' to 'int'}} - int d2a = 1 ? Foo::D : i; // expected-warning {{operand of ? changes signedness: 'test1::Foo::::D : i; // expected-warning {{warn-sign-conversion.cpp:13:5>' to 'int'}} - int d3a = 1 ? B : Foo::D; // expected-warning {{operand of ? changes signedness: 'test1::Foo::::D; // expected-warning {{warn-sign-conversion.cpp:13:5>' to 'int'}} - int d4a = 1 ? Foo::D : B; // expected-warning {{operand of ? changes signedness: 'test1::Foo::::D : B; // expected-warning {{warn-sign-conversion.cpp:13:5>' to 'int'}} + int d1a = 1 ? i : Foo::D; // expected-warning {{test1::Foo::(anonymous enum at }} + int d1b = 1 ? i : Foo::D; // expected-warning {{warn-sign-conversion.cpp:13:5)' to 'int'}} + int d2a = 1 ? Foo::D : i; // expected-warning {{operand of ? changes signedness: 'test1::Foo::(anonymous enum at }} + int d2b = 1 ? Foo::D : i; // expected-warning {{warn-sign-conversion.cpp:13:5)' to 'int'}} + int d3a = 1 ? B : Foo::D; // expected-warning {{operand of ? changes signedness: 'test1::Foo::(anonymous enum at }} + int d3b = 1 ? B : Foo::D; // expected-warning {{warn-sign-conversion.cpp:13:5)' to 'int'}} + int d4a = 1 ? Foo::D : B; // expected-warning {{operand of ? changes signedness: 'test1::Foo::(anonymous enum at }} + int d4b = 1 ? Foo::D : B; // expected-warning {{warn-sign-conversion.cpp:13:5)' to 'int'}} - int e1a = 1 ? i : E; // expected-warning {{operand of ? changes signedness: 'test1::' to 'int'}} - int e2a = 1 ? E : i; // expected-warning {{operand of ? changes signedness: 'test1::' to 'int'}} - int e3a = 1 ? E : B; // expected-warning {{operand of ? changes signedness: 'test1::' to 'int'}} - int e4a = 1 ? B : E; // expected-warning {{operand of ? changes signedness: 'test1::' 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 a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp index 6082c2b90a30..05b07c81a9f2 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp @@ -1041,7 +1041,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 ::A"))))); + fieldDecl(hasType(asString("struct (anonymous namespace)::A"))))); } TEST(Matcher, OverloadedOperatorCall) {