[PATCH] D20710: Lit C++11 Compatibility Patch #9
tigerleapgorge updated this revision to Diff 81776. tigerleapgorge added a comment. Lit C++11 compatibility patch #9 Update patch again to expect for latest Trunk C++11 diagnostics. Tests in CXX directory are already passing in C++11, so they are removed from this patch. Of the remaining tests, 4 tests are modified to accommodate for changes is diagnostics. SemaCXX/implicit-virtual-member-functions.cpp Additional Note message in latest Trunk (3 instances). Note: virtual destructor requires an unambiguous, accessible 'operator delete' SemaCXX/new-delete.cpp Warning no longer exist in latest Trunk Warning: function previously declared with an explicit exception specification redeclared with an implicit exception specification Previous severity change (C++98 Warning to C++11 Error) has been fixed in latest Trunk. Revert following 2 message back to Error. Error: array size is negative Error: array is too large (20 elements) Additional Note message (1 instance). Note: virtual destructor requires an unambiguous, accessible 'operator delete' SemaCXX/virtual-member-functions-key-function.cpp Additional Note message (2 instances) Note: virtual destructor requires an unambiguous, accessible 'operator delete' SemaTemplate/virtual-member-functions.cpp Additional Note message (3 instances) Note: destructor of 'Inner' is implicitly deleted because base class 'PR7114::A' has an inaccessible destructor Note: destructor of 'Inner' is implicitly deleted because base class 'PR7114::A' has an inaccessible destructor Note: destructor of 'X' is implicitly deleted because base class 'PR7114::A' has an inaccessible destructor https://reviews.llvm.org/D20710 Files: test/CodeGenCXX/debug-info-use-after-free.cpp test/CodeGenCXX/dynamic-cast-hint.cpp test/OpenMP/distribute_collapse_messages.cpp test/OpenMP/ordered_messages.cpp test/OpenMP/target_parallel_for_collapse_messages.cpp test/OpenMP/target_parallel_for_ordered_messages.cpp test/SemaCXX/i-c-e-cxx.cpp test/SemaCXX/implicit-virtual-member-functions.cpp test/SemaCXX/new-delete.cpp test/SemaCXX/no-wchar.cpp test/SemaCXX/virtual-member-functions-key-function.cpp test/SemaCXX/warn-bool-conversion.cpp test/SemaCXX/zero-length-arrays.cpp test/SemaTemplate/instantiate-c99.cpp test/SemaTemplate/temp_explicit.cpp test/SemaTemplate/value-dependent-null-pointer-constant.cpp test/SemaTemplate/virtual-member-functions.cpp Index: test/SemaTemplate/virtual-member-functions.cpp === --- test/SemaTemplate/virtual-member-functions.cpp +++ test/SemaTemplate/virtual-member-functions.cpp @@ -1,5 +1,9 @@ // RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only -verify -std=c++98 %s +// RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only -verify -std=c++11 %s // RUN: %clang_cc1 -triple %ms_abi_triple -DMSABI -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple %ms_abi_triple -DMSABI -fsyntax-only -std=c++98 -verify %s +// RUN: %clang_cc1 -triple %ms_abi_triple -DMSABI -fsyntax-only -std=c++11 -verify %s namespace PR5557 { template struct A { @@ -76,34 +80,76 @@ } namespace PR7114 { - class A { virtual ~A(); }; // expected-note{{declared private here}} + class A { virtual ~A(); }; +#if __cplusplus <= 199711L + // expected-note@-2{{declared private here}} +#else + // expected-note@-4 3 {{overridden virtual function is here}} +#endif template class B { public: -class Inner : public A { }; // expected-error{{base class 'PR7114::A' has private destructor}} +class Inner : public A { }; +#if __cplusplus <= 199711L +// expected-error@-2{{base class 'PR7114::A' has private destructor}} +#else +// expected-error@-4 2 {{deleted function '~Inner' cannot override a non-deleted function}} +// expected-note@-5 2 {{destructor of 'Inner' is implicitly deleted because base class 'PR7114::A' has an inaccessible destructor}} +#ifdef MSABI +// expected-note@-7 1 {{destructor of 'Inner' is implicitly deleted because base class 'PR7114::A' has an inaccessible destructor}} +#endif +#endif + static Inner i; static const unsigned value = sizeof(i) == 4; +#if __cplusplus >= 201103L +// expected-note@-2 {{in instantiation of member class 'PR7114::B::Inner' requested here}} +// expected-note@-3 {{in instantiation of member class 'PR7114::B::Inner' requested here}} +#endif }; int f() { return B::value; } +#if __cplusplus >= 201103L +// expected-note@-2 {{in instantiation of template class 'PR7114::B' requested here}} +#endif #ifdef MSABI - void test_typeid(B::Inner bfi) { // expected-note{{implicit destructor}} + void test_typeid(B::Inner bfi) { +#if __cplusplus <= 199711L +// expected-note@-2 {{implicit destructor}} +#else +// expected-error@-4 {{attempt to use a deleted function}} +// expected-note@-5 {{in i
[PATCH] D20710: Lit C++11 Compatibility Patch #9
tigerleapgorge updated this revision to Diff 81784. tigerleapgorge added a comment. Forgot to include all context inside the previous revision. Previous patch: svn diff This patch:svn diff --diff-cmd=diff -x -U99 https://reviews.llvm.org/D20710 Files: test/CodeGenCXX/debug-info-use-after-free.cpp test/CodeGenCXX/dynamic-cast-hint.cpp test/OpenMP/distribute_collapse_messages.cpp test/OpenMP/ordered_messages.cpp test/OpenMP/target_parallel_for_collapse_messages.cpp test/OpenMP/target_parallel_for_ordered_messages.cpp test/SemaCXX/i-c-e-cxx.cpp test/SemaCXX/implicit-virtual-member-functions.cpp test/SemaCXX/new-delete.cpp test/SemaCXX/no-wchar.cpp test/SemaCXX/virtual-member-functions-key-function.cpp test/SemaCXX/warn-bool-conversion.cpp test/SemaCXX/zero-length-arrays.cpp test/SemaTemplate/instantiate-c99.cpp test/SemaTemplate/temp_explicit.cpp test/SemaTemplate/value-dependent-null-pointer-constant.cpp test/SemaTemplate/virtual-member-functions.cpp Index: test/SemaTemplate/virtual-member-functions.cpp === --- test/SemaTemplate/virtual-member-functions.cpp +++ test/SemaTemplate/virtual-member-functions.cpp @@ -1,5 +1,9 @@ // RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only -verify -std=c++98 %s +// RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only -verify -std=c++11 %s // RUN: %clang_cc1 -triple %ms_abi_triple -DMSABI -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple %ms_abi_triple -DMSABI -fsyntax-only -std=c++98 -verify %s +// RUN: %clang_cc1 -triple %ms_abi_triple -DMSABI -fsyntax-only -std=c++11 -verify %s namespace PR5557 { template struct A { @@ -76,34 +80,76 @@ } namespace PR7114 { - class A { virtual ~A(); }; // expected-note{{declared private here}} + class A { virtual ~A(); }; +#if __cplusplus <= 199711L + // expected-note@-2{{declared private here}} +#else + // expected-note@-4 3 {{overridden virtual function is here}} +#endif template class B { public: -class Inner : public A { }; // expected-error{{base class 'PR7114::A' has private destructor}} +class Inner : public A { }; +#if __cplusplus <= 199711L +// expected-error@-2{{base class 'PR7114::A' has private destructor}} +#else +// expected-error@-4 2 {{deleted function '~Inner' cannot override a non-deleted function}} +// expected-note@-5 2 {{destructor of 'Inner' is implicitly deleted because base class 'PR7114::A' has an inaccessible destructor}} +#ifdef MSABI +// expected-note@-7 1 {{destructor of 'Inner' is implicitly deleted because base class 'PR7114::A' has an inaccessible destructor}} +#endif +#endif + static Inner i; static const unsigned value = sizeof(i) == 4; +#if __cplusplus >= 201103L +// expected-note@-2 {{in instantiation of member class 'PR7114::B::Inner' requested here}} +// expected-note@-3 {{in instantiation of member class 'PR7114::B::Inner' requested here}} +#endif }; int f() { return B::value; } +#if __cplusplus >= 201103L +// expected-note@-2 {{in instantiation of template class 'PR7114::B' requested here}} +#endif #ifdef MSABI - void test_typeid(B::Inner bfi) { // expected-note{{implicit destructor}} + void test_typeid(B::Inner bfi) { +#if __cplusplus <= 199711L +// expected-note@-2 {{implicit destructor}} +#else +// expected-error@-4 {{attempt to use a deleted function}} +// expected-note@-5 {{in instantiation of template class 'PR7114::B' requested here}} +#endif + (void)typeid(bfi); #else void test_typeid(B::Inner bfi) { -(void)typeid(bfi); // expected-note{{implicit destructor}} +#if __cplusplus >= 201103L +// expected-note@-2 {{in instantiation of template class 'PR7114::B' requested here}} +#endif +(void)typeid(bfi); +#if __cplusplus <= 199711L +// expected-note@-2 {{implicit destructor}} +#endif #endif } template struct X : A { +#if __cplusplus >= 201103L +// expected-error@-2 {{deleted function '~X' cannot override a non-deleted function}} +// expected-note@-3 {{destructor of 'X' is implicitly deleted because base class 'PR7114::A' has an inaccessible destructor}} +#endif void f() { } }; void test_X(X &xi, X &xf) { xi.f(); +#if __cplusplus >= 201103L +// expected-note@-2 {{in instantiation of template class 'PR7114::X' requested here}} +#endif } } Index: test/SemaTemplate/value-dependent-null-pointer-constant.cpp === --- test/SemaTemplate/value-dependent-null-pointer-constant.cpp +++ test/SemaTemplate/value-dependent-null-pointer-constant.cpp @@ -1,17 +1,30 @@ -// RUN: %clang_cc1 -fsyntax-only %s +// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s template struct X0 { const char *f0(bool Cond) { return Cond? "honk" : N;
[PATCH] D21626: Lit C++11 Compatibility Patch #10
tigerleapgorge updated this revision to Diff 81810. tigerleapgorge added a comment. Update patch to match latest Clang C++11 diagnostics. 2 tests are changed. test/SemaCXX/PR9572.cpp Expect the following additional Note following existing Error. destructor of 'Foo' is implicitly deleted because base class 'Base' has an inaccessible destructor test/SemaCXX/virtual-base-used.cpp Expect the following additional Notes following existing Errors. destructor of 'B' is implicitly deleted because field 'x' has an inaccessible destructor destructor of 'E' is implicitly deleted because field 'x' has an inaccessible destructor destructor of 'H' is implicitly deleted because field 'x' has an inaccessible destructor https://reviews.llvm.org/D21626 Files: test/Modules/Inputs/merge-using-decls/a.h test/Modules/Inputs/merge-using-decls/b.h test/Modules/merge-using-decls.cpp test/OpenMP/declare_reduction_messages.cpp test/OpenMP/openmp_check.cpp test/SemaCXX/MicrosoftExtensions.cpp test/SemaCXX/PR9572.cpp test/SemaCXX/default-assignment-operator.cpp test/SemaCXX/default-constructor-initializers.cpp test/SemaCXX/format-strings.cpp test/SemaCXX/printf-cstr.cpp test/SemaCXX/virtual-base-used.cpp test/SemaCXX/warn-thread-safety-parsing.cpp Index: test/SemaCXX/warn-thread-safety-parsing.cpp === --- test/SemaCXX/warn-thread-safety-parsing.cpp +++ test/SemaCXX/warn-thread-safety-parsing.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -std=c++11 %s #define LOCKABLE__attribute__ ((lockable)) #define SCOPED_LOCKABLE __attribute__ ((scoped_lockable)) @@ -1266,8 +1268,10 @@ void foo3(FooLate *f) EXCLUSIVE_LOCKS_REQUIRED(f->mu) { } void foo4(FooLate *f) EXCLUSIVE_LOCKS_REQUIRED(f->mu); - static void foo5()EXCLUSIVE_LOCKS_REQUIRED(mu); // \ -// expected-error {{invalid use of member 'mu' in static member function}} + static void foo5()EXCLUSIVE_LOCKS_REQUIRED(mu); +#if __cplusplus <= 199711L + // expected-error@-2 {{invalid use of member 'mu' in static member function}} +#endif template void foo6() EXCLUSIVE_LOCKS_REQUIRED(T::statmu) { } @@ -1461,15 +1465,21 @@ mutable Mutex mu; int a GUARDED_BY(mu); - static int si GUARDED_BY(mu); // \ -// expected-error {{invalid use of non-static data member 'mu'}} + static int si GUARDED_BY(mu); +#if __cplusplus <= 199711L + // expected-error@-2 {{invalid use of non-static data member 'mu'}} +#endif - static void foo() EXCLUSIVE_LOCKS_REQUIRED(mu); // \ -// expected-error {{invalid use of member 'mu' in static member function}} + static void foo() EXCLUSIVE_LOCKS_REQUIRED(mu); +#if __cplusplus <= 199711L + // expected-error@-2 {{invalid use of member 'mu' in static member function}} +#endif friend FooStream& operator<<(FooStream& s, const Foo& f) -EXCLUSIVE_LOCKS_REQUIRED(mu); // \ -// expected-error {{invalid use of non-static data member 'mu'}} +EXCLUSIVE_LOCKS_REQUIRED(mu); +#if __cplusplus <= 199711L +// expected-error@-2 {{invalid use of non-static data member 'mu'}} +#endif }; Index: test/SemaCXX/virtual-base-used.cpp === --- test/SemaCXX/virtual-base-used.cpp +++ test/SemaCXX/virtual-base-used.cpp @@ -1,89 +1,215 @@ -// RUN: %clang_cc1 -fsyntax-only -triple %itanium_abi_triple -verify %s -// RUN: %clang_cc1 -fsyntax-only -triple %ms_abi_triple -DMSABI -verify %s +// UN: %clang_cc1 -fsyntax-only -triple %itanium_abi_triple -verify %s +// UN: %clang_cc1 -fsyntax-only -triple %itanium_abi_triple -verify -std=c++98 %s +// UN: %clang_cc1 -fsyntax-only -triple %itanium_abi_triple -verify -std=c++11 %s +// UN: %clang_cc1 -fsyntax-only -triple %ms_abi_triple -DMSABI -verify %s +// UN: %clang_cc1 -fsyntax-only -triple %ms_abi_triple -DMSABI -verify -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -triple %ms_abi_triple -DMSABI -verify -std=c++11 %s // PR7800 // The Microsoft ABI doesn't have the concept of key functions, so we have different // expectations about when functions are first required for that case. +class NoDestroy { ~NoDestroy(); }; +#if __cplusplus <= 199711L +// expected-note@-2 3 {{declared private here}} #ifdef MSABI -// expected-note@+2 3 {{declared private here}} +// expected-note@-4 3 {{declared private here}} #endif -class NoDestroy { ~NoDestroy(); }; // expected-note 3 {{declared private here}} +#endif + struct A { virtual ~A(); +#if __cplusplus >= 201103L + // expected-note@-2 3 {{overridden virtual function is here}} +#endif }; +struct B : public virtual A { +#if __cplusplus >= 201103L +// expected-error@-2 {{deleted function '~B' cannot override a non-deleted function}} +// expected-note@-3 {{overridden virtual funct
[PATCH] D21626: Lit C++11 Compatibility Patch #10
tigerleapgorge updated this revision to Diff 81817. tigerleapgorge added a comment. Previous update contain typos in the RUN lines of test/SemaCXX/virtual-base-used.cpp This has been corrected in this latest revision. https://reviews.llvm.org/D21626 Files: test/Modules/Inputs/merge-using-decls/a.h test/Modules/Inputs/merge-using-decls/b.h test/Modules/merge-using-decls.cpp test/OpenMP/declare_reduction_messages.cpp test/OpenMP/openmp_check.cpp test/SemaCXX/MicrosoftExtensions.cpp test/SemaCXX/PR9572.cpp test/SemaCXX/default-assignment-operator.cpp test/SemaCXX/default-constructor-initializers.cpp test/SemaCXX/format-strings.cpp test/SemaCXX/printf-cstr.cpp test/SemaCXX/virtual-base-used.cpp test/SemaCXX/warn-thread-safety-parsing.cpp Index: test/SemaCXX/warn-thread-safety-parsing.cpp === --- test/SemaCXX/warn-thread-safety-parsing.cpp +++ test/SemaCXX/warn-thread-safety-parsing.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -std=c++11 %s #define LOCKABLE__attribute__ ((lockable)) #define SCOPED_LOCKABLE __attribute__ ((scoped_lockable)) @@ -1266,8 +1268,10 @@ void foo3(FooLate *f) EXCLUSIVE_LOCKS_REQUIRED(f->mu) { } void foo4(FooLate *f) EXCLUSIVE_LOCKS_REQUIRED(f->mu); - static void foo5()EXCLUSIVE_LOCKS_REQUIRED(mu); // \ -// expected-error {{invalid use of member 'mu' in static member function}} + static void foo5()EXCLUSIVE_LOCKS_REQUIRED(mu); +#if __cplusplus <= 199711L + // expected-error@-2 {{invalid use of member 'mu' in static member function}} +#endif template void foo6() EXCLUSIVE_LOCKS_REQUIRED(T::statmu) { } @@ -1461,15 +1465,21 @@ mutable Mutex mu; int a GUARDED_BY(mu); - static int si GUARDED_BY(mu); // \ -// expected-error {{invalid use of non-static data member 'mu'}} + static int si GUARDED_BY(mu); +#if __cplusplus <= 199711L + // expected-error@-2 {{invalid use of non-static data member 'mu'}} +#endif - static void foo() EXCLUSIVE_LOCKS_REQUIRED(mu); // \ -// expected-error {{invalid use of member 'mu' in static member function}} + static void foo() EXCLUSIVE_LOCKS_REQUIRED(mu); +#if __cplusplus <= 199711L + // expected-error@-2 {{invalid use of member 'mu' in static member function}} +#endif friend FooStream& operator<<(FooStream& s, const Foo& f) -EXCLUSIVE_LOCKS_REQUIRED(mu); // \ -// expected-error {{invalid use of non-static data member 'mu'}} +EXCLUSIVE_LOCKS_REQUIRED(mu); +#if __cplusplus <= 199711L +// expected-error@-2 {{invalid use of non-static data member 'mu'}} +#endif }; Index: test/SemaCXX/virtual-base-used.cpp === --- test/SemaCXX/virtual-base-used.cpp +++ test/SemaCXX/virtual-base-used.cpp @@ -1,89 +1,215 @@ // RUN: %clang_cc1 -fsyntax-only -triple %itanium_abi_triple -verify %s +// RUN: %clang_cc1 -fsyntax-only -triple %itanium_abi_triple -verify -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -triple %itanium_abi_triple -verify -std=c++11 %s // RUN: %clang_cc1 -fsyntax-only -triple %ms_abi_triple -DMSABI -verify %s +// RUN: %clang_cc1 -fsyntax-only -triple %ms_abi_triple -DMSABI -verify -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -triple %ms_abi_triple -DMSABI -verify -std=c++11 %s // PR7800 // The Microsoft ABI doesn't have the concept of key functions, so we have different // expectations about when functions are first required for that case. +class NoDestroy { ~NoDestroy(); }; +#if __cplusplus <= 199711L +// expected-note@-2 3 {{declared private here}} #ifdef MSABI -// expected-note@+2 3 {{declared private here}} +// expected-note@-4 3 {{declared private here}} #endif -class NoDestroy { ~NoDestroy(); }; // expected-note 3 {{declared private here}} +#endif + struct A { virtual ~A(); +#if __cplusplus >= 201103L + // expected-note@-2 3 {{overridden virtual function is here}} +#endif }; +struct B : public virtual A { +#if __cplusplus >= 201103L +// expected-error@-2 {{deleted function '~B' cannot override a non-deleted function}} +// expected-note@-3 {{overridden virtual function is here}} +#endif + + NoDestroy x; +#if __cplusplus <= 199711L + // expected-error@-2 {{field of type 'NoDestroy' has private destructor}} #ifdef MSABI -// expected-error@+3 {{field of type 'NoDestroy' has private destructor}} + // expected-error@-4 {{field of type 'NoDestroy' has private destructor}} #endif -struct B : public virtual A { - NoDestroy x; // expected-error {{field of type 'NoDestroy' has private destructor}} -}; +#else + // expected-note@-7 {{destructor of 'B' is implicitly deleted because field 'x' has an inaccessible destructor}} #ifdef MSABI -// expected-note@+3 {{implicit default constructor for 'B' first required here}} -// ex
[PATCH] D24812: Lit C++11 Compatibility Patch #11
tigerleapgorge updated the summary for this revision. tigerleapgorge updated this revision to Diff 81987. tigerleapgorge added a comment. Update Lit patch #11 to match latest Clang behavior 2 minor changes in this update 1. Back out test/CodeGenCXX/mangle-unnamed.cpp because it has already been fixed. 2. Modified test/CodeGenCXX/static-init.cpp to match latest IR. Also, this patch contained full context diff while the previous one does not. Previous revision: svn diff This revision svn diff --diff-cmd=diff -x -U99 Also reorder summery for the tests to be in the order of the patch. https://reviews.llvm.org/D24812 Files: test/CodeGenCXX/arm.cpp test/CodeGenCXX/debug-info-class.cpp test/CodeGenCXX/eh-aggregate-copy-destroy.cpp test/CodeGenCXX/exceptions.cpp test/CodeGenCXX/goto.cpp test/CodeGenCXX/linetable-cleanup.cpp test/CodeGenCXX/lpad-linetable.cpp test/CodeGenCXX/mangle-unnamed.cpp test/CodeGenCXX/static-init.cpp test/CodeGenCXX/value-init.cpp test/CodeGenCXX/volatile-1.cpp test/CodeGenCXX/volatile.cpp test/Index/comment-cplus-decls.cpp test/OpenMP/atomic_codegen.cpp test/OpenMP/threadprivate_codegen.cpp test/PCH/macro-undef.cpp Index: test/PCH/macro-undef.cpp === --- test/PCH/macro-undef.cpp +++ test/PCH/macro-undef.cpp @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -emit-pch -o %t %s -// RUN: %clang_cc1 -fsyntax-only -include-pch %t %s -Wuninitialized -verify -// RUN: %clang_cc1 -fsyntax-only -include-pch %t %s -Wuninitialized -fdiagnostics-parseable-fixits 2>&1 | FileCheck %s +// RUN: %clang_cc1 -std=c++98 -emit-pch -o %t %s +// RUN: %clang_cc1 -std=c++98 -fsyntax-only -include-pch %t %s -Wuninitialized -verify +// RUN: %clang_cc1 -std=c++98 -fsyntax-only -include-pch %t %s -Wuninitialized -fdiagnostics-parseable-fixits 2>&1 | FileCheck %s #ifndef HEADER #define HEADER Index: test/OpenMP/threadprivate_codegen.cpp === --- test/OpenMP/threadprivate_codegen.cpp +++ test/OpenMP/threadprivate_codegen.cpp @@ -275,7 +275,7 @@ // CHECK: {{.*}}[[ARR_LOOP]]{{.*}} // CHECK-NEXT: [[ARR_ELEMENTPAST:%.*]] = phi [[S1]]* [ [[ARR_CUR]], {{.*}} ], [ [[ARR_ELEMENT:%.*]], {{.*}} ] // CHECK-NEXT: [[ARR_ELEMENT:%.*]] = getelementptr inbounds [[S1]], [[S1]]* [[ARR_ELEMENTPAST]], i{{.*}} -1 -// CHECK-NEXT: invoke {{.*}} [[S1_DTOR]]([[S1]]* [[ARR_ELEMENT]]) +// CHECK-NEXT: {{call|invoke}} {{.*}} [[S1_DTOR]]([[S1]]* [[ARR_ELEMENT]]) // CHECK: [[ARR_DONE:%.*]] = icmp eq [[S1]]* [[ARR_ELEMENT]], [[ARR_BEGIN]] // CHECK-NEXT: br i1 [[ARR_DONE]], label %[[ARR_EXIT:.*]], label %[[ARR_LOOP]] // CHECK: {{.*}}[[ARR_EXIT]]{{.*}} Index: test/OpenMP/atomic_codegen.cpp === --- test/OpenMP/atomic_codegen.cpp +++ test/OpenMP/atomic_codegen.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -x c++ -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -x c++ -emit-llvm -std=c++98 %s -o - | FileCheck %s +// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -x c++ -emit-llvm -std=c++11 %s -o - | FileCheck %s // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -debug-info-kind=line-tables-only -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG // expected-no-diagnostics @@ -21,14 +23,15 @@ // CHECK: [[SCALAR_ADDR:%.+]] = invoke dereferenceable(4) i32* @_ZN2St3getEv(%struct.St* [[TEMP_ST_ADDR]]) // CHECK: [[SCALAR_VAL:%.+]] = load atomic i32, i32* [[SCALAR_ADDR]] monotonic // CHECK: store i32 [[SCALAR_VAL]], i32* @b - // CHECK: invoke void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]]) + // CHECK98: invoke void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]]) + // CHECK11: call void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]]) #pragma omp atomic read b = St().get(); // CHECK-DAG: invoke void @_ZN2StC1Ev(%struct.St* [[TEMP_ST_ADDR:%.+]]) // CHECK-DAG: [[SCALAR_ADDR:%.+]] = invoke dereferenceable(4) i32* @_ZN2St3getEv(%struct.St* [[TEMP_ST_ADDR]]) // CHECK-DAG: [[B_VAL:%.+]] = load i32, i32* @b // CHECK: store atomic i32 [[B_VAL]], i32* [[SCALAR_ADDR]] monotonic - // CHECK: invoke void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]]) + // CHECK: {{invoke|call}} void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]]) #pragma omp atomic write St().get() = b; // CHECK: invoke void @_ZN2StC1Ev(%struct.St* [[TEMP_ST_ADDR:%.+]]) @@ -46,7 +49,7 @@ // CHECK: [[COND:%.+]] = extractvalue { i32, i1 } [[RES]], 1 // CHECK: br i1 [[COND]], label %[[OMP_DONE:.+]], label %[[OMP_UPDATE]] // CHECK: [[OMP_DONE]] - // CHECK: invoke void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]]) +
[PATCH] D28425: Lit C++11 Compatibility Patch - nonthrowing destructors
tigerleapgorge created this revision. tigerleapgorge added reviewers: rjmccall, rsmith. tigerleapgorge added a subscriber: cfe-commits. Hi everyone, I am Charles Li at Sony Playstation. I am refactoring my existing C++11 compatibility patches to make them easier to review. This patch is a subset of the previous #11 patch (https://reviews.llvm.org/D24812) This patch contains 7 tests. The changes to each test are nearly identical: LLVM IR invocation for the destructors has changed from “invoke” to “call”. My colleague Paul Robinson has submitted a similar patch (https://reviews.llvm.org/D27936). To quote his explanation: "If a dtor has no interesting members, then it ends up being nothrow, which affects the generated IR. Modify some tests to tolerate this difference between C++03 and C++11. In C++11, a destructor without an explicit exception-spec gets an implicit exception-spec. If the dtor has a body, the implicit exception-spec permits throwing exactly the set of types thrown by anything the dtor calls. If the dtor doesn't have a body, use what would be the default dtor's body to determine the implicit exception-spec. If there are no calls, the implicit exception-spec is nothrow." https://reviews.llvm.org/D28425 Files: test/CodeGenCXX/arm.cpp test/CodeGenCXX/debug-info-class.cpp test/CodeGenCXX/eh-aggregate-copy-destroy.cpp test/CodeGenCXX/exceptions.cpp test/CodeGenCXX/goto.cpp test/OpenMP/atomic_codegen.cpp test/OpenMP/threadprivate_codegen.cpp Index: test/OpenMP/threadprivate_codegen.cpp === --- test/OpenMP/threadprivate_codegen.cpp +++ test/OpenMP/threadprivate_codegen.cpp @@ -275,7 +275,7 @@ // CHECK: {{.*}}[[ARR_LOOP]]{{.*}} // CHECK-NEXT: [[ARR_ELEMENTPAST:%.*]] = phi [[S1]]* [ [[ARR_CUR]], {{.*}} ], [ [[ARR_ELEMENT:%.*]], {{.*}} ] // CHECK-NEXT: [[ARR_ELEMENT:%.*]] = getelementptr inbounds [[S1]], [[S1]]* [[ARR_ELEMENTPAST]], i{{.*}} -1 -// CHECK-NEXT: invoke {{.*}} [[S1_DTOR]]([[S1]]* [[ARR_ELEMENT]]) +// CHECK-NEXT: {{call|invoke}} {{.*}} [[S1_DTOR]]([[S1]]* [[ARR_ELEMENT]]) // CHECK: [[ARR_DONE:%.*]] = icmp eq [[S1]]* [[ARR_ELEMENT]], [[ARR_BEGIN]] // CHECK-NEXT: br i1 [[ARR_DONE]], label %[[ARR_EXIT:.*]], label %[[ARR_LOOP]] // CHECK: {{.*}}[[ARR_EXIT]]{{.*}} Index: test/OpenMP/atomic_codegen.cpp === --- test/OpenMP/atomic_codegen.cpp +++ test/OpenMP/atomic_codegen.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -x c++ -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -x c++ -emit-llvm -std=c++98 %s -o - | FileCheck %s +// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -x c++ -emit-llvm -std=c++11 %s -o - | FileCheck %s // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -debug-info-kind=line-tables-only -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG // expected-no-diagnostics @@ -21,14 +23,15 @@ // CHECK: [[SCALAR_ADDR:%.+]] = invoke dereferenceable(4) i32* @_ZN2St3getEv(%struct.St* [[TEMP_ST_ADDR]]) // CHECK: [[SCALAR_VAL:%.+]] = load atomic i32, i32* [[SCALAR_ADDR]] monotonic // CHECK: store i32 [[SCALAR_VAL]], i32* @b - // CHECK: invoke void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]]) + // CHECK98: invoke void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]]) + // CHECK11: call void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]]) #pragma omp atomic read b = St().get(); // CHECK-DAG: invoke void @_ZN2StC1Ev(%struct.St* [[TEMP_ST_ADDR:%.+]]) // CHECK-DAG: [[SCALAR_ADDR:%.+]] = invoke dereferenceable(4) i32* @_ZN2St3getEv(%struct.St* [[TEMP_ST_ADDR]]) // CHECK-DAG: [[B_VAL:%.+]] = load i32, i32* @b // CHECK: store atomic i32 [[B_VAL]], i32* [[SCALAR_ADDR]] monotonic - // CHECK: invoke void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]]) + // CHECK: {{invoke|call}} void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]]) #pragma omp atomic write St().get() = b; // CHECK: invoke void @_ZN2StC1Ev(%struct.St* [[TEMP_ST_ADDR:%.+]]) @@ -46,7 +49,7 @@ // CHECK: [[COND:%.+]] = extractvalue { i32, i1 } [[RES]], 1 // CHECK: br i1 [[COND]], label %[[OMP_DONE:.+]], label %[[OMP_UPDATE]] // CHECK: [[OMP_DONE]] - // CHECK: invoke void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]]) + // CHECK: {{invoke|call}} void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]]) #pragma omp atomic St().get() %= b; #pragma omp atomic @@ -67,7 +70,7 @@ // CHECK: br i1 [[COND]], label %[[OMP_DONE:.+]], label %[[OMP_UPDATE]] // CHECK: [[OMP_DONE]] // CHECK: store i32 [[NEW_CALC_VAL]], i32* @a, - // CHECK: invoke void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]]) +
[PATCH] D24812: Lit C++11 Compatibility Patch #11
tigerleapgorge updated this revision to Diff 86923. tigerleapgorge added a comment. Revise again, https://reviews.llvm.org/D28425 fixed 7 tests. r290229 fixed 1 test. Down to 8 tests. https://reviews.llvm.org/D24812 Files: test/CodeGenCXX/linetable-cleanup.cpp test/CodeGenCXX/lpad-linetable.cpp test/CodeGenCXX/mangle-unnamed.cpp test/CodeGenCXX/static-init.cpp test/CodeGenCXX/volatile-1.cpp test/CodeGenCXX/volatile.cpp test/Index/comment-cplus-decls.cpp test/PCH/macro-undef.cpp Index: test/PCH/macro-undef.cpp === --- test/PCH/macro-undef.cpp +++ test/PCH/macro-undef.cpp @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -emit-pch -o %t %s -// RUN: %clang_cc1 -fsyntax-only -include-pch %t %s -Wuninitialized -verify -// RUN: %clang_cc1 -fsyntax-only -include-pch %t %s -Wuninitialized -fdiagnostics-parseable-fixits 2>&1 | FileCheck %s +// RUN: %clang_cc1 -std=c++98 -emit-pch -o %t %s +// RUN: %clang_cc1 -std=c++98 -fsyntax-only -include-pch %t %s -Wuninitialized -verify +// RUN: %clang_cc1 -std=c++98 -fsyntax-only -include-pch %t %s -Wuninitialized -fdiagnostics-parseable-fixits 2>&1 | FileCheck %s #ifndef HEADER #define HEADER Index: test/Index/comment-cplus-decls.cpp === --- test/Index/comment-cplus-decls.cpp +++ test/Index/comment-cplus-decls.cpp @@ -2,9 +2,15 @@ // RUN: mkdir %t // RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng -target x86_64-apple-darwin10 %s > %t/out // RUN: FileCheck %s < %t/out +// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng -target x86_64-apple-darwin10 -std=c++98 %s > %t/98 +// RUN: FileCheck %s < %t/98 +// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng -target x86_64-apple-darwin10 -std=c++11 %s > %t/11 +// RUN: FileCheck %s < %t/11 // Ensure that XML we generate is not invalid. // RUN: FileCheck %s -check-prefix=WRONG < %t/out +// RUN: FileCheck %s -check-prefix=WRONG < %t/98 +// RUN: FileCheck %s -check-prefix=WRONG < %t/11 // WRONG-NOT: CommentXMLInvalid // rdar://12378714 @@ -42,7 +48,7 @@ // CHECK: class Test {} // CHECK: Test() : reserved(new Test::data()) {} // CHECK: unsigned int getID() const -// CHECK: ~Test() +// CHECK: ~Test(){{( noexcept)?}} // CHECK: Test::data *reserved Index: test/CodeGenCXX/volatile.cpp === --- test/CodeGenCXX/volatile.cpp +++ test/CodeGenCXX/volatile.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -std=c++98 -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -std=c++11 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK11 %s // Check that IR gen doesn't try to do an lvalue-to-rvalue conversion // on a volatile reference result. rdar://problem/8338198 @@ -27,6 +28,7 @@ // CHECK-LABEL: define void @_ZN5test14testEv() void test() { // CHECK: [[TMP:%.*]] = load i32*, i32** @_ZN5test11xE, align 8 +// CHECK11:{{%.*}} = load volatile i32, i32* [[TMP]], align 4 // CHECK-NEXT: ret void *x; } Index: test/CodeGenCXX/volatile-1.cpp === --- test/CodeGenCXX/volatile-1.cpp +++ test/CodeGenCXX/volatile-1.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -Wno-unused-value -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -Wno-unused-value -triple %itanium_abi_triple -emit-llvm %s -std=c++98 -o - | FileCheck %s +// RUN: %clang_cc1 -Wno-unused-value -triple %itanium_abi_triple -emit-llvm %s -std=c++11 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK11 %s // CHECK: @i = global [[INT:i[0-9]+]] 0 volatile int i, j, k; @@ -22,18 +23,22 @@ asm("nop"); // CHECK: call void asm - // should not load + // should not load in C++98 i; + // CHECK11-NEXT: load volatile [[INT]], [[INT]]* @i (float)(ci); // CHECK-NEXT: load volatile [[INT]], [[INT]]* getelementptr inbounds ([[CINT]], [[CINT]]* @ci, i32 0, i32 0) // CHECK-NEXT: load volatile [[INT]], [[INT]]* getelementptr inbounds ([[CINT]], [[CINT]]* @ci, i32 0, i32 1) // CHECK-NEXT: sitofp [[INT]] - // These are not uses in C++: + // These are not uses in C++98: // [expr.static.cast]p6: // The lvalue-to-rvalue . . . conversions are not applied to the expression. (void)ci; + // CHECK11-NEXT: load volatile [[INT]], [[INT]]* getelementptr inbounds ([[CINT]], [[CINT]]* @ci, i32 0, i32 0) + // CHECK11-NEXT: load volatile [[INT]], [[INT]]* getelementptr inbounds ([[CINT]], [[CINT]]* @ci, i32 0, i32 1) + (void)a; (void)(ci=ci); @@ -126,7 +131,8 @@ // CHECK-NEXT: load volatile // CHECK-NEX
[PATCH] D29480: C++11 Compatibility - OpenMP constant expressions
tigerleapgorge created this revision. I am continuing to make Lit tests C++11 compatible. This patch is a subset of the previous https://reviews.llvm.org/D20710 This patch contains 4 tests, the changes are nearly identical. C++11 introduced constexpr, hence the change in diagnostics. C++11 added 2 new Notes following the existing Warning. Existing: error: expression is not an integral constant expression C++11: note: non-constexpr function 'foobool' cannot be used in a constant expression C++11: note: declared here Change in Error message. C++98: expression is not an integral constant expression C++11: integral constant expression must have integral or unscoped enumeration type, not 'char *' https://reviews.llvm.org/D29480 Files: test/OpenMP/distribute_collapse_messages.cpp test/OpenMP/ordered_messages.cpp test/OpenMP/target_parallel_for_collapse_messages.cpp test/OpenMP/target_parallel_for_ordered_messages.cpp Index: test/OpenMP/target_parallel_for_ordered_messages.cpp === --- test/OpenMP/target_parallel_for_ordered_messages.cpp +++ test/OpenMP/target_parallel_for_ordered_messages.cpp @@ -1,9 +1,14 @@ // RUN: %clang_cc1 -verify -fopenmp %s +// RUN: %clang_cc1 -verify -fopenmp -std=c++98 %s +// RUN: %clang_cc1 -verify -fopenmp -std=c++11 %s void foo() { } bool foobool(int argc) { +#if __cplusplus >= 201103L +// expected-note@-2 4 {{declared here}} +#endif return argc; } @@ -36,6 +41,9 @@ #pragma omp target parallel for ordered((ST > 0) ? 1 + ST : 2) // expected-note 2 {{as specified in 'ordered' clause}} for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i - ST]; // expected-error 2 {{expected 2 for loops after '#pragma omp target parallel for', but found only 1}} +#if __cplusplus >= 201103L +// expected-note@+5 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} +#endif // expected-error@+3 2 {{directive '#pragma omp target parallel for' cannot contain more than one 'ordered' clause}} // expected-error@+2 2 {{argument to 'ordered' clause must be a strictly positive integer value}} // expected-error@+1 2 {{expression is not an integral constant expression}} @@ -45,7 +53,11 @@ #pragma omp target parallel for ordered(S) // expected-error {{'S' does not refer to a value}} for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i - ST]; -// expected-error@+1 2 {{expression is not an integral constant expression}} +#if __cplusplus >= 201103L + // expected-error@+4 2 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}} +#else + // expected-error@+2 2 {{expression is not an integral constant expression}} +#endif #pragma omp target parallel for ordered(argv[1] = 2) // expected-error {{expected ')'}} expected-note {{to match this '('}} for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i - ST]; @@ -76,9 +88,15 @@ #pragma omp target parallel for ordered(2 + 2)) // expected-warning {{extra tokens at the end of '#pragma omp target parallel for' are ignored}} expected-note {{as specified in 'ordered' clause}} for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i - 4];// expected-error {{expected 4 for loops after '#pragma omp target parallel for', but found only 1}} +#if __cplusplus >= 201103L +// expected-note@+2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} +#endif #pragma omp target parallel for ordered(foobool(1) > 0 ? 1 : 2) // expected-error {{expression is not an integral constant expression}} for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i - 4]; +#if __cplusplus >= 201103L +// expected-note@+5 {{non-constexpr function 'foobool' cannot be used in a constant expression}} +#endif // expected-error@+3 {{expression is not an integral constant expression}} // expected-error@+2 2 {{directive '#pragma omp target parallel for' cannot contain more than one 'ordered' clause}} // expected-error@+1 2 {{argument to 'ordered' clause must be a strictly positive integer value}} @@ -88,7 +106,11 @@ #pragma omp target parallel for ordered(S1) // expected-error {{'S1' does not refer to a value}} for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i - 4]; -// expected-error@+1 {{expression is not an integral constant expression}} +#if __cplusplus >= 201103L + // expected-error@+4 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}} +#else + // expected-error@+2 {{expression is not an integral constant expression}} +#endif #pragma omp target parallel for ordered(argv[1] = 2) // expected-error {{expected ')'}} expected-note {{to match this '('}} for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i - 4]; Index: test/OpenMP/target_parallel_for_collapse_messages.cpp =
[PATCH] D20710: Lit C++11 Compatibility Patch #9
tigerleapgorge updated this revision to Diff 86994. tigerleapgorge added a comment. Update again, remove 4 OpenMP tests here because they have been checked in https://reviews.llvm.org/rL294025 under review https://reviews.llvm.org/D29480. 13 tests left. https://reviews.llvm.org/D20710 Files: test/CodeGenCXX/debug-info-use-after-free.cpp test/CodeGenCXX/dynamic-cast-hint.cpp test/SemaCXX/i-c-e-cxx.cpp test/SemaCXX/implicit-virtual-member-functions.cpp test/SemaCXX/new-delete.cpp test/SemaCXX/no-wchar.cpp test/SemaCXX/virtual-member-functions-key-function.cpp test/SemaCXX/warn-bool-conversion.cpp test/SemaCXX/zero-length-arrays.cpp test/SemaTemplate/instantiate-c99.cpp test/SemaTemplate/temp_explicit.cpp test/SemaTemplate/value-dependent-null-pointer-constant.cpp test/SemaTemplate/virtual-member-functions.cpp Index: test/SemaTemplate/virtual-member-functions.cpp === --- test/SemaTemplate/virtual-member-functions.cpp +++ test/SemaTemplate/virtual-member-functions.cpp @@ -1,5 +1,9 @@ // RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only -verify -std=c++98 %s +// RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only -verify -std=c++11 %s // RUN: %clang_cc1 -triple %ms_abi_triple -DMSABI -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple %ms_abi_triple -DMSABI -fsyntax-only -std=c++98 -verify %s +// RUN: %clang_cc1 -triple %ms_abi_triple -DMSABI -fsyntax-only -std=c++11 -verify %s namespace PR5557 { template struct A { @@ -76,34 +80,76 @@ } namespace PR7114 { - class A { virtual ~A(); }; // expected-note{{declared private here}} + class A { virtual ~A(); }; +#if __cplusplus <= 199711L + // expected-note@-2{{declared private here}} +#else + // expected-note@-4 3 {{overridden virtual function is here}} +#endif template class B { public: -class Inner : public A { }; // expected-error{{base class 'PR7114::A' has private destructor}} +class Inner : public A { }; +#if __cplusplus <= 199711L +// expected-error@-2{{base class 'PR7114::A' has private destructor}} +#else +// expected-error@-4 2 {{deleted function '~Inner' cannot override a non-deleted function}} +// expected-note@-5 2 {{destructor of 'Inner' is implicitly deleted because base class 'PR7114::A' has an inaccessible destructor}} +#ifdef MSABI +// expected-note@-7 1 {{destructor of 'Inner' is implicitly deleted because base class 'PR7114::A' has an inaccessible destructor}} +#endif +#endif + static Inner i; static const unsigned value = sizeof(i) == 4; +#if __cplusplus >= 201103L +// expected-note@-2 {{in instantiation of member class 'PR7114::B::Inner' requested here}} +// expected-note@-3 {{in instantiation of member class 'PR7114::B::Inner' requested here}} +#endif }; int f() { return B::value; } +#if __cplusplus >= 201103L +// expected-note@-2 {{in instantiation of template class 'PR7114::B' requested here}} +#endif #ifdef MSABI - void test_typeid(B::Inner bfi) { // expected-note{{implicit destructor}} + void test_typeid(B::Inner bfi) { +#if __cplusplus <= 199711L +// expected-note@-2 {{implicit destructor}} +#else +// expected-error@-4 {{attempt to use a deleted function}} +// expected-note@-5 {{in instantiation of template class 'PR7114::B' requested here}} +#endif + (void)typeid(bfi); #else void test_typeid(B::Inner bfi) { -(void)typeid(bfi); // expected-note{{implicit destructor}} +#if __cplusplus >= 201103L +// expected-note@-2 {{in instantiation of template class 'PR7114::B' requested here}} +#endif +(void)typeid(bfi); +#if __cplusplus <= 199711L +// expected-note@-2 {{implicit destructor}} +#endif #endif } template struct X : A { +#if __cplusplus >= 201103L +// expected-error@-2 {{deleted function '~X' cannot override a non-deleted function}} +// expected-note@-3 {{destructor of 'X' is implicitly deleted because base class 'PR7114::A' has an inaccessible destructor}} +#endif void f() { } }; void test_X(X &xi, X &xf) { xi.f(); +#if __cplusplus >= 201103L +// expected-note@-2 {{in instantiation of template class 'PR7114::X' requested here}} +#endif } } Index: test/SemaTemplate/value-dependent-null-pointer-constant.cpp === --- test/SemaTemplate/value-dependent-null-pointer-constant.cpp +++ test/SemaTemplate/value-dependent-null-pointer-constant.cpp @@ -1,17 +1,30 @@ -// RUN: %clang_cc1 -fsyntax-only %s +// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s template struct X0 { const char *f0(bool Cond) { return Cond? "honk" : N; +#if __cplusplus >= 201103L +// expected-error@-2 {{incompatible operand types ('const char *' and 'int')}} +#else +// expected-no-diagnostics +#endif } co
[PATCH] D29520: Lit C++11 Compatibility - Microsoft diagnostics
tigerleapgorge created this revision. I am continuing to make Lit tests C++11 compatible. This patch contains 4 tests, previously in review https://reviews.llvm.org/D20710 and https://reviews.llvm.org/D21626. test/SemaCXX/MicrosoftExtensions.cpp This test checks for Microsoft extensions. Portions of this test check for unsupported C++11 features when compiling at C++98. Guard all such diagnostics under C++98. Base destructor being marked with “throw()”, derived destructor is not. This no longer results in the following diagnostics in C++11. C++98: warning: exception specification of overriding function is more lax than base version [-Wmicrosoft-exception-spec] note: overridden virtual function is here Enum with underlying type is now supported in C++11. Guard the following under C++98. C++98: warning: enumeration types with a fixed underlying type are a C++11 extension [-Wc++11-extensions] C++98: warning: enumeration types with a fixed underlying type are a C++11 extension [-Wc++11-extensions] “override” is now supported in C++11. Guard the following under C++98. C++98: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions] test/SemaCXX/implicit-virtual-member-functions.cpp Change in diagnostics (3 instances) C++98: error: no suitable member 'operator delete' in 'B' note: member 'operator delete' declared here note: implicit destructor for 'B' first required here C++11: error: deleted function '~B' cannot override a non-deleted function note: overridden virtual function is here Added diagnostics in C++11 when target is Microsoft. C++11: error: attempt to use a deleted function note: virtual destructor requires an unambiguous, accessible 'operator delete' test/SemaCXX/virtual-base-used.cpp The base class explicitly declares a public virtual destructor. The derived class does not explicitly declare a destructor. The derived class contains a member with an inaccessible private destructor. In C++98, Clang Warns about the private destructor then gives a Note at class instantiation (MSABI) or class method definition. In C++11, The derived class having a member that can not be destroyed means the derived class’s own implicit destructor is deleted. Therefore, Clang issues an Error on the derived class’s deleted destructor trying to overwrite base class’s non-deleted destructor. Furthermore, Clang also issues Errors on classes further down the inheritance chain with explicitly declared destructors trying to overwrite first derived class’s implicitly deleted destructor. This test is subdivided into three sections. Each section has its own inheritance chain. Section 1: A is the base struct with a virtual destructor. B derives from A. B has a member class instance ‘x’ with an inaccessible destructor. D derives from B. D has an explicitly declared destructor. In C++98, Clang issues an Error about B’s x having no accessible destructor. In C++11, Clang issues 2 Errors. First Error on B’s implicitly deleted destructor inheriting A’s explicitly declared destructor. Second Error on D’s explicitly declared destructor inheriting B’s implicitly deleted destructor. C++98: error: field of type 'NoDestroy' has private destructor note: implicitly declared private here note: implicit destructor for 'B' first required here C++11: error: deleted function '~B' cannot override a non-deleted function note: overridden virtual function is here error: non-deleted function '~D' cannot override a deleted function note: overridden virtual function is here Section 2: A is the base struct with a virtual destructor. E derives A. E also has a member class instance x with no destructor. F derives from E and has no explicitly declared destructor. G derives from F and has an explicitly declared destructor. In C++98, Clang issues an Error about E’s x having no accessible destructor. In C++11, Clang issues 3 Errors. First Error about E’s implicitly deleted destructor inheriting A’s explicitly declared destructor. Second Error about F’s implicitly declared destructor inheriting E’s implicitly deleted destructor. Third Error about G’s explicitly declared destructor inheriting F’s now implicitly deleted destructor. C++98: error: field of type 'NoDestroy' has private destructor note: implicitly declared private here note: implicit destructor for 'E' first required here C++11: error: deleted function '~E' cannot override a non-deleted function note: overridden virtual function is here error: non-deleted function '~F' cannot override a deleted function note: overridden virtual function is her
[PATCH] D20710: Lit C++11 Compatibility Patch #9
tigerleapgorge updated this revision to Diff 87309. tigerleapgorge added a comment. 2 tests have been reviewed in https://reviews.llvm.org/D29520 They are: implicit-virtual-member-functions.cpp and virtual-member-functions.cpp Remove these from this patch. https://reviews.llvm.org/D20710 Files: test/CodeGenCXX/debug-info-use-after-free.cpp test/CodeGenCXX/dynamic-cast-hint.cpp test/SemaCXX/i-c-e-cxx.cpp test/SemaCXX/new-delete.cpp test/SemaCXX/no-wchar.cpp test/SemaCXX/virtual-member-functions-key-function.cpp test/SemaCXX/warn-bool-conversion.cpp test/SemaCXX/zero-length-arrays.cpp test/SemaTemplate/instantiate-c99.cpp test/SemaTemplate/temp_explicit.cpp test/SemaTemplate/value-dependent-null-pointer-constant.cpp Index: test/SemaTemplate/value-dependent-null-pointer-constant.cpp === --- test/SemaTemplate/value-dependent-null-pointer-constant.cpp +++ test/SemaTemplate/value-dependent-null-pointer-constant.cpp @@ -1,17 +1,30 @@ -// RUN: %clang_cc1 -fsyntax-only %s +// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s template struct X0 { const char *f0(bool Cond) { return Cond? "honk" : N; +#if __cplusplus >= 201103L +// expected-error@-2 {{incompatible operand types ('const char *' and 'int')}} +#else +// expected-no-diagnostics +#endif } const char *f1(bool Cond) { return Cond? N : "honk"; +#if __cplusplus >= 201103L +// expected-error@-2 {{incompatible operand types ('int' and 'const char *')}} +#endif } bool f2(const char *str) { return str == N; +#if __cplusplus >= 201103L +// expected-error@-2 {{comparison between pointer and integer ('const char *' and 'int')}} +#endif } }; Index: test/SemaTemplate/temp_explicit.cpp === --- test/SemaTemplate/temp_explicit.cpp +++ test/SemaTemplate/temp_explicit.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify -pedantic -Wc++11-compat %s +// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -Wc++11-compat -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -std=c++11 %s // // Tests explicit instantiation of templates. template class X0 { }; @@ -98,7 +100,12 @@ template struct X5::Inner2; // expected-note{{instantiation}} namespace N3 { - template struct N2::X5::Inner2; // expected-warning {{explicit instantiation of 'Inner2' not in a namespace enclosing 'N2'}} + template struct N2::X5::Inner2; +#if __cplusplus <= 199711L +// expected-warning@-2 {{explicit instantiation of 'Inner2' not in a namespace enclosing 'N2'}} +#else +// expected-error@-4 {{explicit instantiation of 'Inner2' not in a namespace enclosing 'N2'}} +#endif } struct X6 { @@ -145,7 +152,17 @@ namespace N2 { using namespace N1; - template struct X7; // expected-warning{{must occur in namespace}} - - template struct X9; // expected-warning{{must occur at global scope}} + template struct X7; +#if __cplusplus <= 199711L +// expected-warning@-2 {{explicit instantiation of 'N1::X7' must occur in namespace 'N1'}} +#else +// expected-error@-4 {{explicit instantiation of 'N1::X7' must occur in namespace 'N1'}} +#endif + + template struct X9; +#if __cplusplus <= 199711L +// expected-warning@-2 {{explicit instantiation of 'X9' must occur at global scope}} +#else +// expected-error@-4 {{explicit instantiation of 'X9' must occur at global scope}} +#endif } Index: test/SemaTemplate/instantiate-c99.cpp === --- test/SemaTemplate/instantiate-c99.cpp +++ test/SemaTemplate/instantiate-c99.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s // Test template instantiation for C99-specific features. @@ -9,8 +11,13 @@ struct DesigInit0 { void f(XType x, YType y) { T agg = { +#if __cplusplus <= 199711L .y = y, // expected-error{{does not refer}} .x = x // expected-error{{does not refer}} +#else + .y = static_cast(y), // expected-error{{does not refer}} + .x = static_cast(x) // expected-error{{does not refer}} +#endif }; } }; @@ -44,7 +51,11 @@ struct DesigArrayInit0 { void f(Val1 val1, Val2 val2) { T array = { +#if __cplusplus <= 199711L [Subscript1] = val1, +#else + [Subscript1] = static_cast(val1), +#endif [Subscript2] = val2 // expected-error{{exceeds array bounds}} }; @@ -60,7 +71,11 @@ struct DesigArrayRangeInit0 { void f(Val1 val1) { T array = { +#if __cplusplus <= 199711L [Subscript1...Subscript2] = val1 // expected-error{{exceeds}} +#else + [Subscript1...Subscript2] = static_cast(val1) // expected-error{{exceeds}} +#endif }; } }; @@ -74,7 +89,11 @@ template struct Compoun
[PATCH] D21626: Lit C++11 Compatibility Patch #10
tigerleapgorge updated this revision to Diff 87312. tigerleapgorge added a comment. Remove 2 tests reviewed under https://reviews.llvm.org/D29520. https://reviews.llvm.org/D21626 Files: test/Modules/Inputs/merge-using-decls/a.h test/Modules/Inputs/merge-using-decls/b.h test/Modules/merge-using-decls.cpp test/OpenMP/declare_reduction_messages.cpp test/OpenMP/openmp_check.cpp test/SemaCXX/PR9572.cpp test/SemaCXX/default-assignment-operator.cpp test/SemaCXX/default-constructor-initializers.cpp test/SemaCXX/format-strings.cpp test/SemaCXX/printf-cstr.cpp test/SemaCXX/warn-thread-safety-parsing.cpp Index: test/SemaCXX/warn-thread-safety-parsing.cpp === --- test/SemaCXX/warn-thread-safety-parsing.cpp +++ test/SemaCXX/warn-thread-safety-parsing.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -std=c++11 %s #define LOCKABLE__attribute__ ((lockable)) #define SCOPED_LOCKABLE __attribute__ ((scoped_lockable)) @@ -1266,8 +1268,10 @@ void foo3(FooLate *f) EXCLUSIVE_LOCKS_REQUIRED(f->mu) { } void foo4(FooLate *f) EXCLUSIVE_LOCKS_REQUIRED(f->mu); - static void foo5()EXCLUSIVE_LOCKS_REQUIRED(mu); // \ -// expected-error {{invalid use of member 'mu' in static member function}} + static void foo5()EXCLUSIVE_LOCKS_REQUIRED(mu); +#if __cplusplus <= 199711L + // expected-error@-2 {{invalid use of member 'mu' in static member function}} +#endif template void foo6() EXCLUSIVE_LOCKS_REQUIRED(T::statmu) { } @@ -1461,15 +1465,21 @@ mutable Mutex mu; int a GUARDED_BY(mu); - static int si GUARDED_BY(mu); // \ -// expected-error {{invalid use of non-static data member 'mu'}} + static int si GUARDED_BY(mu); +#if __cplusplus <= 199711L + // expected-error@-2 {{invalid use of non-static data member 'mu'}} +#endif - static void foo() EXCLUSIVE_LOCKS_REQUIRED(mu); // \ -// expected-error {{invalid use of member 'mu' in static member function}} + static void foo() EXCLUSIVE_LOCKS_REQUIRED(mu); +#if __cplusplus <= 199711L + // expected-error@-2 {{invalid use of member 'mu' in static member function}} +#endif friend FooStream& operator<<(FooStream& s, const Foo& f) -EXCLUSIVE_LOCKS_REQUIRED(mu); // \ -// expected-error {{invalid use of non-static data member 'mu'}} +EXCLUSIVE_LOCKS_REQUIRED(mu); +#if __cplusplus <= 199711L +// expected-error@-2 {{invalid use of non-static data member 'mu'}} +#endif }; Index: test/SemaCXX/printf-cstr.cpp === --- test/SemaCXX/printf-cstr.cpp +++ test/SemaCXX/printf-cstr.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -Wformat -verify %s -Wno-error=non-pod-varargs +// RUN: %clang_cc1 -fsyntax-only -Wformat -verify -std=c++98 %s -Wno-error=non-pod-varargs +// RUN: %clang_cc1 -fsyntax-only -Wformat -verify -std=c++11 %s -Wno-error=non-pod-varargs #include @@ -31,12 +33,39 @@ int n = 10; printf("%d: %s\n", n, hcs.c_str()); - printf("%d: %s\n", n, hcs); // expected-warning{{cannot pass non-POD object of type 'HasCStr' to variadic function; expected type from format string was 'char *'}} expected-note{{did you mean to call the c_str() method?}} - printf("%d: %s\n", n, hncs); // expected-warning{{cannot pass non-POD object of type 'HasNoCStr' to variadic function; expected type from format string was 'char *'}} - sprintf(str, "%d: %s", n, hcs); // expected-warning{{cannot pass non-POD object of type 'HasCStr' to variadic function; expected type from format string was 'char *'}} expected-note{{did you mean to call the c_str() method?}} - - printf(formatString, hcs, hncs); // expected-warning{{cannot pass object of non-POD type 'HasCStr' through variadic function}} expected-warning{{cannot pass object of non-POD type 'HasNoCStr' through variadic function}} - printf(extstr, hcs, n); // expected-warning{{cannot pass object of non-POD type 'HasCStr' through variadic function}} + printf("%d: %s\n", n, hcs); +#if __cplusplus <= 199711L + // expected-warning@-2 {{cannot pass non-POD object of type 'HasCStr' to variadic function; expected type from format string was 'char *'}} + // expected-note@-3 {{did you mean to call the c_str() method?}} +#else + // expected-warning@-5 {{format specifies type 'char *' but the argument has type 'HasCStr'}} +#endif + + printf("%d: %s\n", n, hncs); +#if __cplusplus <= 199711L + // expected-warning@-2 {{cannot pass non-POD object of type 'HasNoCStr' to variadic function; expected type from format string was 'char *'}} +#else + // expected-warning@-4 {{format specifies type 'char *' but the argument has type 'HasNoCStr'}} +#endif + + sprintf(str, "%d: %s", n, hcs); +#if __cplusplus <= 199711L + // expected-warning@-2 {{cannot pass non-POD object of t
[PATCH] D29685: Lit C++11 Compatibility - Function Attributes
tigerleapgorge created this revision. I am continuing to make Lit tests C++11 compatible. This patch contains 3 tests, previously in review https://reviews.llvm.org/D21626. First two tests involve printf format attributes. The third test involve thread safety attribute. Here are the descriptions for each test. test/SemaCXX/format-strings.cpp This test verifies format specifiers. This test contains 2 parts. Part 1. C++11 added Scanf floating-point format specifier “a”. http://en.cppreference.com/w/c/io/fscanf The Scanf format specifier “%as” expects type “float *”. However, the actual argument is type “char **”. Change in diagnostics. C++98: warning: 'a' length modifier is not supported by ISO C [-Wformat-non-iso] C++11: warning: format specifies type 'float *' but the argument has type 'char **' [-Wformat] Part 2. Function test_null_format() expects a const char * as its first formal argument, but is instead given a Boolean literal as its first actual argument. Type conversion from const bool to const char * is a Warning in C++98, but an Error in C++11. Change in diagnostics. C++98: warning: initialization of pointer of type 'const char *' to null from a constant boolean expression [-Wbool-conversion] C++11: error: no matching function for call to 'test_null_format' note: candidate function not viable: no known conversion from 'bool' to 'const char *' for 1st argument test/SemaCXX/printf-cstr.cpp This tests verifies type mismatches between printf format specifiers and the type of the actual arguments. This test contains 3 types of diagnostic changes. Diagnostics changed for mismatch between “%s” and actual arguments of non-POD class instance. In C++98, non-POD objects are not allowed as variadic arguments. In C++11, non-POD is allowed (5.2.2/7). However, since the format specifier %s expects a char pointer not an object, Clang will issue a Warning on that. If the class has a c_str() method, Clang will issue a accompanying Note to prompt the use to invoke it. Type 1: A class object that has a c_str() method is passed in. In C++98, Clang issues a Warning and an accompanying Note. In C++11, Clang issues a Warning. Expect the following change in diagnostics. (3 instances) C++98: warning: cannot pass non-POD object of type 'HasCStr' to variadic constructor; expected type from format string was 'char *' [-Wnon-pod-varargs] note: did you mean to call the c_str() method? C++11: warning: format specifies type 'char *' but the argument has type 'HasCStr' [-Wformat] Type 2: A class object that does not have a c_str() method is passed in. The accompanying note prompting the user to use the c_str() has no reason be there. Change in Warning diagnostics. (1 instance) C++98: warning: cannot pass non-POD object of type 'HasNoCStr' to variadic function; expected type from format string was 'char *' [-Wnon-pod-varargs] C++11: warning: format specifies type 'char *' but the argument has type 'HasNoCStr' [-Wformat] Type 3: printf format string is passed in as a pointer instead of a string literal. In both C++98 and C++11, Clang is unable to determine type mismatch at compile type. However, in C++98, non-POD type is not allowed inside variadic arguments. (3 instances) C++98: warning: cannot pass object of non-POD type 'HasCStr' through variadic function; call will abort at runtime [-Wnon-pod-varargs] C++11: (None) test/SemaCXX/warn-thread-safety-parsing.cpp In C++11, does not issue Errors for thread safety attributes applied to static members. http://clang.llvm.org/docs/ThreadSafetyAnalysis.html This may be a side effect of C++11’s relaxation on in-class member initializers. http://www.stroustrup.com/C++11FAQ.html#member-init Restrict the following diagnostics to C++98. (2 instances each) C++98: error: invalid use of non-static data member 'mu' C++98: error: invalid use of member 'mu' in static member function https://reviews.llvm.org/D29685 Files: test/SemaCXX/format-strings.cpp test/SemaCXX/printf-cstr.cpp test/SemaCXX/warn-thread-safety-parsing.cpp Index: test/SemaCXX/warn-thread-safety-parsing.cpp === --- test/SemaCXX/warn-thread-safety-parsing.cpp +++ test/SemaCXX/warn-thread-safety-parsing.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -std=c++11 %s #define LOCKABLE__attribute__ ((lockable)) #define SCOPED_LOCKABLE __attribute__ ((scoped_lockable)) @@ -1266,8 +1268,10 @@ void foo3(FooLate *f) EXCLUSIVE_LOCKS_REQUIRED(f->mu) { } void foo4(FooLate *f) EXCLUSIVE_LOCKS_REQUIRED(f->mu); - static void foo5()EXCLUSIVE_LOCKS_REQUIRED(mu); // \ -/
[PATCH] D29725: Lit C++11 Compatibility - Parse OpenMP
tigerleapgorge created this revision. I am continuing to make out Lit tests C++11 compatible. There are two tests in this patch. Both tests verify parse errors with ill formed OpenMP expressions. test/OpenMP/declare_reduction_messages.cpp In C++11, an opening square bracket is the start of a lambda capture. Therefore, a unmatched opening square bracket will cause the following diagnostics change. C++98: error: expected '(' after 'initializer' error: expected expression warning: extra tokens at the end of '#pragma omp declare reduction' are ignored [-Wextra-tokens] C++11: error: expected '(' after 'initializer' error: expected variable name or 'this' in lambda capture list error: expected ')' note: to match this '(' test/OpenMP/openmp_check.cpp This test is created in response to bug 25221, where C++11 code running under C++98 causes the parser to go into an infinite loop. Since this is C++11 code, all expected diagnostics will go away when compiling at C++11. Therefore, guard all of the following diagnostics under C++98. C++98: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions] error: expected expression error: expected ';' at end of declaration C++98: error: C++ requires a type specifier for all declarations C++98: error: expected unqualified-id C++98: error: extraneous closing brace ('}') https://reviews.llvm.org/D29725 Files: test/OpenMP/declare_reduction_messages.cpp test/OpenMP/openmp_check.cpp Index: test/OpenMP/openmp_check.cpp === --- test/OpenMP/openmp_check.cpp +++ test/OpenMP/openmp_check.cpp @@ -1,15 +1,35 @@ // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++98 %s +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++11 %s + int nested(int a) { #pragma omp parallel ++a; - auto F = [&]() { // expected-error {{expected expression}} expected-error {{expected ';' at end of declaration}} expected-warning {{'auto' type specifier is a C++11 extension}} + auto F = [&]() { +#if __cplusplus <= 199711L + // expected-warning@-2 {{'auto' type specifier is a C++11 extension}} + // expected-error@-3 {{expected expression}} + // expected-error@-4 {{expected ';' at end of declaration}} +#else + // expected-no-diagnostics +#endif + #pragma omp parallel { #pragma omp target ++a; } }; - F(); // expected-error {{C++ requires a type specifier for all declarations}} - return a; // expected-error {{expected unqualified-id}} -}// expected-error {{extraneous closing brace ('}')}} + F(); +#if __cplusplus <= 199711L + // expected-error@-2 {{C++ requires a type specifier for all declarations}} +#endif + return a; +#if __cplusplus <= 199711L + // expected-error@-2 {{expected unqualified-id}} +#endif +} +#if __cplusplus <= 199711L +// expected-error@-2 {{extraneous closing brace ('}')}} +#endif Index: test/OpenMP/declare_reduction_messages.cpp === --- test/OpenMP/declare_reduction_messages.cpp +++ test/OpenMP/declare_reduction_messages.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++98 %s +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++11 %s int temp; // expected-note 7 {{'temp' declared here}} @@ -51,7 +53,17 @@ #pragma omp declare reduction(fun222 : long : omp_out += omp_in) // expected-error {{redefinition of user-defined reduction for type 'long'}} #pragma omp declare reduction(fun1 : long : omp_out += omp_in) initializer // expected-error {{expected '(' after 'initializer'}} #pragma omp declare reduction(fun2 : long : omp_out += omp_in) initializer { // expected-error {{expected '(' after 'initializer'}} expected-error {{expected expression}} expected-warning {{extra tokens at the end of '#pragma omp declare reduction' are ignored}} -#pragma omp declare reduction(fun3 : long : omp_out += omp_in) initializer[ // expected-error {{expected '(' after 'initializer'}} expected-error {{expected expression}} expected-warning {{extra tokens at the end of '#pragma omp declare reduction' are ignored}} +#pragma omp declare reduction(fun3 : long : omp_out += omp_in) initializer[ +#if __cplusplus <= 199711L +// expected-error@-2 {{expected '(' after 'initializer'}} +// expected-error@-3 {{expected expression}} +// expected-warning@-4 {{extra tokens at the end of '#pragma omp declare reduction' are ignored}} +#else +// expected-error@-6 {{expected '(' after 'initializer'}} +// expected-error@-7 {{expected variable name or 'this' in lambda capture list}} +// expected-error@-8 {{expected ')'}} +/
[PATCH] D21626: Lit C++11 Compatibility Patch #10
tigerleapgorge updated this revision to Diff 87711. tigerleapgorge edited the summary of this revision. tigerleapgorge added a comment. Remove 2 OpenMP tests reviewed via https://reviews.llvm.org/D29725 https://reviews.llvm.org/D21626 Files: test/Modules/Inputs/merge-using-decls/a.h test/Modules/Inputs/merge-using-decls/b.h test/Modules/merge-using-decls.cpp test/SemaCXX/PR9572.cpp test/SemaCXX/default-assignment-operator.cpp test/SemaCXX/default-constructor-initializers.cpp test/SemaCXX/format-strings.cpp test/SemaCXX/printf-cstr.cpp test/SemaCXX/warn-thread-safety-parsing.cpp Index: test/SemaCXX/warn-thread-safety-parsing.cpp === --- test/SemaCXX/warn-thread-safety-parsing.cpp +++ test/SemaCXX/warn-thread-safety-parsing.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -std=c++11 %s #define LOCKABLE__attribute__ ((lockable)) #define SCOPED_LOCKABLE __attribute__ ((scoped_lockable)) @@ -1266,8 +1268,10 @@ void foo3(FooLate *f) EXCLUSIVE_LOCKS_REQUIRED(f->mu) { } void foo4(FooLate *f) EXCLUSIVE_LOCKS_REQUIRED(f->mu); - static void foo5()EXCLUSIVE_LOCKS_REQUIRED(mu); // \ -// expected-error {{invalid use of member 'mu' in static member function}} + static void foo5()EXCLUSIVE_LOCKS_REQUIRED(mu); +#if __cplusplus <= 199711L + // expected-error@-2 {{invalid use of member 'mu' in static member function}} +#endif template void foo6() EXCLUSIVE_LOCKS_REQUIRED(T::statmu) { } @@ -1461,15 +1465,21 @@ mutable Mutex mu; int a GUARDED_BY(mu); - static int si GUARDED_BY(mu); // \ -// expected-error {{invalid use of non-static data member 'mu'}} + static int si GUARDED_BY(mu); +#if __cplusplus <= 199711L + // expected-error@-2 {{invalid use of non-static data member 'mu'}} +#endif - static void foo() EXCLUSIVE_LOCKS_REQUIRED(mu); // \ -// expected-error {{invalid use of member 'mu' in static member function}} + static void foo() EXCLUSIVE_LOCKS_REQUIRED(mu); +#if __cplusplus <= 199711L + // expected-error@-2 {{invalid use of member 'mu' in static member function}} +#endif friend FooStream& operator<<(FooStream& s, const Foo& f) -EXCLUSIVE_LOCKS_REQUIRED(mu); // \ -// expected-error {{invalid use of non-static data member 'mu'}} +EXCLUSIVE_LOCKS_REQUIRED(mu); +#if __cplusplus <= 199711L +// expected-error@-2 {{invalid use of non-static data member 'mu'}} +#endif }; Index: test/SemaCXX/printf-cstr.cpp === --- test/SemaCXX/printf-cstr.cpp +++ test/SemaCXX/printf-cstr.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -Wformat -verify %s -Wno-error=non-pod-varargs +// RUN: %clang_cc1 -fsyntax-only -Wformat -verify -std=c++98 %s -Wno-error=non-pod-varargs +// RUN: %clang_cc1 -fsyntax-only -Wformat -verify -std=c++11 %s -Wno-error=non-pod-varargs #include @@ -31,12 +33,39 @@ int n = 10; printf("%d: %s\n", n, hcs.c_str()); - printf("%d: %s\n", n, hcs); // expected-warning{{cannot pass non-POD object of type 'HasCStr' to variadic function; expected type from format string was 'char *'}} expected-note{{did you mean to call the c_str() method?}} - printf("%d: %s\n", n, hncs); // expected-warning{{cannot pass non-POD object of type 'HasNoCStr' to variadic function; expected type from format string was 'char *'}} - sprintf(str, "%d: %s", n, hcs); // expected-warning{{cannot pass non-POD object of type 'HasCStr' to variadic function; expected type from format string was 'char *'}} expected-note{{did you mean to call the c_str() method?}} - - printf(formatString, hcs, hncs); // expected-warning{{cannot pass object of non-POD type 'HasCStr' through variadic function}} expected-warning{{cannot pass object of non-POD type 'HasNoCStr' through variadic function}} - printf(extstr, hcs, n); // expected-warning{{cannot pass object of non-POD type 'HasCStr' through variadic function}} + printf("%d: %s\n", n, hcs); +#if __cplusplus <= 199711L + // expected-warning@-2 {{cannot pass non-POD object of type 'HasCStr' to variadic function; expected type from format string was 'char *'}} + // expected-note@-3 {{did you mean to call the c_str() method?}} +#else + // expected-warning@-5 {{format specifies type 'char *' but the argument has type 'HasCStr'}} +#endif + + printf("%d: %s\n", n, hncs); +#if __cplusplus <= 199711L + // expected-warning@-2 {{cannot pass non-POD object of type 'HasNoCStr' to variadic function; expected type from format string was 'char *'}} +#else + // expected-warning@-4 {{format specifies type 'char *' but the argument has type 'HasNoCStr'}} +#endif + + sprintf(str, "%d: %s", n, hcs); +#if __cplusplus <= 199711L + // expected-warning@-2 {{cannot pass non-POD object of type 'HasCStr' to var
[PATCH] D29739: Make Lit tests C++11 compatible - Objective-C++
tigerleapgorge created this revision. I am continuing to make our Lit tests C++11 compatible. This patch defaults five Objective-C++ tests to run under -std=gnu++98 This patch is essentially a continuation of Bug 24344 https://llvm.org/bugs/show_bug.cgi?id=24344 Fix r289167 resolved all tests inside the Rewriter directory, This patch resolves the remaining tests outside the Rewriter directory. https://reviews.llvm.org/D29739 Files: test/CodeGenObjCXX/arc-blocks.mm test/CodeGenObjCXX/encode.mm test/CodeGenObjCXX/literals.mm test/SemaObjCXX/arc-system-header.mm test/SemaObjCXX/ivar-construct.mm Index: test/SemaObjCXX/ivar-construct.mm === --- test/SemaObjCXX/ivar-construct.mm +++ test/SemaObjCXX/ivar-construct.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s +// RUN: %clang_cc1 -std=gnu++98 -fsyntax-only -verify -Wno-objc-root-class %s struct Y { Y(); Index: test/SemaObjCXX/arc-system-header.mm === --- test/SemaObjCXX/arc-system-header.mm +++ test/SemaObjCXX/arc-system-header.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-arc -isystem %S/Inputs %s -verify +// RUN: %clang_cc1 -std=gnu++98 -fobjc-arc -isystem %S/Inputs %s -verify #include Index: test/CodeGenObjCXX/literals.mm === --- test/CodeGenObjCXX/literals.mm +++ test/CodeGenObjCXX/literals.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -I %S/Inputs -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -fexceptions -fobjc-exceptions -fcxx-exceptions -fobjc-arc-exceptions -O2 -disable-llvm-passes -o - %s | FileCheck %s +// RUN: %clang_cc1 -std=gnu++98 -I %S/Inputs -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -fexceptions -fobjc-exceptions -fcxx-exceptions -fobjc-arc-exceptions -O2 -disable-llvm-passes -o - %s | FileCheck %s #include "literal-support.h" Index: test/CodeGenObjCXX/encode.mm === --- test/CodeGenObjCXX/encode.mm +++ test/CodeGenObjCXX/encode.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -std=gnu++98 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s // CHECK: v17@0:8{vector=}16 // CHECK: {vector=} Index: test/CodeGenObjCXX/arc-blocks.mm === --- test/CodeGenObjCXX/arc-blocks.mm +++ test/CodeGenObjCXX/arc-blocks.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-runtime-has-weak -fblocks -fobjc-arc -o - %s | FileCheck %s +// RUN: %clang_cc1 -std=gnu++98 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-runtime-has-weak -fblocks -fobjc-arc -o - %s | FileCheck %s // CHECK: [[A:.*]] = type { i64, [10 x i8*] } Index: test/SemaObjCXX/ivar-construct.mm === --- test/SemaObjCXX/ivar-construct.mm +++ test/SemaObjCXX/ivar-construct.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s +// RUN: %clang_cc1 -std=gnu++98 -fsyntax-only -verify -Wno-objc-root-class %s struct Y { Y(); Index: test/SemaObjCXX/arc-system-header.mm === --- test/SemaObjCXX/arc-system-header.mm +++ test/SemaObjCXX/arc-system-header.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-arc -isystem %S/Inputs %s -verify +// RUN: %clang_cc1 -std=gnu++98 -fobjc-arc -isystem %S/Inputs %s -verify #include Index: test/CodeGenObjCXX/literals.mm === --- test/CodeGenObjCXX/literals.mm +++ test/CodeGenObjCXX/literals.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -I %S/Inputs -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -fexceptions -fobjc-exceptions -fcxx-exceptions -fobjc-arc-exceptions -O2 -disable-llvm-passes -o - %s | FileCheck %s +// RUN: %clang_cc1 -std=gnu++98 -I %S/Inputs -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -fexceptions -fobjc-exceptions -fcxx-exceptions -fobjc-arc-exceptions -O2 -disable-llvm-passes -o - %s | FileCheck %s #include "literal-support.h" Index: test/CodeGenObjCXX/encode.mm === --- test/CodeGenObjCXX/encode.mm +++ test/CodeGenObjCXX/encode.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -std=gnu++98 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s // CHECK: v17@0:8{vector=}16 // CHECK: {vector=} Index: test/CodeGenObjCXX/arc-blocks.mm === --- test/CodeGenObjCX
[PATCH] D29739: Make Lit tests C++11 compatible - Objective-C++
tigerleapgorge abandoned this revision. tigerleapgorge added a comment. These tests were failing because I accidentally changed the Objective-C++. Abandoning this patch. https://reviews.llvm.org/D29739 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29739: Make Lit tests C++11 compatible - Objective-C++
tigerleapgorge added a comment. Hi John, Here is the most recent discussion I can find on cfe-dev. “I'm guessing that Objective-C/C++ is kind of passe, so nobody is really interested in modernizing it” http://lists.llvm.org/pipermail/cfe-dev/2016-December/051844.html As far as I am aware, there appears to be no strong reason to bump or not to bump ObjC++. Cheers Charles Li https://reviews.llvm.org/D29739 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29859: Make Lit tests C++11 compatible - nounwind noexcept
tigerleapgorge created this revision. I am continuing to make Lit tests C++11 compatible. There are 3 tests in this patch (previously in https://reviews.llvm.org/D24812). All 3 tests relate to C++11 destructors being nonthrowing by default. CodeGenCXX/linetable-cleanup.cpp C::~C() has an extra “nounwind” attribute in C++11. Relaxed the CHECK pattern matching for possible existence of “ #[0-9]”. IR: C++98: call void @_ZN1CD1Ev(%class.C* %c), !dbg !21 C++11: call void @_ZN1CD1Ev(%class.C* %c) #2, !dbg !21 attributes #2 = { nounwind } CodeGenCXX/lpad-linetable.cpp The purpose of this test is to verify landingpad line numbers when catching any exceptions thrown by the destructors for “longs” and “shorts” as they go out of scope. In C++11, “longs” and “short”’s destructors are nonthrowing, so no landingpad is generated. And since the purpose of this test is to verify for landingpad line table, I have restricted this test to C++98. C++11 IR: ~std::_Vector_base >() noexcept ~std::_Vector_base >() noexcept Index/comment-cplus-decls.cpp In C++11, ~Test() is nonthrowing. IR: C++98: ~Test() C++11: ~Test() noexcept https://reviews.llvm.org/D29859 Files: test/CodeGenCXX/linetable-cleanup.cpp test/CodeGenCXX/lpad-linetable.cpp test/Index/comment-cplus-decls.cpp Index: test/Index/comment-cplus-decls.cpp === --- test/Index/comment-cplus-decls.cpp +++ test/Index/comment-cplus-decls.cpp @@ -2,9 +2,15 @@ // RUN: mkdir %t // RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng -target x86_64-apple-darwin10 %s > %t/out // RUN: FileCheck %s < %t/out +// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng -target x86_64-apple-darwin10 -std=c++98 %s > %t/98 +// RUN: FileCheck %s < %t/98 +// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng -target x86_64-apple-darwin10 -std=c++11 %s > %t/11 +// RUN: FileCheck %s < %t/11 // Ensure that XML we generate is not invalid. // RUN: FileCheck %s -check-prefix=WRONG < %t/out +// RUN: FileCheck %s -check-prefix=WRONG < %t/98 +// RUN: FileCheck %s -check-prefix=WRONG < %t/11 // WRONG-NOT: CommentXMLInvalid // rdar://12378714 @@ -42,7 +48,7 @@ // CHECK: class Test {} // CHECK: Test() : reserved(new Test::data()) {} // CHECK: unsigned int getID() const -// CHECK: ~Test() +// CHECK: ~Test(){{( noexcept)?}} // CHECK: Test::data *reserved Index: test/CodeGenCXX/lpad-linetable.cpp === --- test/CodeGenCXX/lpad-linetable.cpp +++ test/CodeGenCXX/lpad-linetable.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -emit-llvm -debug-info-kind=limited -triple x86_64-apple-darwin10 %s -o - | FileCheck %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -emit-llvm -debug-info-kind=limited -triple x86_64-apple-darwin10 -std=c++98 %s -o - | FileCheck %s // The landing pad should have the line number of the closing brace of the function. // rdar://problem/13888152 // CHECK: ret i32 Index: test/CodeGenCXX/linetable-cleanup.cpp === --- test/CodeGenCXX/linetable-cleanup.cpp +++ test/CodeGenCXX/linetable-cleanup.cpp @@ -1,10 +1,12 @@ // RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-apple-darwin10 %s -o - | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-apple-darwin10 -std=c++98 %s -o - | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-apple-darwin10 -std=c++11 %s -o - | FileCheck %s // Check the line numbers for cleanup code with EH in combination with // simple return expressions. // CHECK: define {{.*}}foo -// CHECK: call void @_ZN1CD1Ev(%class.C* {{.*}}), !dbg ![[RET:[0-9]+]] +// CHECK: call void @_ZN1CD1Ev(%class.C* {{.*}}){{( #[0-9])?}}, !dbg ![[RET:[0-9]+]] // CHECK: ret i32 0, !dbg ![[RET]] // CHECK: define {{.*}}bar Index: test/Index/comment-cplus-decls.cpp === --- test/Index/comment-cplus-decls.cpp +++ test/Index/comment-cplus-decls.cpp @@ -2,9 +2,15 @@ // RUN: mkdir %t // RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng -target x86_64-apple-darwin10 %s > %t/out // RUN: FileCheck %s < %t/out +// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng -target x86_64-apple-darwin10 -std=c++98 %s > %t/98 +// RUN: FileCheck %s < %t/98 +// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng -target x86_64-apple-darwin10 -std=c++11 %s > %t/11 +// RUN: FileCheck %s < %t/11 // Ensure that XML we genera
[PATCH] D24812: Lit C++11 Compatibility Patch #11
tigerleapgorge updated this revision to Diff 88224. tigerleapgorge edited the summary of this revision. tigerleapgorge added a comment. Remove another 3 tests reviewed in https://reviews.llvm.org/D29859 https://reviews.llvm.org/D24812 Files: test/CodeGenCXX/mangle-unnamed.cpp test/CodeGenCXX/static-init.cpp test/CodeGenCXX/volatile-1.cpp test/CodeGenCXX/volatile.cpp test/PCH/macro-undef.cpp Index: test/PCH/macro-undef.cpp === --- test/PCH/macro-undef.cpp +++ test/PCH/macro-undef.cpp @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -emit-pch -o %t %s -// RUN: %clang_cc1 -fsyntax-only -include-pch %t %s -Wuninitialized -verify -// RUN: %clang_cc1 -fsyntax-only -include-pch %t %s -Wuninitialized -fdiagnostics-parseable-fixits 2>&1 | FileCheck %s +// RUN: %clang_cc1 -std=c++98 -emit-pch -o %t %s +// RUN: %clang_cc1 -std=c++98 -fsyntax-only -include-pch %t %s -Wuninitialized -verify +// RUN: %clang_cc1 -std=c++98 -fsyntax-only -include-pch %t %s -Wuninitialized -fdiagnostics-parseable-fixits 2>&1 | FileCheck %s #ifndef HEADER #define HEADER Index: test/CodeGenCXX/volatile.cpp === --- test/CodeGenCXX/volatile.cpp +++ test/CodeGenCXX/volatile.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -std=c++98 -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -std=c++11 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK11 %s // Check that IR gen doesn't try to do an lvalue-to-rvalue conversion // on a volatile reference result. rdar://problem/8338198 @@ -27,6 +28,7 @@ // CHECK-LABEL: define void @_ZN5test14testEv() void test() { // CHECK: [[TMP:%.*]] = load i32*, i32** @_ZN5test11xE, align 8 +// CHECK11:{{%.*}} = load volatile i32, i32* [[TMP]], align 4 // CHECK-NEXT: ret void *x; } Index: test/CodeGenCXX/volatile-1.cpp === --- test/CodeGenCXX/volatile-1.cpp +++ test/CodeGenCXX/volatile-1.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -Wno-unused-value -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -Wno-unused-value -triple %itanium_abi_triple -emit-llvm %s -std=c++98 -o - | FileCheck %s +// RUN: %clang_cc1 -Wno-unused-value -triple %itanium_abi_triple -emit-llvm %s -std=c++11 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK11 %s // CHECK: @i = global [[INT:i[0-9]+]] 0 volatile int i, j, k; @@ -22,18 +23,22 @@ asm("nop"); // CHECK: call void asm - // should not load + // should not load in C++98 i; + // CHECK11-NEXT: load volatile [[INT]], [[INT]]* @i (float)(ci); // CHECK-NEXT: load volatile [[INT]], [[INT]]* getelementptr inbounds ([[CINT]], [[CINT]]* @ci, i32 0, i32 0) // CHECK-NEXT: load volatile [[INT]], [[INT]]* getelementptr inbounds ([[CINT]], [[CINT]]* @ci, i32 0, i32 1) // CHECK-NEXT: sitofp [[INT]] - // These are not uses in C++: + // These are not uses in C++98: // [expr.static.cast]p6: // The lvalue-to-rvalue . . . conversions are not applied to the expression. (void)ci; + // CHECK11-NEXT: load volatile [[INT]], [[INT]]* getelementptr inbounds ([[CINT]], [[CINT]]* @ci, i32 0, i32 0) + // CHECK11-NEXT: load volatile [[INT]], [[INT]]* getelementptr inbounds ([[CINT]], [[CINT]]* @ci, i32 0, i32 1) + (void)a; (void)(ci=ci); @@ -126,7 +131,8 @@ // CHECK-NEXT: load volatile // CHECK-NEXT: sitofp - (void)i; + (void)i; // This is now a load in C++11 + // CHECK11-NEXT: load volatile i=i; // CHECK-NEXT: load volatile @@ -155,25 +161,30 @@ // CHECK-NEXT: br label // CHECK: phi - (void)(i,(i=i)); + (void)(i,(i=i)); // first i is also a load in C++11 + // CHECK11-NEXT: load volatile // CHECK-NEXT: load volatile // CHECK-NEXT: store volatile - i=i,k; + i=i,k; // k is also a load in C++11 // CHECK-NEXT: load volatile [[INT]], [[INT]]* @i // CHECK-NEXT: store volatile {{.*}}, [[INT]]* @i + // CHECK11-NEXT: load volatile [[INT]], [[INT]]* @k (i=j,k=j); // CHECK-NEXT: load volatile [[INT]], [[INT]]* @j // CHECK-NEXT: store volatile {{.*}}, [[INT]]* @i // CHECK-NEXT: load volatile [[INT]], [[INT]]* @j // CHECK-NEXT: store volatile {{.*}}, [[INT]]* @k - (i=j,k); + (i=j,k); // k is also a load in C++11 // CHECK-NEXT: load volatile [[INT]], [[INT]]* @j // CHECK-NEXT: store volatile {{.*}}, [[INT]]* @i + // CHECK11-NEXT: load volatile [[INT]], [[INT]]* @k - (i,j); + (i,j); // i and j both are loads in C++11 + // CHECK11-NEXT: load volatile [[INT]], [[INT]]* @i + // CHECK11-NEXT: load volatile [[INT]], [[INT]]* @j // Extra load in C++. i=c=k; @@ -190,7 +201,9 @@ // CHECK-NEXT: add nsw [[INT]] // CHECK-NEXT: store volatile - ci; + ci; // ci is a
[PATCH] D29685: Lit C++11 Compatibility - Function Attributes
tigerleapgorge added a comment. @aaron.ballman Thank you for the code review. I take it I can commit the first 2 tests? @delesley Thank you for the analysis. Should I open a bugzilla to track this issue? https://reviews.llvm.org/D29685 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D21626: Lit C++11 Compatibility Patch #10
tigerleapgorge updated this revision to Diff 88232. tigerleapgorge edited the summary of this revision. tigerleapgorge added a comment. Remove 2 tests reviewed in https://reviews.llvm.org/D29685 https://reviews.llvm.org/D21626 Files: test/Modules/Inputs/merge-using-decls/a.h test/Modules/Inputs/merge-using-decls/b.h test/Modules/merge-using-decls.cpp test/SemaCXX/PR9572.cpp test/SemaCXX/default-assignment-operator.cpp test/SemaCXX/default-constructor-initializers.cpp test/SemaCXX/warn-thread-safety-parsing.cpp Index: test/SemaCXX/warn-thread-safety-parsing.cpp === --- test/SemaCXX/warn-thread-safety-parsing.cpp +++ test/SemaCXX/warn-thread-safety-parsing.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -std=c++11 %s #define LOCKABLE__attribute__ ((lockable)) #define SCOPED_LOCKABLE __attribute__ ((scoped_lockable)) @@ -1266,8 +1268,10 @@ void foo3(FooLate *f) EXCLUSIVE_LOCKS_REQUIRED(f->mu) { } void foo4(FooLate *f) EXCLUSIVE_LOCKS_REQUIRED(f->mu); - static void foo5()EXCLUSIVE_LOCKS_REQUIRED(mu); // \ -// expected-error {{invalid use of member 'mu' in static member function}} + static void foo5()EXCLUSIVE_LOCKS_REQUIRED(mu); +#if __cplusplus <= 199711L + // expected-error@-2 {{invalid use of member 'mu' in static member function}} +#endif template void foo6() EXCLUSIVE_LOCKS_REQUIRED(T::statmu) { } @@ -1461,15 +1465,21 @@ mutable Mutex mu; int a GUARDED_BY(mu); - static int si GUARDED_BY(mu); // \ -// expected-error {{invalid use of non-static data member 'mu'}} + static int si GUARDED_BY(mu); +#if __cplusplus <= 199711L + // expected-error@-2 {{invalid use of non-static data member 'mu'}} +#endif - static void foo() EXCLUSIVE_LOCKS_REQUIRED(mu); // \ -// expected-error {{invalid use of member 'mu' in static member function}} + static void foo() EXCLUSIVE_LOCKS_REQUIRED(mu); +#if __cplusplus <= 199711L + // expected-error@-2 {{invalid use of member 'mu' in static member function}} +#endif friend FooStream& operator<<(FooStream& s, const Foo& f) -EXCLUSIVE_LOCKS_REQUIRED(mu); // \ -// expected-error {{invalid use of non-static data member 'mu'}} +EXCLUSIVE_LOCKS_REQUIRED(mu); +#if __cplusplus <= 199711L +// expected-error@-2 {{invalid use of non-static data member 'mu'}} +#endif }; Index: test/SemaCXX/default-constructor-initializers.cpp === --- test/SemaCXX/default-constructor-initializers.cpp +++ test/SemaCXX/default-constructor-initializers.cpp @@ -1,26 +1,59 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s struct X1 { // has no implicit default constructor X1(int); }; -struct X2 : X1 { // expected-note 2 {{'X2' declared here}} - X2(int); -}; - -struct X3 : public X2 { // expected-error {{implicit default constructor for 'X3' must explicitly initialize the base class 'X2' which does not have a default constructor}} -}; -X3 x3; // expected-note {{first required here}} +struct X2 : X1 { +#if __cplusplus <= 199711L +// expected-note@-2 2 {{'X2' declared here}} +#endif - -struct X4 { // expected-error {{must explicitly initialize the member 'x2'}} \ -// expected-error {{must explicitly initialize the reference member 'rx2'}} - X2 x2; // expected-note {{member is declared here}} - X2 & rx2; // expected-note {{declared here}} + X2(int); }; -X4 x4; // expected-note {{first required here}} - +struct X3 : public X2 { +#if __cplusplus <= 199711L +// expected-error@-2 {{implicit default constructor for 'X3' must explicitly initialize the base class 'X2' which does not have a default constructor}} +#else +// expected-note@-4 {{default constructor of 'X3' is implicitly deleted because base class 'X2' has no default constructor}} +#endif +}; + +X3 x3; +#if __cplusplus <= 199711L +// expected-note@-2 {{first required here}} +#else +// expected-error@-4 {{call to implicitly-deleted default constructor of 'X3'}} +#endif + +struct X4 { +#if __cplusplus <= 199711L +// expected-error@-2 {{must explicitly initialize the member 'x2'}} +// expected-error@-3 {{must explicitly initialize the reference member 'rx2'}} +#endif + + X2 x2; +#if __cplusplus <= 199711L + // expected-note@-2 {{member is declared here}} +#else + // expected-note@-4 {{default constructor of 'X4' is implicitly deleted because field 'x2' has no default constructor}} +#endif + + X2 & rx2; +#if __cplusplus <= 199711L + // expected-note@-2 {{declared here}} +#endif +}; + +X4 x4; +#if __cplusplus <= 199711L +// expected-note@-2 {{first required here}} +#else +// expected-error@-4 {{call to implicitly-delete
[PATCH] D29739: Make Lit tests C++11 compatible - Objective-C++
tigerleapgorge reclaimed this revision. tigerleapgorge added a comment. @rjmccall - Hi John, I have reopened this patch. https://reviews.llvm.org/D29739 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29972: Make Lit tests C++11 compatible - accessible destructors
tigerleapgorge created this revision. Herald added a subscriber: mehdi_amini. I am continuing to make Lit tests C++11 compatible. This patch contains 2 tests previously in https://reviews.llvm.org/D20710. In both tests, I have made the base class destructors “protected” so they are accessible to derived classes. In C++11, an inaccessible destructor is considered implicitly deleted and this causes the following type of compilation errors. f.h:82:13: error: deleted function '~C3' cannot override a non-deleted function C3: ^ f.h:61:15: note: overridden virtual function is here virtual ~ ^ f.h:83:15: note: destructor of 'C3' is implicitly deleted because base class '(anonymous namespace)::AAA' has an inaccessible destructor AAA { ^ https://reviews.llvm.org/D29972 Files: test/CodeGenCXX/debug-info-use-after-free.cpp test/CodeGenCXX/dynamic-cast-hint.cpp Index: test/CodeGenCXX/dynamic-cast-hint.cpp === --- test/CodeGenCXX/dynamic-cast-hint.cpp +++ test/CodeGenCXX/dynamic-cast-hint.cpp @@ -1,7 +1,9 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin12 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin12 -emit-llvm -std=c++98 -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin12 -emit-llvm -std=c++11 -o - %s | FileCheck %s -class A { virtual ~A() {} }; -class B { virtual ~B() {} }; +class A { protected: virtual ~A() {} }; +class B { protected: virtual ~B() {} }; class C : A { char x; }; class D : public A { short y; }; Index: test/CodeGenCXX/debug-info-use-after-free.cpp === --- test/CodeGenCXX/debug-info-use-after-free.cpp +++ test/CodeGenCXX/debug-info-use-after-free.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -debug-info-kind=limited -triple %itanium_abi_triple -emit-llvm-only %s +// RUN: %clang_cc1 -debug-info-kind=limited -triple %itanium_abi_triple -emit-llvm-only -std=c++98 %s +// RUN: %clang_cc1 -debug-info-kind=limited -triple %itanium_abi_triple -emit-llvm-only -std=c++11 %s // Check that we don't crash. // PR12305, PR12315 @@ -233,6 +235,7 @@ namespace { class AAA { +protected: virtual ~ AAA () { }}; Index: test/CodeGenCXX/dynamic-cast-hint.cpp === --- test/CodeGenCXX/dynamic-cast-hint.cpp +++ test/CodeGenCXX/dynamic-cast-hint.cpp @@ -1,7 +1,9 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin12 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin12 -emit-llvm -std=c++98 -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin12 -emit-llvm -std=c++11 -o - %s | FileCheck %s -class A { virtual ~A() {} }; -class B { virtual ~B() {} }; +class A { protected: virtual ~A() {} }; +class B { protected: virtual ~B() {} }; class C : A { char x; }; class D : public A { short y; }; Index: test/CodeGenCXX/debug-info-use-after-free.cpp === --- test/CodeGenCXX/debug-info-use-after-free.cpp +++ test/CodeGenCXX/debug-info-use-after-free.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -debug-info-kind=limited -triple %itanium_abi_triple -emit-llvm-only %s +// RUN: %clang_cc1 -debug-info-kind=limited -triple %itanium_abi_triple -emit-llvm-only -std=c++98 %s +// RUN: %clang_cc1 -debug-info-kind=limited -triple %itanium_abi_triple -emit-llvm-only -std=c++11 %s // Check that we don't crash. // PR12305, PR12315 @@ -233,6 +235,7 @@ namespace { class AAA { +protected: virtual ~ AAA () { }}; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24812: Lit C++11 Compatibility Patch #11
tigerleapgorge updated this revision to Diff 88617. tigerleapgorge added a comment. Changed "CHECK11" to "CHECK11-NEXT". https://reviews.llvm.org/D24812 Files: test/CodeGenCXX/mangle-unnamed.cpp test/CodeGenCXX/static-init.cpp test/CodeGenCXX/volatile-1.cpp test/CodeGenCXX/volatile.cpp test/PCH/macro-undef.cpp Index: test/PCH/macro-undef.cpp === --- test/PCH/macro-undef.cpp +++ test/PCH/macro-undef.cpp @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -emit-pch -o %t %s -// RUN: %clang_cc1 -fsyntax-only -include-pch %t %s -Wuninitialized -verify -// RUN: %clang_cc1 -fsyntax-only -include-pch %t %s -Wuninitialized -fdiagnostics-parseable-fixits 2>&1 | FileCheck %s +// RUN: %clang_cc1 -std=c++98 -emit-pch -o %t %s +// RUN: %clang_cc1 -std=c++98 -fsyntax-only -include-pch %t %s -Wuninitialized -verify +// RUN: %clang_cc1 -std=c++98 -fsyntax-only -include-pch %t %s -Wuninitialized -fdiagnostics-parseable-fixits 2>&1 | FileCheck %s #ifndef HEADER #define HEADER Index: test/CodeGenCXX/volatile.cpp === --- test/CodeGenCXX/volatile.cpp +++ test/CodeGenCXX/volatile.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -std=c++98 -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -std=c++11 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK11 %s // Check that IR gen doesn't try to do an lvalue-to-rvalue conversion // on a volatile reference result. rdar://problem/8338198 @@ -27,6 +28,7 @@ // CHECK-LABEL: define void @_ZN5test14testEv() void test() { // CHECK: [[TMP:%.*]] = load i32*, i32** @_ZN5test11xE, align 8 +// CHECK11-NEXT: {{%.*}} = load volatile i32, i32* [[TMP]], align 4 // CHECK-NEXT: ret void *x; } Index: test/CodeGenCXX/volatile-1.cpp === --- test/CodeGenCXX/volatile-1.cpp +++ test/CodeGenCXX/volatile-1.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -Wno-unused-value -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -Wno-unused-value -triple %itanium_abi_triple -emit-llvm %s -std=c++98 -o - | FileCheck %s +// RUN: %clang_cc1 -Wno-unused-value -triple %itanium_abi_triple -emit-llvm %s -std=c++11 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK11 %s // CHECK: @i = global [[INT:i[0-9]+]] 0 volatile int i, j, k; @@ -22,18 +23,22 @@ asm("nop"); // CHECK: call void asm - // should not load + // should not load in C++98 i; + // CHECK11-NEXT: load volatile [[INT]], [[INT]]* @i (float)(ci); // CHECK-NEXT: load volatile [[INT]], [[INT]]* getelementptr inbounds ([[CINT]], [[CINT]]* @ci, i32 0, i32 0) // CHECK-NEXT: load volatile [[INT]], [[INT]]* getelementptr inbounds ([[CINT]], [[CINT]]* @ci, i32 0, i32 1) // CHECK-NEXT: sitofp [[INT]] - // These are not uses in C++: + // These are not uses in C++98: // [expr.static.cast]p6: // The lvalue-to-rvalue . . . conversions are not applied to the expression. (void)ci; + // CHECK11-NEXT: load volatile [[INT]], [[INT]]* getelementptr inbounds ([[CINT]], [[CINT]]* @ci, i32 0, i32 0) + // CHECK11-NEXT: load volatile [[INT]], [[INT]]* getelementptr inbounds ([[CINT]], [[CINT]]* @ci, i32 0, i32 1) + (void)a; (void)(ci=ci); @@ -126,7 +131,8 @@ // CHECK-NEXT: load volatile // CHECK-NEXT: sitofp - (void)i; + (void)i; // This is now a load in C++11 + // CHECK11-NEXT: load volatile i=i; // CHECK-NEXT: load volatile @@ -155,25 +161,30 @@ // CHECK-NEXT: br label // CHECK: phi - (void)(i,(i=i)); + (void)(i,(i=i)); // first i is also a load in C++11 + // CHECK11-NEXT: load volatile // CHECK-NEXT: load volatile // CHECK-NEXT: store volatile - i=i,k; + i=i,k; // k is also a load in C++11 // CHECK-NEXT: load volatile [[INT]], [[INT]]* @i // CHECK-NEXT: store volatile {{.*}}, [[INT]]* @i + // CHECK11-NEXT: load volatile [[INT]], [[INT]]* @k (i=j,k=j); // CHECK-NEXT: load volatile [[INT]], [[INT]]* @j // CHECK-NEXT: store volatile {{.*}}, [[INT]]* @i // CHECK-NEXT: load volatile [[INT]], [[INT]]* @j // CHECK-NEXT: store volatile {{.*}}, [[INT]]* @k - (i=j,k); + (i=j,k); // k is also a load in C++11 // CHECK-NEXT: load volatile [[INT]], [[INT]]* @j // CHECK-NEXT: store volatile {{.*}}, [[INT]]* @i + // CHECK11-NEXT: load volatile [[INT]], [[INT]]* @k - (i,j); + (i,j); // i and j both are loads in C++11 + // CHECK11-NEXT: load volatile [[INT]], [[INT]]* @i + // CHECK11-NEXT: load volatile [[INT]], [[INT]]* @j // Extra load in C++. i=c=k; @@ -190,7 +201,9 @@ // CHECK-NEXT: add nsw [[INT]] // CHECK-NEXT: store volatile - ci; + ci; // ci is a load in C++11 + // CHECK11-NEXT: load volatile {{.*}} @ci, i32 0, i32 0 + // C
[PATCH] D24812: Lit C++11 Compatibility Patch #11
tigerleapgorge added a comment. @rjmccall Hi John, I've made the changes to volatile.cpp. I take it this patch is good for commit? https://reviews.llvm.org/D24812 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29685: Lit C++11 Compatibility - Function Attributes
tigerleapgorge accepted this revision. tigerleapgorge added a comment. This revision is now accepted and ready to land. Of the 3 tests. format-strings.cpp and printf-cstr.cpp have been commited in r294979 For warn-thread-safety-parsing.cpp, bug 32066 has been filed to track the lack of thread safety errors in C++11 Closing out this code review. https://reviews.llvm.org/D29685 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29972: Make Lit tests C++11 compatible - accessible destructors
tigerleapgorge abandoned this revision. tigerleapgorge added a comment. https://reviews.llvm.org/D20710 is a superset of this patch. https://reviews.llvm.org/D20710 has been committed in https://reviews.llvm.org/rL296184. No need for this patch. https://reviews.llvm.org/D29972 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D21626: Lit C++11 Compatibility Patch #10
tigerleapgorge updated this revision to Diff 89736. tigerleapgorge added a comment. Updated patch in accordance to Richard Smith's comments. https://reviews.llvm.org/D21626 Files: test/Modules/Inputs/merge-using-decls/b.h test/Modules/merge-using-decls.cpp test/SemaCXX/PR9572.cpp test/SemaCXX/default-assignment-operator.cpp test/SemaCXX/default-constructor-initializers.cpp test/SemaCXX/warn-thread-safety-parsing.cpp Index: test/SemaCXX/warn-thread-safety-parsing.cpp === --- test/SemaCXX/warn-thread-safety-parsing.cpp +++ test/SemaCXX/warn-thread-safety-parsing.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -std=c++11 %s #define LOCKABLE__attribute__ ((lockable)) #define SCOPED_LOCKABLE __attribute__ ((scoped_lockable)) @@ -1266,8 +1268,11 @@ void foo3(FooLate *f) EXCLUSIVE_LOCKS_REQUIRED(f->mu) { } void foo4(FooLate *f) EXCLUSIVE_LOCKS_REQUIRED(f->mu); - static void foo5()EXCLUSIVE_LOCKS_REQUIRED(mu); // \ -// expected-error {{invalid use of member 'mu' in static member function}} + static void foo5()EXCLUSIVE_LOCKS_REQUIRED(mu); +//FIXME: Bug 32066 - Error should be emitted irrespective of C++ dialect +#if __cplusplus <= 199711L + // expected-error@-3 {{invalid use of member 'mu' in static member function}} +#endif template void foo6() EXCLUSIVE_LOCKS_REQUIRED(T::statmu) { } @@ -1461,15 +1466,24 @@ mutable Mutex mu; int a GUARDED_BY(mu); - static int si GUARDED_BY(mu); // \ -// expected-error {{invalid use of non-static data member 'mu'}} + static int si GUARDED_BY(mu); +//FIXME: Bug 32066 - Error should be emitted irrespective of C++ dialect +#if __cplusplus <= 199711L + // expected-error@-3 {{invalid use of non-static data member 'mu'}} +#endif - static void foo() EXCLUSIVE_LOCKS_REQUIRED(mu); // \ -// expected-error {{invalid use of member 'mu' in static member function}} + static void foo() EXCLUSIVE_LOCKS_REQUIRED(mu); +//FIXME: Bug 32066 - Error should be emitted irrespective of C++ dialect +#if __cplusplus <= 199711L + // expected-error@-3 {{invalid use of member 'mu' in static member function}} +#endif friend FooStream& operator<<(FooStream& s, const Foo& f) -EXCLUSIVE_LOCKS_REQUIRED(mu); // \ -// expected-error {{invalid use of non-static data member 'mu'}} +EXCLUSIVE_LOCKS_REQUIRED(mu); +//FIXME: Bug 32066 - Error should be emitted irrespective of C++ dialect +#if __cplusplus <= 199711L +// expected-error@-3 {{invalid use of non-static data member 'mu'}} +#endif }; Index: test/SemaCXX/default-constructor-initializers.cpp === --- test/SemaCXX/default-constructor-initializers.cpp +++ test/SemaCXX/default-constructor-initializers.cpp @@ -1,26 +1,59 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s struct X1 { // has no implicit default constructor X1(int); }; -struct X2 : X1 { // expected-note 2 {{'X2' declared here}} - X2(int); -}; - -struct X3 : public X2 { // expected-error {{implicit default constructor for 'X3' must explicitly initialize the base class 'X2' which does not have a default constructor}} -}; -X3 x3; // expected-note {{first required here}} +struct X2 : X1 { +#if __cplusplus <= 199711L +// expected-note@-2 2 {{'X2' declared here}} +#endif - -struct X4 { // expected-error {{must explicitly initialize the member 'x2'}} \ -// expected-error {{must explicitly initialize the reference member 'rx2'}} - X2 x2; // expected-note {{member is declared here}} - X2 & rx2; // expected-note {{declared here}} + X2(int); }; -X4 x4; // expected-note {{first required here}} - +struct X3 : public X2 { +#if __cplusplus <= 199711L +// expected-error@-2 {{implicit default constructor for 'X3' must explicitly initialize the base class 'X2' which does not have a default constructor}} +#else +// expected-note@-4 {{default constructor of 'X3' is implicitly deleted because base class 'X2' has no default constructor}} +#endif +}; + +X3 x3; +#if __cplusplus <= 199711L +// expected-note@-2 {{first required here}} +#else +// expected-error@-4 {{call to implicitly-deleted default constructor of 'X3'}} +#endif + +struct X4 { +#if __cplusplus <= 199711L +// expected-error@-2 {{must explicitly initialize the member 'x2'}} +// expected-error@-3 {{must explicitly initialize the reference member 'rx2'}} +#endif + + X2 x2; +#if __cplusplus <= 199711L + // expected-note@-2 {{member is declared here}} +#else + // expected-note@-4 {{default constructor of 'X4' is implicitly deleted because field 'x2' has no default constructor}} +#endif + + X2 & rx2; +#if __cplusplus <= 19
[PATCH] D21626: Lit C++11 Compatibility Patch #10
tigerleapgorge marked 2 inline comments as done. tigerleapgorge added inline comments. Comment at: test/SemaCXX/PR9572.cpp:34 +// expected-error@-2 {{non-deleted function '~Bar' cannot override a deleted function}} +// expected-note@-3 {{while declaring the implicit destructor for 'Bar'}} +#endif Clang added this note quite recently. https://reviews.llvm.org/D21626 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29685: Lit C++11 Compatibility - Function Attributes
tigerleapgorge closed this revision. tigerleapgorge added a comment. warn-thread-safety-parsing.cpp has been commited in https://reviews.llvm.org/rL296193. The following FIXME has been added to track this bug. //FIXME: Bug 32066 - Error should be emitted irrespective of C++ dialect https://reviews.llvm.org/D29685 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D30430: Make Lit tests C++11 compatible - IR ordering
tigerleapgorge created this revision. This test failure is caused by difference in IR ordering when compiling at C++98 vs C++11 Because there was a CHECK-NOT between the two CHECKs, just changing the CHECKs to CHECK-DAG would not work. So to make FileCheck more flexible. I have changed the CHECK to CHECK-DAG. I have changed CHECK-NOT to go under a new check-prefix CHECK2 so they are CHECK2-NOT. IR in C++98 @_ZN5test022implicit_instantiationE = global %"struct.test0::stdio_sync_filebuf.2" zeroinitializer, align 8 @__dso_handle = external hidden global i8 @_ZN7PR100011xE = global i32 0, align 4 @_ZTVN5test018stdio_sync_filebufIA3_iEE = weak_odr unnamed_addr constant { [5 x i8*] } { [5 x i8*] [i8* null, i8* bitcast ({ i8*, i8*, i8* }* @_ZTIN5test018stdio_sync_filebufIA3_iEE to i8*), i8* bitcast (void (%"struct.test0::stdio_sync_filebuf.1"*)* @_ZN5test018stdio_sync_filebufIA3_iED1Ev to i8*), i8* bitcast (void (%"struct.test0::stdio_sync_filebuf.1"*)* @_ZN5test018stdio_sync_filebufIA3_iED0Ev to i8*), i8* bitcast (void (%"struct.test0::stdio_sync_filebuf.1"*)* @_ZN5test018stdio_sync_filebufIA3_iE6xsgetnEv to i8*)] }, align 8 @_ZTVN10__cxxabiv120__si_class_type_infoE = external global i8* @_ZTSN5test018stdio_sync_filebufIA3_iEE = weak_odr constant [35 x i8] c"N5test018stdio_sync_filebufIA3_iEE\00" @_ZTIN5test015basic_streambufE = external constant i8* @_ZTIN5test018stdio_sync_filebufIA3_iEE = weak_odr constant { i8*, i8*, i8* } { i8* bitcast (i8** getelementptr inbounds (i8*, i8** @_ZTVN10__cxxabiv120__si_class_type_infoE, i64 2) to i8*), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @_ZTSN5test018stdio_sync_filebufIA3_iEE, i32 0, i32 0), i8* bitcast (i8** @_ZTIN5test015basic_streambufE to i8*) } @_ZN7PR100011SIiE3arrE = linkonce_odr global [3 x i32] zeroinitializer, align 4 @_ZGVN7PR100011SIiE3arrE = linkonce_odr global i64 0, align 8 @_ZTVN5test018stdio_sync_filebufIA4_iEE = linkonce_odr unnamed_addr constant { [5 x i8*] } { [5 x i8*] [i8* null, i8* bitcast ({ i8*, i8*, i8* }* @_ZTIN5test018stdio_sync_filebufIA4_iEE to i8*), i8* bitcast (void (%"struct.test0::stdio_sync_filebuf.2"*)* @_ZN5test018stdio_sync_filebufIA4_iED1Ev to i8*), i8* bitcast (void (%"struct.test0::stdio_sync_filebuf.2"*)* @_ZN5test018stdio_sync_filebufIA4_iED0Ev to i8*), i8* bitcast (void (%"struct.test0::stdio_sync_filebuf.2"*)* @_ZN5test018stdio_sync_filebufIA4_iE6xsgetnEv to i8*)] }, align 8 @_ZTSN5test018stdio_sync_filebufIA4_iEE = linkonce_odr constant [35 x i8] c"N5test018stdio_sync_filebufIA4_iEE\00" @_ZTIN5test018stdio_sync_filebufIA4_iEE = linkonce_odr constant { i8*, i8*, i8* } { i8* bitcast (i8** getelementptr inbounds (i8*, i8** @_ZTVN10__cxxabiv120__si_class_type_infoE, i64 2) to i8*), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @_ZTSN5test018stdio_sync_filebufIA4_iEE, i32 0, i32 0), i8* bitcast (i8** @_ZTIN5test015basic_streambufE to i8*) } @_ZTVN5test015basic_streambufE = available_externally unnamed_addr constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* bitcast (i8** @_ZTIN5test015basic_streambufE to i8*), i8* bitcast (void (%"struct.test0::basic_streambuf"*)* @_ZN5test015basic_streambufD1Ev to i8*), i8* bitcast (void (%"struct.test0::basic_streambuf"*)* @_ZN5test015basic_streambufD0Ev to i8*)] }, align 8 @_ZTVN5test21CIiEE = available_externally unnamed_addr constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* bitcast (i8** @_ZTIN5test21CIiEE to i8*), i8* bitcast (void (%"class.test2::C"*)* @_ZN5test21CIiED1Ev to i8*), i8* bitcast (void (%"class.test2::C"*)* @_ZN5test21CIiED0Ev to i8*)] }, align 8 @_ZTIN5test21CIiEE = external constant i8* @llvm.global_ctors = appending global [2 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @__cxx_global_var_init.2, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__sub_I_template_instantiation.cpp, i8* null }] IR in C++11 @_ZTVN5test018stdio_sync_filebufIA4_iEE = linkonce_odr unnamed_addr constant { [5 x i8*] } { [5 x i8*] [i8* null, i8* bitcast ({ i8*, i8*, i8* }* @_ZTIN5test018stdio_sync_filebufIA4_iEE to i8*), i8* bitcast (void (%"struct.test0::stdio_sync_filebuf.2"*)* @_ZN5test018stdio_sync_filebufIA4_iED1Ev to i8*), i8* bitcast (void (%"struct.test0::stdio_sync_filebuf.2"*)* @_ZN5test018stdio_sync_filebufIA4_iED0Ev to i8*), i8* bitcast (void (%"struct.test0::stdio_sync_filebuf.2"*)* @_ZN5test018stdio_sync_filebufIA4_iE6xsgetnEv to i8*)] }, align 8 @_ZN5test022implicit_instantiationE = global { i8** } { i8** getelementptr inbounds ({ [5 x i8*] }, { [5 x i8*] }* @_ZTVN5test018stdio_sync_filebufIA4_iEE, i32 0, inrange i32 0, i32 2) }, align 8 @__dso_handle = external hidden global i8 @_ZN7PR100011xE = global i32 0, align 4 @_ZTVN5test018stdio_sync_filebufIA3_iEE = weak_odr unnamed_addr constant { [5 x i8*] } { [5 x i8*] [i8* null, i8* bitcast ({ i8*, i8*, i8* }* @_ZTIN5test018stdio_sync_filebufIA3_iEE to i8*), i8* bitcast (void (%"struct.test0::stdio_sync_filebuf.1"*)* @_ZN5test018
[PATCH] D30430: Make Lit tests C++11 compatible - IR ordering
tigerleapgorge updated this revision to Diff 90078. tigerleapgorge added a comment. Updated patch. Test only runs in C++11. Added comments to explain CHECK-DAG and CHECK2-NOT. https://reviews.llvm.org/D30430 Files: test/CodeGenCXX/template-instantiation.cpp Index: test/CodeGenCXX/template-instantiation.cpp === --- test/CodeGenCXX/template-instantiation.cpp +++ test/CodeGenCXX/template-instantiation.cpp @@ -1,21 +1,22 @@ -// RUN: %clang_cc1 %s -O1 -disable-llvm-passes -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -O1 -disable-llvm-passes -triple=x86_64-apple-darwin10 -std=c++11 -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -O1 -disable-llvm-passes -triple=x86_64-apple-darwin10 -std=c++11 -emit-llvm -o - | FileCheck %s --check-prefix=CHECK2 -// CHECK: @_ZN7PR100011xE = global -// CHECK-NOT: @_ZN7PR100014kBarE = external global i32 -// -// CHECK-NOT: @_ZTVN5test118stdio_sync_filebufIwEE = constant -// CHECK-NOT: _ZTVN5test315basic_fstreamXXIcEE -// CHECK-NOT: @_ZTVN5test018stdio_sync_filebufIA1_iEE -// CHECK-NOT: @_ZTVN5test018stdio_sync_filebufIA2_iEE -// CHECK: @_ZTVN5test018stdio_sync_filebufIA3_iEE = weak_odr unnamed_addr constant +// Instantiation order varies on different C++ dialects (IE, between C++98 and C++11). +// CHECK-DAG: @_ZN7PR100011xE = global +// CHECK-DAG: @_ZTVN5test018stdio_sync_filebufIA3_iEE = weak_odr unnamed_addr constant +// CHECK-DAG: @_ZN7PR100011SIiE3arrE = linkonce_odr global [3 x i32] +// CHECK-DAG: @_ZTVN5test018stdio_sync_filebufIA4_iEE = linkonce_odr unnamed_addr constant + +// Negative checks go under prefix "CHECK2" to avoid interference with CHECK and CHECK-DAG. +// CHECK2-NOT: @_ZN7PR100014kBarE = external global i32 +// CHECK2-NOT: @_ZTVN5test118stdio_sync_filebufIwEE = constant +// CHECK2-NOT: _ZTVN5test315basic_fstreamXXIcEE +// CHECK2-NOT: @_ZTVN5test018stdio_sync_filebufIA1_iEE +// CHECK2-NOT: @_ZTVN5test018stdio_sync_filebufIA2_iEE +// CHECK2-NOT: @_ZN7PR100011SIiE3arr2E = linkonce_odr global [3 x i32]A -// CHECK: @_ZN7PR100011SIiE3arrE = linkonce_odr global [3 x i32] -// CHECK-NOT: @_ZN7PR100011SIiE3arr2E = linkonce_odr global [3 x i32]A - -// CHECK: @_ZTVN5test018stdio_sync_filebufIA4_iEE = linkonce_odr unnamed_addr constant - -// CHECK-NOT: _ZTVN5test31SIiEE -// CHECK-NOT: _ZTSN5test31SIiEE +// CHECK2-NOT: _ZTVN5test31SIiEE +// CHECK2-NOT: _ZTSN5test31SIiEE // CHECK-LABEL: define linkonce_odr void @_ZN5test21CIiEC1Ev(%"class.test2::C"* %this) unnamed_addr // CHECK-LABEL: define linkonce_odr void @_ZN5test21CIiE6foobarIdEEvT_( @@ -152,7 +153,7 @@ void f () {} }; // Should not instantiate class B since it is introduced in namespace scope. -// CHECK-NOT: _ZN6PR85051AILi0EE1B1fEv +// CHECK2-NOT: _ZN6PR85051AILi0EE1B1fEv template class A<0>; } Index: test/CodeGenCXX/template-instantiation.cpp === --- test/CodeGenCXX/template-instantiation.cpp +++ test/CodeGenCXX/template-instantiation.cpp @@ -1,21 +1,22 @@ -// RUN: %clang_cc1 %s -O1 -disable-llvm-passes -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -O1 -disable-llvm-passes -triple=x86_64-apple-darwin10 -std=c++11 -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -O1 -disable-llvm-passes -triple=x86_64-apple-darwin10 -std=c++11 -emit-llvm -o - | FileCheck %s --check-prefix=CHECK2 -// CHECK: @_ZN7PR100011xE = global -// CHECK-NOT: @_ZN7PR100014kBarE = external global i32 -// -// CHECK-NOT: @_ZTVN5test118stdio_sync_filebufIwEE = constant -// CHECK-NOT: _ZTVN5test315basic_fstreamXXIcEE -// CHECK-NOT: @_ZTVN5test018stdio_sync_filebufIA1_iEE -// CHECK-NOT: @_ZTVN5test018stdio_sync_filebufIA2_iEE -// CHECK: @_ZTVN5test018stdio_sync_filebufIA3_iEE = weak_odr unnamed_addr constant +// Instantiation order varies on different C++ dialects (IE, between C++98 and C++11). +// CHECK-DAG: @_ZN7PR100011xE = global +// CHECK-DAG: @_ZTVN5test018stdio_sync_filebufIA3_iEE = weak_odr unnamed_addr constant +// CHECK-DAG: @_ZN7PR100011SIiE3arrE = linkonce_odr global [3 x i32] +// CHECK-DAG: @_ZTVN5test018stdio_sync_filebufIA4_iEE = linkonce_odr unnamed_addr constant + +// Negative checks go under prefix "CHECK2" to avoid interference with CHECK and CHECK-DAG. +// CHECK2-NOT: @_ZN7PR100014kBarE = external global i32 +// CHECK2-NOT: @_ZTVN5test118stdio_sync_filebufIwEE = constant +// CHECK2-NOT: _ZTVN5test315basic_fstreamXXIcEE +// CHECK2-NOT: @_ZTVN5test018stdio_sync_filebufIA1_iEE +// CHECK2-NOT: @_ZTVN5test018stdio_sync_filebufIA2_iEE +// CHECK2-NOT: @_ZN7PR100011SIiE3arr2E = linkonce_odr global [3 x i32]A -// CHECK: @_ZN7PR100011SIiE3arrE = linkonce_odr global [3 x i32] -// CHECK-NOT: @_ZN7PR100011SIiE3arr2E = linkonce_odr global [3 x i32]A - -// CHECK: @_ZTVN5test018stdio_sync_filebufIA4_iEE = linkonce_odr unnamed_addr constant - -// CHECK-NOT: _ZTVN5test31SIiEE -// CHE
[PATCH] D30430: Make Lit tests C++11 compatible - IR ordering
tigerleapgorge added a comment. In https://reviews.llvm.org/D30430#688146, @rjmccall wrote: > The C++98 behavior here is not really vital to test precisely; it's just > minor differences in what gets instantiated and when. Hi John, my main concern with CHECK-NOT appearing between CHECK lines is that it makes the test brittle to the order of the IR. For this reason I have separated out the CHECK-NOTs to go under a seperate prefix with a separate RUN line. If you would like to old way of a single RUN line, I can do that too. > I think it's fine to just update the run line to -std=c++11 for things like > this. Done. I have deleted C++98 RUN lines and default (no -std) RUN lines. > But if you really want to test both configurations, this LGTM, although > please leave a comment in the test explaining that it's just trying to > account for differences in instantiation order between C++98 and C++11. I have added 2 lines of comments. One explains why CHECK-DAG is used instead of CHECK. Another explains why CHECK2-NOT is used instead of CHECK-NOT https://reviews.llvm.org/D30430 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits