[PATCH] D24812: Lit C++11 Compatibility Patch #11
tigerleapgorge created this revision. tigerleapgorge added a reviewer: rsmith. tigerleapgorge added a subscriber: cfe-commits. Herald added a subscriber: aemerson. Hi Everyone, Here is the 11th Lit C++11 compatibility patch. This will most likely be my final Lit patch. I have updated 16 tests this time. Here are the explanations for each test. CodeGenCXX/exceptions.cpp Implicit destructors are noexcept (nothrow) in C++11. The LLVM IR invocation for these destructors changed from “invoke” to “call”. This is related to C++11’s standard 15.4\14 and 15.4\15 in [except.spec] In C++11, Clang marks implicit destructors as “nothrow” in the AST and “nounwind” in the LLVM IR. [except.spec] 15.4\14 An implicitly declared special member function shall have an exception-specification. If f is an implicitly declared default constructor, copy constructor, move constructor, destructor, copy assignment operator, or move assignment operator, its implicit exception-specification specifies the type-id T if and only if T is allowed by the exception-specification of a function directly invoked by f’s implicit definition; f shall allow all exceptions if any function it directly invokes allows all exceptions, and f shall allow no exceptions if every function it directly invokes allows no exceptions. [except.spec] 15.4\15 A deallocation function (3.7.4.2) with no explicit exception-specification is treated as if it were specified with noexcept(true). IR changes are as follows: test1::B::~B() is nothrow in C++11. IR for its invocation changed from invoke to call. C++98: invoke void @_ZN5test11BD1Ev(%"struct.test1::B"* %temp.lvalue) C++98: to label %invoke.cont4 unwind label %terminate.lpad C++11: call void @_ZN5test11BD1Ev(%"struct.test1::B"* %temp.lvalue) #8 The landing pad and its associated attribute no longer exists in C++11. C++98: ; Function Attrs: noinline noreturn nounwind C++98: define linkonce_odr hidden void @__clang_call_terminate(i8*) #4 comdat { C++98:%2 = call i8* @__cxa_begin_catch(i8* %0) #8 C++98:call void @_ZSt9terminatev() #12 C++98:unreachable C++98: } C++98: attributes #4 = { noinline noreturn nounwind } C++11: test2::A::operator delete(void*, unsigned long) is nothrow in C++11. test3::A::operator delete(void*, void*, double) is nothrow in C++11. test5::T::~T() is nothrow in C++11. test7::A::~A() is nothrow in C++11. test10::C::~C() is nothrow in C++11. test11::A::~A() is nothrow in C++11 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. However, in C++11, “longs” and “short”’s destructors are noexcept (nothrow). ~std::_Vector_base >() noexcept ~std::_Vector_base >() noexcept Because these destructors no longer throw any exceptions in C++11, there is no need to generate the landingpads. And since the purpose of this test is to verify for landingpad line table, I have restricted this test to C++98. CodeGenCXX/mangle-unnamed.cpp Test section f6() verifies the mangled name of the variable b that is inside the static anonymous union along with an anonymous union of a unnamed bit field. Running this test in C++11 results in the following error. error: call to implicitly-deleted default constructor of '(anonymous union at t.cpp:2:10)' note: default constructor of '' is implicitly deleted because field '' has a deleted default constructor note: default constructor of '' is implicitly deleted because all data members are const-qualified This is most likely due to interaction between three parts of the C++11 standard: 1. Unnamed bit-field cannot be initialized. C++ Standard section 9.6.2 [class.bit] A declaration for a bit-field that omits the identifier declares an unnamed bit-field. Unnamed bit-fields are not members and cannot be initialized. 2. Introduction of keyword “delete”. 3. Change in rules regarding Unions. http://www.stroustrup.com/C++11FAQ.html#unions If a union has a member with a user-defined constructor, copy, or destructor then that special function is deleted; that is, it cannot be used for an object of the union type. This is new. For f6(), Since the unnamed bitfield “int : 1;” can not be initialized, its constructor is considered “deleted”, therefore it cannot be used inside a union. Hence f6() would be an invalid test for C++11. Since this test verifies for name managling, I have restricted f6() to C++98. CodeGenCXX/arm.cpp test3::A::~A() is noexcept (nothrow) in C++11. LLVM IR invocation for this destructor has changed from “invoke” to “call”. CodeGenCXX/eh-aggregate-copy-des
r291458 - [Lit Test] Make tests C++11 compatible - nothrow destructors
Author: lcharles Date: Mon Jan 9 12:24:16 2017 New Revision: 291458 URL: http://llvm.org/viewvc/llvm-project?rev=291458&view=rev Log: [Lit Test] Make tests C++11 compatible - nothrow destructors In C++11, a destructor's implicit exception-spec is nothrow. The IR for the destructor's invocation changed from invoke to call. Differential Revision: https://reviews.llvm.org/D28425 Modified: cfe/trunk/test/CodeGenCXX/arm.cpp cfe/trunk/test/CodeGenCXX/debug-info-class.cpp cfe/trunk/test/CodeGenCXX/eh-aggregate-copy-destroy.cpp cfe/trunk/test/CodeGenCXX/exceptions.cpp cfe/trunk/test/CodeGenCXX/goto.cpp cfe/trunk/test/OpenMP/atomic_codegen.cpp cfe/trunk/test/OpenMP/threadprivate_codegen.cpp Modified: cfe/trunk/test/CodeGenCXX/arm.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/arm.cpp?rev=291458&r1=291457&r2=291458&view=diff == --- cfe/trunk/test/CodeGenCXX/arm.cpp (original) +++ cfe/trunk/test/CodeGenCXX/arm.cpp Mon Jan 9 12:24:16 2017 @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 %s -triple=thumbv7-apple-ios6.0 -fno-use-cxa-atexit -target-abi apcs-gnu -emit-llvm -o - -fexceptions | FileCheck %s +// RUN: %clang_cc1 %s -triple=thumbv7-apple-ios6.0 -fno-use-cxa-atexit -target-abi apcs-gnu -emit-llvm -std=gnu++98 -o - -fexceptions | FileCheck -check-prefix=CHECK -check-prefix=CHECK98 %s +// RUN: %clang_cc1 %s -triple=thumbv7-apple-ios6.0 -fno-use-cxa-atexit -target-abi apcs-gnu -emit-llvm -std=gnu++11 -o - -fexceptions | FileCheck -check-prefix=CHECK -check-prefix=CHECK11 %s // CHECK: @_ZZN5test74testEvE1x = internal global i32 0, align 4 // CHECK: @_ZGVZN5test74testEvE1x = internal global i32 0 @@ -156,7 +157,8 @@ namespace test3 { // CHECK: getelementptr {{.*}}, i32 4 // CHECK: bitcast {{.*}} to i32* // CHECK: load -// CHECK: invoke {{.*}} @_ZN5test31AD1Ev +// CHECK98: invoke {{.*}} @_ZN5test31AD1Ev +// CHECK11: call {{.*}} @_ZN5test31AD1Ev // CHECK: call void @_ZdaPv delete [] x; } @@ -168,7 +170,8 @@ namespace test3 { // CHECK: getelementptr {{.*}}, i32 4 // CHECK: bitcast {{.*}} to i32* // CHECK: load -// CHECK: invoke {{.*}} @_ZN5test31AD1Ev +// CHECK98: invoke {{.*}} @_ZN5test31AD1Ev +// CHECK11: call {{.*}} @_ZN5test31AD1Ev // CHECK: call void @_ZdaPv delete [] x; } Modified: cfe/trunk/test/CodeGenCXX/debug-info-class.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-class.cpp?rev=291458&r1=291457&r2=291458&view=diff == --- cfe/trunk/test/CodeGenCXX/debug-info-class.cpp (original) +++ cfe/trunk/test/CodeGenCXX/debug-info-class.cpp Mon Jan 9 12:24:16 2017 @@ -83,12 +83,17 @@ int main(int argc, char **argv) { return 0; } -// RUN: %clang_cc1 -triple x86_64-unknown_unknown -emit-llvm -debug-info-kind=limited -fexceptions %s -o - | FileCheck %s -// RUN: %clang_cc1 -triple i686-cygwin -emit-llvm -debug-info-kind=limited -fexceptions %s -o - | FileCheck %s -// RUN: %clang_cc1 -triple armv7l-unknown-linux-gnueabihf -emit-llvm -debug-info-kind=limited -fexceptions %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-unknown_unknown -emit-llvm -debug-info-kind=limited -fexceptions -std=c++98 %s -o - | FileCheck -check-prefix=CHECK98 %s +// RUN: %clang_cc1 -triple i686-cygwin -emit-llvm -debug-info-kind=limited -fexceptions -std=c++98 %s -o - | FileCheck -check-prefix=CHECK98 %s +// RUN: %clang_cc1 -triple armv7l-unknown-linux-gnueabihf -emit-llvm -debug-info-kind=limited -fexceptions -std=c++98 %s -o - | FileCheck -check-prefix=CHECK98 %s +// RUN: %clang_cc1 -triple x86_64-unknown_unknown -emit-llvm -debug-info-kind=limited -fexceptions -std=c++11 %s -o - | FileCheck -check-prefix=CHECK11 %s +// RUN: %clang_cc1 -triple i686-cygwin -emit-llvm -debug-info-kind=limited -fexceptions -std=c++11 %s -o - | FileCheck -check-prefix=CHECK11 %s +// RUN: %clang_cc1 -triple armv7l-unknown-linux-gnueabihf -emit-llvm -debug-info-kind=limited -fexceptions -std=c++11 %s -o - | FileCheck -check-prefix=CHECK11 %s + +// CHECK98: invoke {{.+}} @_ZN1BD1Ev(%class.B* %b) +// CHECK98-NEXT: unwind label %{{.+}}, !dbg ![[EXCEPTLOC:.*]] +// CHECK11: call {{.+}} @_ZN1BD1Ev(%class.B* %b){{.*}}, !dbg ![[EXCEPTLOC:.*]] -// CHECK: invoke {{.+}} @_ZN1BD1Ev(%class.B* %b) -// CHECK-NEXT: unwind label %{{.+}}, !dbg ![[EXCEPTLOC:.*]] // CHECK: store i32 0, i32* %{{.+}}, !dbg ![[RETLOC:.*]] // CHECK: [[F:![0-9]*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "F" Modified: cfe/trunk/test/CodeGenCXX/eh-aggregate-copy-destroy.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/eh-aggregate-copy-destroy.cpp?rev=291458&r1=291457&r2=291458&view=diff == --- cfe/trunk/test/CodeGenCXX/eh-aggregate-copy-destroy.cpp
r294025 - [Lit Test] Make tests C++11 compatible - OpenMP constant expressions
Author: lcharles Date: Fri Feb 3 12:58:34 2017 New Revision: 294025 URL: http://llvm.org/viewvc/llvm-project?rev=294025&view=rev Log: [Lit Test] Make tests C++11 compatible - OpenMP constant expressions C++11 introduced constexpr, hence the change in diagnostics. Differential Revision: https://reviews.llvm.org/D29480 Modified: cfe/trunk/test/OpenMP/distribute_collapse_messages.cpp cfe/trunk/test/OpenMP/ordered_messages.cpp cfe/trunk/test/OpenMP/target_parallel_for_collapse_messages.cpp cfe/trunk/test/OpenMP/target_parallel_for_ordered_messages.cpp Modified: cfe/trunk/test/OpenMP/distribute_collapse_messages.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/distribute_collapse_messages.cpp?rev=294025&r1=294024&r2=294025&view=diff == --- cfe/trunk/test/OpenMP/distribute_collapse_messages.cpp (original) +++ cfe/trunk/test/OpenMP/distribute_collapse_messages.cpp Fri Feb 3 12:58:34 2017 @@ -1,8 +1,13 @@ // 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() { } +#if __cplusplus >= 201103L + // expected-note@+2 4 {{declared here}} +#endif bool foobool(int argc) { return argc; } @@ -29,6 +34,9 @@ T tmain(T argc, S **argv) { //expected-n for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; #pragma omp distribute collapse ((ST > 0) ? 1 + ST : 2) // expected-note 2 {{as specified in 'collapse' 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 distribute', 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 distribute' cannot contain more than one 'collapse' clause}} // expected-error@+2 2 {{argument to 'collapse' clause must be a strictly positive integer value}} // expected-error@+1 2 {{expression is not an integral constant expression}} @@ -36,7 +44,11 @@ T tmain(T argc, S **argv) { //expected-n for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; #pragma omp distribute collapse (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 <= 199711L + // expected-error@+4 2 {{expression is not an integral constant expression}} +#else + // expected-error@+2 2 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}} +#endif #pragma omp distribute collapse (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]; #pragma omp distribute collapse (1) @@ -59,8 +71,14 @@ int main(int argc, char **argv) { 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 distribute', but found only 1}} #pragma omp distribute collapse (2+2)) // expected-warning {{extra tokens at the end of '#pragma omp distribute' are ignored}} expected-note {{as specified in 'collapse' 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 distribute', but found only 1}} +#if __cplusplus >= 201103L + // expected-note@+2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} +#endif #pragma omp distribute collapse (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 distribute' cannot contain more than one 'collapse' clause}} // expected-error@+1 2 {{argument to 'collapse' clause must be a strictly positive integer value}} @@ -68,7 +86,11 @@ int main(int argc, char **argv) { for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; #pragma omp distribute collapse (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 <= 199711L + // expected-error@+4 {{expression is not an integral constant expression}} +#else + // expected-error@+2 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}} +#endif #pragma omp distrib
r294225 - [Lit Test] Make tests C++11 compatible - Microsoft diagnostics
Author: lcharles Date: Mon Feb 6 13:32:38 2017 New Revision: 294225 URL: http://llvm.org/viewvc/llvm-project?rev=294225&view=rev Log: [Lit Test] Make tests C++11 compatible - Microsoft diagnostics Differential Revision: https://reviews.llvm.org/D29520 Modified: cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp cfe/trunk/test/SemaCXX/implicit-virtual-member-functions.cpp cfe/trunk/test/SemaCXX/virtual-base-used.cpp cfe/trunk/test/SemaTemplate/virtual-member-functions.cpp Modified: cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp?rev=294225&r1=294224&r2=294225&view=diff == --- cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp (original) +++ cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp Mon Feb 6 13:32:38 2017 @@ -1,4 +1,6 @@ // RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fms-extensions -fexceptions -fcxx-exceptions -DTEST1 +// RUN: %clang_cc1 -std=c++98 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fms-extensions -fexceptions -fcxx-exceptions -DTEST1 +// RUN: %clang_cc1 -std=c++11 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fms-extensions -fexceptions -fcxx-exceptions -DTEST1 // RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fexceptions -fcxx-exceptions -DTEST2 #if TEST1 @@ -23,11 +25,17 @@ struct Derived : Base { }; class A { - virtual ~A() throw(); // expected-note {{overridden virtual function is here}} + virtual ~A() throw(); +#if __cplusplus <= 199711L + // expected-note@-2 {{overridden virtual function is here}} +#endif }; class B : public A { - virtual ~B(); // expected-warning {{exception specification of overriding function is more lax than base version}} + virtual ~B(); +#if __cplusplus <= 199711L + // expected-warning@-2 {{exception specification of overriding function is more lax than base version}} +#endif }; } @@ -174,11 +182,18 @@ const int seventeen = 17; typedef int Int; struct X0 { - enum E1 : Int { SomeOtherValue } field; // expected-warning{{enumeration types with a fixed underlying type are a C++11 extension}} + enum E1 : Int { SomeOtherValue } field; +#if __cplusplus <= 199711L + // expected-warning@-2 {{enumeration types with a fixed underlying type are a C++11 extension}} +#endif + enum E1 : seventeen; }; -enum : long long { // expected-warning{{enumeration types with a fixed underlying type are a C++11 extension}} +#if __cplusplus <= 199711L +// expected-warning@+2 {{enumeration types with a fixed underlying type are a C++11 extension}} +#endif +enum : long long { SomeValue = 0x1 }; @@ -450,7 +465,9 @@ struct SealedType sealed : SomeBase { // FIXME. warning can be suppressed if we're also issuing error for overriding a 'final' function. virtual void SealedFunction(); // expected-warning {{'SealedFunction' overrides a member function but is not marked 'override'}} - // expected-warning@+1 {{'override' keyword is a C++11 extension}} +#if __cplusplus <= 199711L + // expected-warning@+2 {{'override' keyword is a C++11 extension}} +#endif virtual void OverrideMe() override; }; Modified: cfe/trunk/test/SemaCXX/implicit-virtual-member-functions.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/implicit-virtual-member-functions.cpp?rev=294225&r1=294224&r2=294225&view=diff == --- cfe/trunk/test/SemaCXX/implicit-virtual-member-functions.cpp (original) +++ cfe/trunk/test/SemaCXX/implicit-virtual-member-functions.cpp Mon Feb 6 13:32:38 2017 @@ -1,33 +1,87 @@ // 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 + struct A { virtual ~A(); +#if __cplusplus >= 201103L +// expected-note@-2 3 {{overridden virtual function is here}} +#endif }; -struct B : A { // expected-error {{no suitable member 'operator delete' in 'B'}} +struct B : A { +#if __cplusplus <= 199711L +// expected-error@-2 {{no suitable member 'operator delete' in 'B'}} +#else +// expected-error@-4 {{deleted function '~B' cannot override a non-deleted function}} +// expected-note@-5 {{virtual destructor requires an unambiguous, accessible 'operator delete'}} +#ifdef MSABI +// expected-note@-7 {{virtual destructor
r294504 - [Lit Test] Make tests C++11 compatible - Parse OpenMP
Author: lcharles Date: Wed Feb 8 13:46:15 2017 New Revision: 294504 URL: http://llvm.org/viewvc/llvm-project?rev=294504&view=rev Log: [Lit Test] Make tests C++11 compatible - Parse OpenMP Differential Revision: https://reviews.llvm.org/D29725 Modified: cfe/trunk/test/OpenMP/declare_reduction_messages.cpp cfe/trunk/test/OpenMP/openmp_check.cpp Modified: cfe/trunk/test/OpenMP/declare_reduction_messages.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/declare_reduction_messages.cpp?rev=294504&r1=294503&r2=294504&view=diff == --- cfe/trunk/test/OpenMP/declare_reduction_messages.cpp (original) +++ cfe/trunk/test/OpenMP/declare_reduction_messages.cpp Wed Feb 8 13:46:15 2017 @@ -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 @@ class Class2 : public Class1 { #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 ')'}} +// expected-note@-9 {{to match this '('}} +#endif #pragma omp declare reduction(fun4 : long : omp_out += omp_in) initializer() // expected-error {{expected expression}} #pragma omp declare reduction(fun5 : long : omp_out += omp_in) initializer(temp)// expected-error {{only 'omp_priv' or 'omp_orig' variables are allowed in initializer expression}} #pragma omp declare reduction(fun6 : long : omp_out += omp_in) initializer(omp_orig // expected-error {{expected ')'}} expected-note {{to match this '('}} Modified: cfe/trunk/test/OpenMP/openmp_check.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/openmp_check.cpp?rev=294504&r1=294503&r2=294504&view=diff == --- cfe/trunk/test/OpenMP/openmp_check.cpp (original) +++ cfe/trunk/test/OpenMP/openmp_check.cpp Wed Feb 8 13:46:15 2017 @@ -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 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r294972 - [Test] Make Lit tests C++11 compatible - nounwind noexcept
Author: lcharles Date: Mon Feb 13 11:56:30 2017 New Revision: 294972 URL: http://llvm.org/viewvc/llvm-project?rev=294972&view=rev Log: [Test] Make Lit tests C++11 compatible - nounwind noexcept C++11 destructors are nothrow by default. Differential Revision: https://reviews.llvm.org/D29859 Modified: cfe/trunk/test/CodeGenCXX/linetable-cleanup.cpp cfe/trunk/test/CodeGenCXX/lpad-linetable.cpp cfe/trunk/test/Index/comment-cplus-decls.cpp Modified: cfe/trunk/test/CodeGenCXX/linetable-cleanup.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/linetable-cleanup.cpp?rev=294972&r1=294971&r2=294972&view=diff == --- cfe/trunk/test/CodeGenCXX/linetable-cleanup.cpp (original) +++ cfe/trunk/test/CodeGenCXX/linetable-cleanup.cpp Mon Feb 13 11:56:30 2017 @@ -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 Modified: cfe/trunk/test/CodeGenCXX/lpad-linetable.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/lpad-linetable.cpp?rev=294972&r1=294971&r2=294972&view=diff == --- cfe/trunk/test/CodeGenCXX/lpad-linetable.cpp (original) +++ cfe/trunk/test/CodeGenCXX/lpad-linetable.cpp Mon Feb 13 11:56:30 2017 @@ -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 Modified: cfe/trunk/test/Index/comment-cplus-decls.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/comment-cplus-decls.cpp?rev=294972&r1=294971&r2=294972&view=diff == --- cfe/trunk/test/Index/comment-cplus-decls.cpp (original) +++ cfe/trunk/test/Index/comment-cplus-decls.cpp Mon Feb 13 11:56:30 2017 @@ -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 @@ protected: // CHECK: class Test {} // CHECK: Test() : reserved(new Test::data()) {} // CHECK: unsigned int getID() const -// CHECK: ~Test() +// CHECK: ~Test(){{( noexcept)?}} // CHECK: Test::data *reserved ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r294979 - [Test] Make Lit tests C++11 compatible - printf format string
Author: lcharles Date: Mon Feb 13 12:57:06 2017 New Revision: 294979 URL: http://llvm.org/viewvc/llvm-project?rev=294979&view=rev Log: [Test] Make Lit tests C++11 compatible - printf format string Different diagnostics when format string does not match actual arg type. This commit contains the first 2 of 3 tests reviewed in D29685 Modified: cfe/trunk/test/SemaCXX/format-strings.cpp cfe/trunk/test/SemaCXX/printf-cstr.cpp Modified: cfe/trunk/test/SemaCXX/format-strings.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/format-strings.cpp?rev=294979&r1=294978&r2=294979&view=diff == --- cfe/trunk/test/SemaCXX/format-strings.cpp (original) +++ cfe/trunk/test/SemaCXX/format-strings.cpp Mon Feb 13 12:57:06 2017 @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral -Wformat-non-iso -fblocks %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral -Wformat-non-iso -fblocks -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral -Wformat-non-iso -fblocks -std=c++11 %s #include @@ -9,9 +11,13 @@ extern int vprintf(const char *restrict, } void f(char **sp, float *fp) { - scanf("%as", sp); // expected-warning{{'a' length modifier is not supported by ISO C}} + scanf("%as", sp); +#if __cplusplus <= 199711L + // expected-warning@-2 {{'a' length modifier is not supported by ISO C}} +#else + // expected-warning@-4 {{format specifies type 'float *' but the argument has type 'char **'}} +#endif - // TODO: Warn that the 'a' conversion specifier is a C++11 feature. printf("%a", 1.0); scanf("%afoobar", fp); } @@ -46,11 +52,19 @@ void h(int *i) { // Test handling __null for format string literal checking. extern "C" { int test_null_format(const char *format, ...) __attribute__((__format__ (__printf__, 1, 2))); +#if __cplusplus >= 201103L + // expected-note@-2 {{candidate function not viable: no known conversion from 'bool' to 'const char *' for 1st argument}} +#endif } void rdar8269537(const char *f) { - test_null_format(false); // expected-warning {{null from a constant boolean}} + test_null_format(false); +#if __cplusplus <= 199711L + // expected-warning@-2 {{null from a constant boolean}} +#else + // expected-error@-4 {{no matching function for call to 'test_null_format'}} +#endif test_null_format(0); // no-warning test_null_format(__null); // no-warning test_null_format(f); // expected-warning {{not a string literal}} Modified: cfe/trunk/test/SemaCXX/printf-cstr.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/printf-cstr.cpp?rev=294979&r1=294978&r2=294979&view=diff == --- cfe/trunk/test/SemaCXX/printf-cstr.cpp (original) +++ cfe/trunk/test/SemaCXX/printf-cstr.cpp Mon Feb 13 12:57:06 2017 @@ -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 @@ void pod_test() { 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'}} +#
r294997 - [test] Make Lit tests C++11 Compatible - Objective-C++
Author: lcharles Date: Mon Feb 13 17:09:56 2017 New Revision: 294997 URL: http://llvm.org/viewvc/llvm-project?rev=294997&view=rev Log: [test] Make Lit tests C++11 Compatible - Objective-C++ Set 5 Objective-C++ tests to run at gnu++98 Differential Revision: https://reviews.llvm.org/D29739 Modified: cfe/trunk/test/CodeGenObjCXX/arc-blocks.mm cfe/trunk/test/CodeGenObjCXX/encode.mm cfe/trunk/test/CodeGenObjCXX/literals.mm cfe/trunk/test/SemaObjCXX/arc-system-header.mm cfe/trunk/test/SemaObjCXX/ivar-construct.mm Modified: cfe/trunk/test/CodeGenObjCXX/arc-blocks.mm URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/arc-blocks.mm?rev=294997&r1=294996&r2=294997&view=diff == --- cfe/trunk/test/CodeGenObjCXX/arc-blocks.mm (original) +++ cfe/trunk/test/CodeGenObjCXX/arc-blocks.mm Mon Feb 13 17:09:56 2017 @@ -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*] } Modified: cfe/trunk/test/CodeGenObjCXX/encode.mm URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/encode.mm?rev=294997&r1=294996&r2=294997&view=diff == --- cfe/trunk/test/CodeGenObjCXX/encode.mm (original) +++ cfe/trunk/test/CodeGenObjCXX/encode.mm Mon Feb 13 17:09:56 2017 @@ -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=} Modified: cfe/trunk/test/CodeGenObjCXX/literals.mm URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/literals.mm?rev=294997&r1=294996&r2=294997&view=diff == --- cfe/trunk/test/CodeGenObjCXX/literals.mm (original) +++ cfe/trunk/test/CodeGenObjCXX/literals.mm Mon Feb 13 17:09:56 2017 @@ -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" Modified: cfe/trunk/test/SemaObjCXX/arc-system-header.mm URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/arc-system-header.mm?rev=294997&r1=294996&r2=294997&view=diff == --- cfe/trunk/test/SemaObjCXX/arc-system-header.mm (original) +++ cfe/trunk/test/SemaObjCXX/arc-system-header.mm Mon Feb 13 17:09:56 2017 @@ -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 Modified: cfe/trunk/test/SemaObjCXX/ivar-construct.mm URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/ivar-construct.mm?rev=294997&r1=294996&r2=294997&view=diff == --- cfe/trunk/test/SemaObjCXX/ivar-construct.mm (original) +++ cfe/trunk/test/SemaObjCXX/ivar-construct.mm Mon Feb 13 17:09:56 2017 @@ -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(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r295484 - [Test] Make Lit tests C++11 compatible - misc
Author: lcharles Date: Fri Feb 17 13:36:19 2017 New Revision: 295484 URL: http://llvm.org/viewvc/llvm-project?rev=295484&view=rev Log: [Test] Make Lit tests C++11 compatible - misc Updated 5 tests. Differential Revision: https://reviews.llvm.org/D24812 Modified: cfe/trunk/test/CodeGenCXX/mangle-unnamed.cpp cfe/trunk/test/CodeGenCXX/static-init.cpp cfe/trunk/test/CodeGenCXX/volatile-1.cpp cfe/trunk/test/CodeGenCXX/volatile.cpp cfe/trunk/test/PCH/macro-undef.cpp Modified: cfe/trunk/test/CodeGenCXX/mangle-unnamed.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-unnamed.cpp?rev=295484&r1=295483&r2=295484&view=diff == --- cfe/trunk/test/CodeGenCXX/mangle-unnamed.cpp (original) +++ cfe/trunk/test/CodeGenCXX/mangle-unnamed.cpp Fri Feb 17 13:36:19 2017 @@ -48,6 +48,7 @@ int f5() { return a; } +#if __cplusplus <= 199711L int f6() { static union { union { @@ -56,9 +57,10 @@ int f6() { int b; }; - // CHECK: _ZZ2f6vE1b + // CXX98: _ZZ2f6vE1b return b; } +#endif int f7() { static union { Modified: cfe/trunk/test/CodeGenCXX/static-init.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/static-init.cpp?rev=295484&r1=295483&r2=295484&view=diff == --- cfe/trunk/test/CodeGenCXX/static-init.cpp (original) +++ cfe/trunk/test/CodeGenCXX/static-init.cpp Fri Feb 17 13:36:19 2017 @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 %s -triple=x86_64-pc-linuxs -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple=x86_64-pc-linuxs -emit-llvm -std=c++98 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK98 %s +// RUN: %clang_cc1 %s -triple=x86_64-pc-linuxs -emit-llvm -std=c++11 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK11 %s // CHECK: @_ZZ1hvE1i = internal global i32 0, align 4 // CHECK: @base_req = global [4 x i8] c"foo\00", align 1 @@ -9,7 +10,8 @@ // CHECK: @_ZZ2h2vE1i = linkonce_odr global i32 0, comdat, align 4 // CHECK: @_ZGVZ2h2vE1i = linkonce_odr global i64 0, comdat, align 8{{$}} // CHECK: @_ZZN5test1L6getvarEiE3var = internal constant [4 x i32] [i32 1, i32 0, i32 2, i32 4], align 16 -// CHECK: @_ZZN5test414useStaticLocalEvE3obj = linkonce_odr global %"struct.test4::HasVTable" zeroinitializer, comdat, align 8 +// CHECK98: @_ZZN5test414useStaticLocalEvE3obj = linkonce_odr global %"struct.test4::HasVTable" zeroinitializer, comdat, align 8 +// CHECK11: @_ZZN5test414useStaticLocalEvE3obj = linkonce_odr global { i8** } { i8** getelementptr inbounds ({ [3 x i8*] }, { [3 x i8*] }* @_ZTVN5test49HasVTableE, i32 0, inrange i32 0, i32 2) }, comdat, align 8 struct A { A(); @@ -169,5 +171,5 @@ void useit() { useStaticLocal(); } // CHECK: define linkonce_odr dereferenceable(8) %"struct.test4::HasVTable"* @_ZN5test414useStaticLocalEv() -// CHECK: ret %"struct.test4::HasVTable"* @_ZZN5test414useStaticLocalEvE3obj +// CHECK: ret %"struct.test4::HasVTable"*{{.*}} @_ZZN5test414useStaticLocalEvE3obj } Modified: cfe/trunk/test/CodeGenCXX/volatile-1.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/volatile-1.cpp?rev=295484&r1=295483&r2=295484&view=diff == --- cfe/trunk/test/CodeGenCXX/volatile-1.cpp (original) +++ cfe/trunk/test/CodeGenCXX/volatile-1.cpp Fri Feb 17 13:36:19 2017 @@ -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 @@ void test() { 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 @@ void test() { // CHECK-NEXT: load volatile // CHECK-NEXT: sitofp - (void)i; + (void)
r296184 - [Test] Make Lit tests C++11 compatible #9
Author: lcharles Date: Fri Feb 24 16:22:05 2017 New Revision: 296184 URL: http://llvm.org/viewvc/llvm-project?rev=296184&view=rev Log: [Test] Make Lit tests C++11 compatible #9 [Test] Make Lit tests C++11 compatible #9 Differential Revision: https://reviews.llvm.org/D20710 Modified: cfe/trunk/test/CodeGenCXX/debug-info-use-after-free.cpp cfe/trunk/test/CodeGenCXX/dynamic-cast-hint.cpp cfe/trunk/test/SemaCXX/i-c-e-cxx.cpp cfe/trunk/test/SemaCXX/new-delete.cpp cfe/trunk/test/SemaCXX/no-wchar.cpp cfe/trunk/test/SemaCXX/virtual-member-functions-key-function.cpp cfe/trunk/test/SemaCXX/warn-bool-conversion.cpp cfe/trunk/test/SemaCXX/zero-length-arrays.cpp cfe/trunk/test/SemaTemplate/instantiate-c99.cpp cfe/trunk/test/SemaTemplate/temp_explicit.cpp cfe/trunk/test/SemaTemplate/value-dependent-null-pointer-constant.cpp Modified: cfe/trunk/test/CodeGenCXX/debug-info-use-after-free.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-use-after-free.cpp?rev=296184&r1=296183&r2=296184&view=diff == --- cfe/trunk/test/CodeGenCXX/debug-info-use-after-free.cpp (original) +++ cfe/trunk/test/CodeGenCXX/debug-info-use-after-free.cpp Fri Feb 24 16:22:05 2017 @@ -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 @@ template < class > class scoped_ptr { namespace { class AAA { +protected: virtual ~ AAA () { }}; Modified: cfe/trunk/test/CodeGenCXX/dynamic-cast-hint.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/dynamic-cast-hint.cpp?rev=296184&r1=296183&r2=296184&view=diff == --- cfe/trunk/test/CodeGenCXX/dynamic-cast-hint.cpp (original) +++ cfe/trunk/test/CodeGenCXX/dynamic-cast-hint.cpp Fri Feb 24 16:22:05 2017 @@ -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; }; Modified: cfe/trunk/test/SemaCXX/i-c-e-cxx.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/i-c-e-cxx.cpp?rev=296184&r1=296183&r2=296184&view=diff == --- cfe/trunk/test/SemaCXX/i-c-e-cxx.cpp (original) +++ cfe/trunk/test/SemaCXX/i-c-e-cxx.cpp Fri Feb 24 16:22:05 2017 @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s +// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -std=gnu++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -std=gnu++11 %s // C++-specific tests for integral constant expressions. @@ -16,9 +18,21 @@ void f() { } int a() { - const int t=t; // expected-note {{declared here}} expected-note {{read of object outside its lifetime}} - switch(1) { // expected-warning {{no case matching constant switch condition '1'}} -case t:; // expected-error {{not an integral constant expression}} expected-note {{initializer of 't' is not a constant expression}} + const int t=t; // expected-note {{declared here}} +#if __cplusplus <= 199711L + // expected-note@-2 {{read of object outside its lifetime}} +#endif + + switch(1) { +#if __cplusplus <= 199711L + // expected-warning@-2 {{no case matching constant switch condition '1'}} +#endif +case t:; // expected-note {{initializer of 't' is not a constant expression}} +#if __cplusplus <= 199711L +// expected-error@-2 {{not an integral constant expression}} +#else +// expected-error@-4 {{case value is not a constant expression}} +#endif } } @@ -48,7 +62,10 @@ void pr6373(const unsigned x = 0) { namespace rdar9204520 { struct A { - static const int B = int(0.75 * 1000 * 1000); // expected-warning {{not a constant expression; folding it to a constant is a GNU extension}} + static const int B = int(0.75 * 1000 * 1000); +#if __cplusplus <= 199711L + // expected-warning@-2 {{not a constant expression; folding it to a constant is a GNU extension}} +#endif }; int foo() { return A::B; } @@ -59,10 +76,24 @@ const int x = 10; int* y = reinterpret_cast(x); // expected-error {{cannot initialize}} // This isn't an integral constant expression, but make sure it folds anyway. -struct PR8836 { char _; long lon
r296193 - [Test] Make Lit tests C++11 compatible #10
Author: lcharles Date: Fri Feb 24 17:23:53 2017 New Revision: 296193 URL: http://llvm.org/viewvc/llvm-project?rev=296193&view=rev Log: [Test] Make Lit tests C++11 compatible #10 Differential Revision: https://reviews.llvm.org/D21626 Modified: cfe/trunk/test/Modules/Inputs/merge-using-decls/b.h cfe/trunk/test/Modules/merge-using-decls.cpp cfe/trunk/test/SemaCXX/PR9572.cpp cfe/trunk/test/SemaCXX/default-assignment-operator.cpp cfe/trunk/test/SemaCXX/default-constructor-initializers.cpp cfe/trunk/test/SemaCXX/warn-thread-safety-parsing.cpp Modified: cfe/trunk/test/Modules/Inputs/merge-using-decls/b.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/merge-using-decls/b.h?rev=296193&r1=296192&r2=296193&view=diff == --- cfe/trunk/test/Modules/Inputs/merge-using-decls/b.h (original) +++ cfe/trunk/test/Modules/Inputs/merge-using-decls/b.h Fri Feb 24 17:23:53 2017 @@ -29,11 +29,13 @@ template struct D : X, T { using typename X::t; }; +#if __cplusplus <= 199711L // C++11 does not allow access declerations template struct E : X, T { // Mismatch in using/access-declaration-ness. T::value; X::v; }; +#endif template struct F : X, T { // Mismatch in nested-name-specifier. @@ -46,5 +48,9 @@ template struct F : X, T { // Force instantiation. typedef C::type I; typedef D::t I; + +#if __cplusplus <= 199711L // C++11 does not allow access declerations typedef E::type I; +#endif + typedef F::type I; Modified: cfe/trunk/test/Modules/merge-using-decls.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/merge-using-decls.cpp?rev=296193&r1=296192&r2=296193&view=diff == --- cfe/trunk/test/Modules/merge-using-decls.cpp (original) +++ cfe/trunk/test/Modules/merge-using-decls.cpp Fri Feb 24 17:23:53 2017 @@ -1,6 +1,10 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify %s -DORDER=1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++98 %s -DORDER=1 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++11 %s -DORDER=1 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify %s -DORDER=2 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++98 %s -DORDER=2 +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++11 %s -DORDER=2 #if ORDER == 1 #include "a.h" @@ -24,7 +28,11 @@ template int Use() { } template int UseAll() { +#if __cplusplus <= 199711L // C++11 does not allow access declerations return Use >() + Use >() + Use >() + Use >(); // expected-note 0-2{{instantiation of}} +#else + return Use >() + Use >() + Use >(); // expected-note 0-2{{instantiation of}} +#endif } template int UseAll(); @@ -37,8 +45,10 @@ template int UseAll(); // Here, we're instantiating the definition from 'A' and merging the definition // from 'B' into it. +#if __cplusplus <= 199711L // C++11 does not allow access declerations // expected-error@b.h:* {{'E::value' from module 'B' is not present in definition of 'E' in module 'A'}} // expected-error@b.h:* {{'E::v' from module 'B' is not present in definition of 'E' in module 'A'}} +#endif // expected-error@b.h:* {{'F::type' from module 'B' is not present in definition of 'F' in module 'A'}} // expected-error@b.h:* {{'F::t' from module 'B' is not present in definition of 'F' in module 'A'}} @@ -55,11 +65,14 @@ template int UseAll(); // expected-error@b.h:* 2{{'typename' keyword used on a non-type}} // expected-error@b.h:* 2{{dependent using declaration resolved to type without 'typename'}} +#if __cplusplus <= 199711L // C++11 does not allow access declerations // expected-error@a.h:* {{'E::type' from module 'A' is not present in definition of 'E' in module 'B'}} // expected-error@a.h:* {{'E::t' from module 'A' is not present in definition of 'E' in module 'B'}} // expected-error@a.h:* {{'E::value' from module 'A' is not present in definition of 'E' in module 'B'}} // expected-error@a.h:* {{'E::v' from module 'A' is not present in definition of 'E' in module 'B'}} // expected-note@b.h:* 2{{definition has no member}} +#endif + // expected-error@a.h:* {{'F::type' from module 'A' is not present in definition of 'F' in module 'B'}} // expected-error@a.h:* {{'F::t' from module 'A' is not present in definition of 'F' in module 'B'}} Modified: cfe/trunk/test/SemaCXX/PR9572.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/PR9572.cpp?rev=296193&r1=
r296549 - [Test] Make Lit tests C++11 compatible - IR ordering
Author: lcharles Date: Tue Feb 28 18:10:00 2017 New Revision: 296549 URL: http://llvm.org/viewvc/llvm-project?rev=296549&view=rev Log: [Test] Make Lit tests C++11 compatible - IR ordering Differential Revision: https://reviews.llvm.org/D30430 Modified: cfe/trunk/test/CodeGenCXX/template-instantiation.cpp Modified: cfe/trunk/test/CodeGenCXX/template-instantiation.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/template-instantiation.cpp?rev=296549&r1=296548&r2=296549&view=diff == --- cfe/trunk/test/CodeGenCXX/template-instantiation.cpp (original) +++ cfe/trunk/test/CodeGenCXX/template-instantiation.cpp Tue Feb 28 18:10:00 2017 @@ -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 @@ class B { void f () {} }; // Should not instantiate class B since it is introduced in namespace scope. -// CHECK-NOT: _ZN6PR85051AILi0EE1B1fEv +// CHECK2-NOT: _ZN6PR85051AILi0EE1B1fEv template class A<0>; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r296648 - [Test] NFC: Fixed typo in comments
Author: lcharles Date: Wed Mar 1 11:55:03 2017 New Revision: 296648 URL: http://llvm.org/viewvc/llvm-project?rev=296648&view=rev Log: [Test] NFC: Fixed typo in comments Changed "declerations" to "declarations" Modified: cfe/trunk/test/Modules/Inputs/merge-using-decls/b.h cfe/trunk/test/Modules/merge-using-decls.cpp Modified: cfe/trunk/test/Modules/Inputs/merge-using-decls/b.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/merge-using-decls/b.h?rev=296648&r1=296647&r2=296648&view=diff == --- cfe/trunk/test/Modules/Inputs/merge-using-decls/b.h (original) +++ cfe/trunk/test/Modules/Inputs/merge-using-decls/b.h Wed Mar 1 11:55:03 2017 @@ -29,7 +29,7 @@ template struct D : X, T { using typename X::t; }; -#if __cplusplus <= 199711L // C++11 does not allow access declerations +#if __cplusplus <= 199711L // C++11 does not allow access declarations template struct E : X, T { // Mismatch in using/access-declaration-ness. T::value; @@ -49,7 +49,7 @@ template struct F : X, T { typedef C::type I; typedef D::t I; -#if __cplusplus <= 199711L // C++11 does not allow access declerations +#if __cplusplus <= 199711L // C++11 does not allow access declarations typedef E::type I; #endif Modified: cfe/trunk/test/Modules/merge-using-decls.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/merge-using-decls.cpp?rev=296648&r1=296647&r2=296648&view=diff == --- cfe/trunk/test/Modules/merge-using-decls.cpp (original) +++ cfe/trunk/test/Modules/merge-using-decls.cpp Wed Mar 1 11:55:03 2017 @@ -28,7 +28,7 @@ template int Use() { } template int UseAll() { -#if __cplusplus <= 199711L // C++11 does not allow access declerations +#if __cplusplus <= 199711L // C++11 does not allow access declarations return Use >() + Use >() + Use >() + Use >(); // expected-note 0-2{{instantiation of}} #else return Use >() + Use >() + Use >(); // expected-note 0-2{{instantiation of}} @@ -45,7 +45,7 @@ template int UseAll(); // Here, we're instantiating the definition from 'A' and merging the definition // from 'B' into it. -#if __cplusplus <= 199711L // C++11 does not allow access declerations +#if __cplusplus <= 199711L // C++11 does not allow access declarations // expected-error@b.h:* {{'E::value' from module 'B' is not present in definition of 'E' in module 'A'}} // expected-error@b.h:* {{'E::v' from module 'B' is not present in definition of 'E' in module 'A'}} #endif @@ -65,7 +65,7 @@ template int UseAll(); // expected-error@b.h:* 2{{'typename' keyword used on a non-type}} // expected-error@b.h:* 2{{dependent using declaration resolved to type without 'typename'}} -#if __cplusplus <= 199711L // C++11 does not allow access declerations +#if __cplusplus <= 199711L // C++11 does not allow access declarations // expected-error@a.h:* {{'E::type' from module 'A' is not present in definition of 'E' in module 'B'}} // expected-error@a.h:* {{'E::t' from module 'A' is not present in definition of 'E' in module 'B'}} // expected-error@a.h:* {{'E::value' from module 'A' is not present in definition of 'E' in module 'B'}} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r246093 - Corrected 3 typos. NFC
Author: lcharles Date: Wed Aug 26 17:13:30 2015 New Revision: 246093 URL: http://llvm.org/viewvc/llvm-project?rev=246093&view=rev Log: Corrected 3 typos. NFC Modified: cfe/trunk/lib/AST/Type.cpp Modified: cfe/trunk/lib/AST/Type.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=246093&r1=246092&r2=246093&view=diff == --- cfe/trunk/lib/AST/Type.cpp (original) +++ cfe/trunk/lib/AST/Type.cpp Wed Aug 26 17:13:30 2015 @@ -1269,7 +1269,7 @@ Optional> Type::getOb if (!dcTypeParams) return None; } else { -// If we are in neither a class mor a category, there's no +// If we are in neither a class nor a category, there's no // substitution to perform. dcCategoryDecl = dyn_cast(dc); if (!dcCategoryDecl) @@ -2254,7 +2254,7 @@ bool QualType::isCXX11PODType(ASTContext // a standard-layout class, and has no non-static data members of type // non-POD struct, non-POD union (or array of such types). [...] // - // We don't directly query the recursive aspect as the requiremets for + // We don't directly query the recursive aspect as the requirements for // both standard-layout classes and trivial classes apply recursively // already. } @@ -3517,7 +3517,7 @@ bool Type::isObjCARCImplicitlyUnretained if (const ObjCObjectPointerType *opt = dyn_cast(canon)) { -// Class and Class don't require retension. +// Class and Class don't require retention. if (opt->getObjectType()->isObjCClass()) return true; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r246183 - [Tests] Modified Lit Tests to be C++11 compatibile
Author: lcharles Date: Thu Aug 27 13:49:15 2015 New Revision: 246183 URL: http://llvm.org/viewvc/llvm-project?rev=246183&view=rev Log: [Tests] Modified Lit Tests to be C++11 compatibile This 2nd patch should not change the test results, but it is useful if clang's default C++ language is ever changed from gnu++98. Added: cfe/trunk/test/CodeCompletion/ordinary-name-cxx11.cpp Modified: cfe/trunk/test/Analysis/temp-obj-dtors-cfg-output.cpp cfe/trunk/test/CodeCompletion/ordinary-name.cpp cfe/trunk/test/Sema/switch-1.c cfe/trunk/test/Sema/thread-specifier.c Modified: cfe/trunk/test/Analysis/temp-obj-dtors-cfg-output.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/temp-obj-dtors-cfg-output.cpp?rev=246183&r1=246182&r2=246183&view=diff == --- cfe/trunk/test/Analysis/temp-obj-dtors-cfg-output.cpp (original) +++ cfe/trunk/test/Analysis/temp-obj-dtors-cfg-output.cpp Thu Aug 27 13:49:15 2015 @@ -1,6 +1,8 @@ // RUN: rm -f %t -// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG -analyzer-config cfg-temporary-dtors=true %s > %t 2>&1 -// RUN: FileCheck --input-file=%t %s +// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG -analyzer-config cfg-temporary-dtors=true -std=c++98 %s > %t 2>&1 +// RUN: FileCheck --input-file=%t -check-prefix=CXX98 -check-prefix=CHECK %s +// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG -analyzer-config cfg-temporary-dtors=true -std=c++11 %s > %t 2>&1 +// RUN: FileCheck --input-file=%t -check-prefix=CXX11 -check-prefix=CHECK %s class A { public: @@ -671,15 +673,23 @@ int testConsistencyNestedNormalReturn(bo // CHECK: Succs (1): B0 // CHECK: [B3] // CHECK: 1: D() (CXXConstructExpr, struct D) -// CHECK: 2: [B3.1] (ImplicitCastExpr, NoOp, const struct D) -// CHECK: 3: [B3.2] -// CHECK: 4: [B3.3] (CXXConstructExpr, struct D) -// CHECK: 5: D d = D(); -// CHECK: 6: d -// CHECK: 7: [B3.6].operator bool -// CHECK: 8: [B3.6] -// CHECK: 9: [B3.8] (ImplicitCastExpr, UserDefinedConversion, _Bool) -// CHECK: T: if [B3.9] +// CXX98: 2: [B3.1] (ImplicitCastExpr, NoOp, const struct D) +// CXX98: 3: [B3.2] +// CXX98: 4: [B3.3] (CXXConstructExpr, struct D) +// CXX98: 5: D d = D(); +// CXX98: 6: d +// CXX98: 7: [B3.6].operator bool +// CXX98: 8: [B3.6] +// CXX98: 9: [B3.8] (ImplicitCastExpr, UserDefinedConversion, _Bool) +// CXX98: T: if [B3.9] +// CXX11: 2: [B3.1] +// CXX11: 3: [B3.2] (CXXConstructExpr, struct D) +// CXX11: 4: D d = D(); +// CXX11: 5: d +// CXX11: 6: [B3.5].operator bool +// CXX11: 7: [B3.5] +// CXX11: 8: [B3.7] (ImplicitCastExpr, UserDefinedConversion, _Bool) +// CXX11: T: if [B3.8] // CHECK: Preds (1): B4 // CHECK: Succs (2): B2 B1 // CHECK: [B0 (EXIT)] Added: cfe/trunk/test/CodeCompletion/ordinary-name-cxx11.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeCompletion/ordinary-name-cxx11.cpp?rev=246183&view=auto == --- cfe/trunk/test/CodeCompletion/ordinary-name-cxx11.cpp (added) +++ cfe/trunk/test/CodeCompletion/ordinary-name-cxx11.cpp Thu Aug 27 13:49:15 2015 @@ -0,0 +1,252 @@ +struct X { int x; }; +void z(int); +typedef struct t TYPEDEF; + +void foo() { + int y = 17; + // RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -code-completion-patterns -code-completion-at=%s:6:14 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s + // CHECK-CC1: COMPLETION: bool + // CHECK-CC1-NEXT: COMPLETION: char + // CHECK-CC1-NEXT: COMPLETION: char16 + // CHECK-CC1-NEXT: COMPLETION: char32 + // CHECK-CC1-NEXT: COMPLETION: class + // CHECK-CC1-NEXT: COMPLETION: const + // CHECK-CC1-NEXT: COMPLETION: Pattern : const_cast<<#type#>>(<#expression#>) + // CHECK-CC1: COMPLETION: Pattern : [#void#]delete <#expression#> + // CHECK-CC1-NEXT: COMPLETION: Pattern : [#void#]delete [] <#expression#> + // CHECK-CC1-NEXT: COMPLETION: Pattern : do{<#statements#> + // CHECK-CC1: COMPLETION: double + // CHECK-CC1-NEXT: COMPLETION: Pattern : dynamic_cast<<#type#>>(<#expression#>) + // CHECK-CC1-NEXT: COMPLETION: enum + // CHECK-CC1-NEXT: COMPLETION: extern + // CHECK-CC1-NEXT: COMPLETION: Pattern : [#bool#]false + // CHECK-CC1-NEXT: COMPLETION: float + // CHECK-CC1-NEXT: COMPLETION: foo : [#void#]foo() + // CHECK-CC1-NEXT: COMPLETION: Pattern : for(<#init-statement#>;<#condition#>;<#inc-expression#>){ + // CHECK-CC1: COMPLETION: Pattern : goto <#label#> + // CHECK-CC1-NEXT: COMPLETION: Pattern : if(<#condition#>){<#statements#> + // CHECK-CC1: COMPLETION: int + // CHECK-CC1-NEXT: COMPLETION: long + // CHECK-CC1-NEXT: COMPLETION: Pattern : new <#type#>(<#expressions#>) + // CHECK-CC1-NEXT: COMPLETION: Pattern : new <#type#>[<#size#>](<#expressions#>) + // CHECK-CC1-NEXT: COMPLETION: Pattern : [#bool#]noexcept(<#expre
r252785 - [Lit Test] Updated 26 Lit tests to be C++11 compatible.
Author: lcharles Date: Wed Nov 11 13:34:47 2015 New Revision: 252785 URL: http://llvm.org/viewvc/llvm-project?rev=252785&view=rev Log: [Lit Test] Updated 26 Lit tests to be C++11 compatible. Expected diagnostics have been expanded to vary by C++ dialect. RUN line has also been expanded to: default, C++98/03 and C++11. Modified: cfe/trunk/test/CXX/class.access/class.friend/p2-cxx03.cpp cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp cfe/trunk/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp cfe/trunk/test/CodeGen/ubsan-type-blacklist.cpp cfe/trunk/test/FixIt/fixit-vexing-parse.cpp cfe/trunk/test/SemaCXX/addr-of-overloaded-function.cpp cfe/trunk/test/SemaCXX/const-cast.cpp cfe/trunk/test/SemaCXX/convert-to-bool.cpp cfe/trunk/test/SemaCXX/copy-initialization.cpp cfe/trunk/test/SemaCXX/cxx0x-return-init-list.cpp cfe/trunk/test/SemaCXX/decltype-crash.cpp cfe/trunk/test/SemaCXX/gnu-flags.cpp cfe/trunk/test/SemaCXX/invalid-member-expr.cpp cfe/trunk/test/SemaCXX/member-expr.cpp cfe/trunk/test/SemaCXX/member-pointer.cpp cfe/trunk/test/SemaCXX/new-array-size-conv.cpp cfe/trunk/test/SemaCXX/offsetof.cpp cfe/trunk/test/SemaCXX/printf-block.cpp cfe/trunk/test/SemaCXX/undefined-internal.cpp cfe/trunk/test/SemaObjCXX/crash.mm cfe/trunk/test/SemaObjCXX/vararg-non-pod.mm cfe/trunk/test/SemaTemplate/default-arguments.cpp cfe/trunk/test/SemaTemplate/temp_class_spec_neg.cpp cfe/trunk/test/SemaTemplate/typename-specifier-4.cpp cfe/trunk/test/SemaTemplate/typename-specifier.cpp Modified: cfe/trunk/test/CXX/class.access/class.friend/p2-cxx03.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class.access/class.friend/p2-cxx03.cpp?rev=252785&r1=252784&r2=252785&view=diff == --- cfe/trunk/test/CXX/class.access/class.friend/p2-cxx03.cpp (original) +++ cfe/trunk/test/CXX/class.access/class.friend/p2-cxx03.cpp Wed Nov 11 13:34:47 2015 @@ -1,7 +1,14 @@ // 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 class X0 { - friend T; // expected-warning{{non-class friend type 'T' is a C++11 extension}} + friend T; +#if __cplusplus <= 199711L // C++03 or earlier modes + // expected-warning@-2{{non-class friend type 'T' is a C++11 extension}} +#else + // expected-no-diagnostics +#endif }; class X1 { }; Modified: cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp?rev=252785&r1=252784&r2=252785&view=diff == --- cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp (original) +++ cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp Wed Nov 11 13:34:47 2015 @@ -1,10 +1,15 @@ // RUN: %clang_cc1 -verify %s +// RUN: %clang_cc1 -verify -std=c++98 %s +// RUN: %clang_cc1 -verify -std=c++11 %s class A { public: explicit A(); - explicit operator int(); // expected-warning {{explicit conversion functions are a C++11 extension}} + explicit operator int(); +#if __cplusplus <= 199711L // C++03 or earlier modes + // expected-warning@-2 {{explicit conversion functions are a C++11 extension}} +#endif explicit void f0(); // expected-error {{'explicit' can only be applied to a constructor or conversion function}} @@ -12,8 +17,11 @@ public: }; explicit A::A() { } // expected-error {{'explicit' can only be specified inside the class definition}} -explicit A::operator bool() { return false; } // expected-warning {{explicit conversion functions are a C++11 extension}}\ - // expected-error {{'explicit' can only be specified inside the class definition}} +explicit A::operator bool() { return false; } +#if __cplusplus <= 199711L // C++03 or earlier modes +// expected-warning@-2 {{explicit conversion functions are a C++11 extension}} +#endif +// expected-error@-4 {{'explicit' can only be specified inside the class definition}} class B { friend explicit A::A(); // expected-error {{'explicit' is invalid in friend declarations}} Modified: cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp?rev=252785&r1=252784&r2=252785&view=diff == --- cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp (original) +++ cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp Wed Nov 11 13:34:47 2015 @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++9
[PATCH] D18879: Lit C++11 Compatibility Patch #6
tigerleapgorge created this revision. tigerleapgorge added a reviewer: rsmith. tigerleapgorge added a subscriber: cfe-commits. 17 OpenMP tests have their expected diagnostics updated. The changes to each file are identical. http://reviews.llvm.org/D18879 Files: test/OpenMP/for_collapse_messages.cpp test/OpenMP/for_ordered_clause.cpp test/OpenMP/for_simd_collapse_messages.cpp test/OpenMP/for_simd_safelen_messages.cpp test/OpenMP/for_simd_simdlen_messages.cpp test/OpenMP/parallel_for_collapse_messages.cpp test/OpenMP/parallel_for_ordered_messages.cpp test/OpenMP/parallel_for_simd_collapse_messages.cpp test/OpenMP/parallel_for_simd_safelen_messages.cpp test/OpenMP/parallel_for_simd_simdlen_messages.cpp test/OpenMP/simd_collapse_messages.cpp test/OpenMP/simd_safelen_messages.cpp test/OpenMP/simd_simdlen_messages.cpp test/OpenMP/taskloop_collapse_messages.cpp test/OpenMP/taskloop_simd_collapse_messages.cpp test/OpenMP/taskloop_simd_safelen_messages.cpp test/OpenMP/taskloop_simd_simdlen_messages.cpp Index: test/OpenMP/taskloop_simd_simdlen_messages.cpp === --- test/OpenMP/taskloop_simd_simdlen_messages.cpp +++ test/OpenMP/taskloop_simd_simdlen_messages.cpp @@ -1,8 +1,13 @@ // 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() { } +#if __cplusplus >= 201103L +// expected-note@+2 4 {{declared here}} +#endif bool foobool(int argc) { return argc; } @@ -29,14 +34,21 @@ for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; #pragma omp taskloop simd simdlen ((ST > 0) ? 1 + ST : 2) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; - // expected-error@+3 2 {{directive '#pragma omp taskloop simd' cannot contain more than one 'simdlen' clause}} - // expected-error@+2 2 {{argument to 'simdlen' clause must be a strictly positive integer value}} - // expected-error@+1 2 {{expression is not an integral constant expression}} + // expected-error@+6 2 {{directive '#pragma omp taskloop simd' cannot contain more than one 'simdlen' clause}} + // expected-error@+5 2 {{argument to 'simdlen' clause must be a strictly positive integer value}} + // expected-error@+4 2 {{expression is not an integral constant expression}} +#if __cplusplus >= 201103L + // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} +#endif #pragma omp taskloop simd simdlen (foobool(argc)), simdlen (true), simdlen (-5) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; #pragma omp taskloop simd simdlen (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 <= 199711L + // expected-error@+4 2 {{expression is not an integral constant expression}} +#else + // expected-error@+2 2 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}} +#endif #pragma omp taskloop simd simdlen (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]; #pragma omp taskloop simd simdlen (4) @@ -57,16 +69,27 @@ for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; #pragma omp taskloop simd simdlen (2+2)) // expected-warning {{extra tokens at the end of '#pragma omp taskloop simd' are ignored}} for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; - #pragma omp taskloop simd simdlen (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]; - // expected-error@+3 {{expression is not an integral constant expression}} + // expected-error@+4 {{expression is not an integral constant expression}} +#if __cplusplus >= 201103L + // expected-note@+2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} +#endif + #pragma omp taskloop simd simdlen (foobool(1) > 0 ? 1 : 2) + for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; + // expected-error@+6 {{expression is not an integral constant expression}} +#if __cplusplus >= 201103L + // expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}} +#endif // expected-error@+2 2 {{directive '#pragma omp taskloop simd' cannot contain more than one 'simdlen' clause}} // expected-error@+1 2 {{argument to 'simdlen' clause must be a strictly positive integer value}} #pragma omp taskloop simd simdlen (foobool(argc)), simdlen (true), simdlen (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; #pragma omp taskloop simd simdlen (S1) // expected-error {{'S1' does not
r265982 - Lit C++11 Compatibility Patch #6
Author: lcharles Date: Mon Apr 11 14:30:25 2016 New Revision: 265982 URL: http://llvm.org/viewvc/llvm-project?rev=265982&view=rev Log: Lit C++11 Compatibility Patch #6 Updated the expected diagnostics of 17 OpenMP tests. The changes to each test are identical. Modified: cfe/trunk/test/OpenMP/for_collapse_messages.cpp cfe/trunk/test/OpenMP/for_ordered_clause.cpp cfe/trunk/test/OpenMP/for_simd_collapse_messages.cpp cfe/trunk/test/OpenMP/for_simd_safelen_messages.cpp cfe/trunk/test/OpenMP/for_simd_simdlen_messages.cpp cfe/trunk/test/OpenMP/parallel_for_collapse_messages.cpp cfe/trunk/test/OpenMP/parallel_for_ordered_messages.cpp cfe/trunk/test/OpenMP/parallel_for_simd_collapse_messages.cpp cfe/trunk/test/OpenMP/parallel_for_simd_safelen_messages.cpp cfe/trunk/test/OpenMP/parallel_for_simd_simdlen_messages.cpp cfe/trunk/test/OpenMP/simd_collapse_messages.cpp cfe/trunk/test/OpenMP/simd_safelen_messages.cpp cfe/trunk/test/OpenMP/simd_simdlen_messages.cpp cfe/trunk/test/OpenMP/taskloop_collapse_messages.cpp cfe/trunk/test/OpenMP/taskloop_simd_collapse_messages.cpp cfe/trunk/test/OpenMP/taskloop_simd_safelen_messages.cpp cfe/trunk/test/OpenMP/taskloop_simd_simdlen_messages.cpp Modified: cfe/trunk/test/OpenMP/for_collapse_messages.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/for_collapse_messages.cpp?rev=265982&r1=265981&r2=265982&view=diff == --- cfe/trunk/test/OpenMP/for_collapse_messages.cpp (original) +++ cfe/trunk/test/OpenMP/for_collapse_messages.cpp Mon Apr 11 14:30:25 2016 @@ -1,8 +1,13 @@ // 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() { } +#if __cplusplus >= 201103L +// expected-note@+2 4 {{declared here}} +#endif bool foobool(int argc) { return argc; } @@ -29,14 +34,21 @@ T tmain(T argc, S **argv) { //expected-n for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; #pragma omp for collapse ((ST > 0) ? 1 + ST : 2) // expected-note 2 {{as specified in 'collapse' 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 for', but found only 1}} - // expected-error@+3 2 {{directive '#pragma omp for' cannot contain more than one 'collapse' clause}} - // expected-error@+2 2 {{argument to 'collapse' clause must be a strictly positive integer value}} - // expected-error@+1 2 {{expression is not an integral constant expression}} + // expected-error@+6 2 {{directive '#pragma omp for' cannot contain more than one 'collapse' clause}} + // expected-error@+5 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+4 2 {{expression is not an integral constant expression}} +#if __cplusplus >= 201103L + // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} +#endif #pragma omp for collapse (foobool(argc)), collapse (true), collapse (-5) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; #pragma omp for collapse (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 <= 199711L + // expected-error@+4 2 {{expression is not an integral constant expression}} +#else + // expected-error@+2 2 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}} +#endif #pragma omp for collapse (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]; #pragma omp for collapse (1) @@ -59,16 +71,27 @@ int main(int argc, char **argv) { 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 for', but found only 1}} #pragma omp for collapse (2+2)) // expected-warning {{extra tokens at the end of '#pragma omp for' are ignored}} expected-note {{as specified in 'collapse' 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 for', but found only 1}} - #pragma omp for collapse (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]; - // expected-error@+3 {{expression is not an integral constant expression}} + // expected-error@+4 {{expression is not an integral constant expression}} +#if __cplusplus >= 201103L + // expected-note@+2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} +#endif + #pragma omp for coll
Re: [PATCH] D18879: Lit C++11 Compatibility Patch #6
tigerleapgorge closed this revision. tigerleapgorge added a comment. Patch committed @r265982. http://reviews.llvm.org/D18879 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D19068: Lit C++11 Compatibility Patch #7
tigerleapgorge created this revision. tigerleapgorge added a reviewer: rsmith. tigerleapgorge added a subscriber: cfe-commits. 13 tests have been updated for C++11 compatibility. CXX/class.access/class.access.dcl/p1.cpp Access declarations are deprecated in C++11. As a result, there are 4 types of diagnostics changes: For simple access declarations, there is a change in diagnostics. C++98: warning: access declarations are deprecated; use using declarations instead C++11: error: ISO C++11 does not allow access declarations; use using declarations instead For Self-referential access declarations, there is also an additional error message. C++98: warning: access declarations are deprecated; use using declarations instead C++11: error: ISO C++11 does not allow access declarations; use using declarations instead C++11: error: using declaration refers to its own class For an access declaration of a non-base method, there is a different additional error message. C++98: warning: access declarations are deprecated; use using declarations instead C++11: error: ISO C++11 does not allow access declarations; use using declarations instead C++11: error: using declaration refers into 'Subclass::', which is not a base class of 'C' For self-referential access declaration with local declaration, there is the additional error message but one less note message. C++98: warning: access declarations are deprecated; use using declarations instead [-Wdeprecated] C++98: error: using declaration refers to its own class C++98: note: target of using declaration C++11: error: ISO C++11 does not allow access declarations; use using declarations instead C++11: error: using declaration refers to its own class CXX/temp/temp.spec/temp.expl.spec/p2.cpp Guard multiple instances of the following diagnostics to C++98. C++98: warning: first declaration of function template specialization of 'f0' outside namespace 'N0' is a C++11 extension C++98: note: explicitly specialized declaration is here CXX/temp/temp.spec/temp.expl.spec/p3.cpp Guard one instance of the following diagnostics to C++98. C++98: warning: first declaration of class template specialization of 'X' outside namespace 'N' is a C++11 extension C++98: note: explicitly specialized declaration is here CXX/temp/temp.spec/temp.explicit/p2.cpp CXX/temp/temp.spec/temp.explicit/p5.cpp In C++98 with -Wc++11-compat, Out-of-scope explicit instantiations of template is a Warning. In C++11, it is now an Error. C++98: warning: explicit instantiation of 'N::f1' must occur in namespace 'N' C++11: error: explicit instantiation of 'N::f1' must occur in namespace 'N' CodeGenCXX/debug-info-static-member.cpp In C++11, replace “const” with “constexpr” for in-class static initializer of non-integral type. Otherwise compiler would complain: C++11: error: in-class initializer for static data member of type 'const float' requires 'constexpr' specifier SemaCXX/dcl_init_aggr.cpp Diagnostic change due to initializer list C++98: error: non-aggregate type 'NonAggregate' cannot be initialized with an initializer list C++11: error no matching constructor for initialization of 'NonAggregate' note: candidate constructor (the implicit copy constructor) not viable note: candidate constructor (the implicit move constructor) not viable note: candidate constructor not viable Diagnostic Change C++98: conversion from string literal to 'char *' is deprecated C++11: ISO C++11 does not allow conversion from string literal to 'char *' Addition C++11 move constructor diagnostics C++11: note: candidate constructor (the implicit move constructor) not viable The next 2 lines caused a lot of diff. Source: TooFewError too_few_error = { 1 } C++98: error: no matching constructor for initialization of 'NoDefaultConstructor' note: candidate constructor not viable: requires 1 argument, but 0 were provided note: candidate constructor (the implicit copy constructor) not viable note: in implicit initialization of field 'nodef' with omitted initializer error: implicit default constructor for 'TooFewError' must explicitly initialize the member 'nodef' which does not have a default constructor note: member is declared here note: 'NoDefaultConstructor' declared here C++11: error: no matching constructor for initialization of 'NoDefaultConstructor' note: candidate constructor not viable: requires 1 argument, but 0 were provided note: candidate constructor (the implicit copy constructor) not viable note: candidate constructor (the implicit move constructor) not viable note: in implicit initialization of field 'nodef' with omitted initializer Source: TooFewError too_few_okay2[2] = { 1, 1 }; C+
r266239 - Lit C++11 Compatibility Patch #7
Author: lcharles Date: Wed Apr 13 15:00:45 2016 New Revision: 266239 URL: http://llvm.org/viewvc/llvm-project?rev=266239&view=rev Log: Lit C++11 Compatibility Patch #7 13 tests have been updated for C++11 compatibility. Differential Revision: http://reviews.llvm.org/D19068 Modified: cfe/trunk/test/CXX/class.access/class.access.dcl/p1.cpp cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p3.cpp cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p2.cpp cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p5.cpp cfe/trunk/test/CodeGenCXX/debug-info-static-member.cpp cfe/trunk/test/SemaCXX/dcl_init_aggr.cpp cfe/trunk/test/SemaCXX/type-convert-construct.cpp cfe/trunk/test/SemaCXX/vararg-non-pod.cpp cfe/trunk/test/SemaTemplate/class-template-spec.cpp cfe/trunk/test/SemaTemplate/instantiate-cast.cpp cfe/trunk/test/SemaTemplate/instantiate-expr-4.cpp cfe/trunk/test/SemaTemplate/instantiate-member-class.cpp Modified: cfe/trunk/test/CXX/class.access/class.access.dcl/p1.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class.access/class.access.dcl/p1.cpp?rev=266239&r1=266238&r2=266239&view=diff == --- cfe/trunk/test/CXX/class.access/class.access.dcl/p1.cpp (original) +++ cfe/trunk/test/CXX/class.access/class.access.dcl/p1.cpp Wed Apr 13 15:00:45 2016 @@ -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 // This is just the test for [namespace.udecl]p4 with 'using' // uniformly stripped out. @@ -24,10 +26,33 @@ namespace test0 { } class Test0 { -NonClass::type; // expected-error {{not a class}} expected-warning {{access declarations are deprecated}} -NonClass::hiding; // expected-error {{not a class}} expected-warning {{access declarations are deprecated}} -NonClass::union_member; // expected-error {{not a class}} expected-warning {{access declarations are deprecated}} -NonClass::enumerator; // expected-error {{not a class}} expected-warning {{access declarations are deprecated}} +NonClass::type; // expected-error {{not a class}} +#if __cplusplus <= 199711L +// expected-warning@-2 {{access declarations are deprecated; use using declarations instead}} +#else +// expected-error@-4 {{ISO C++11 does not allow access declarations; use using declarations instead}} +#endif + +NonClass::hiding; // expected-error {{not a class}} +#if __cplusplus <= 199711L +// expected-warning@-2 {{access declarations are deprecated; use using declarations instead}} +#else +// expected-error@-4 {{ISO C++11 does not allow access declarations; use using declarations instead}} +#endif + +NonClass::union_member; // expected-error {{not a class}} +#if __cplusplus <= 199711L +// expected-warning@-2 {{access declarations are deprecated; use using declarations instead}} +#else +// expected-error@-4 {{ISO C++11 does not allow access declarations; use using declarations instead}} +#endif + +NonClass::enumerator; // expected-error {{not a class}} +#if __cplusplus <= 199711L +// expected-warning@-2 {{access declarations are deprecated; use using declarations instead}} +#else +// expected-error@-4 {{ISO C++11 does not allow access declarations; use using declarations instead}} +#endif }; } @@ -43,11 +68,39 @@ namespace test1 { }; struct B : A { -A::type; // expected-warning {{access declarations are deprecated}} -A::hiding; // expected-warning {{access declarations are deprecated}} -A::union_member; // expected-warning {{access declarations are deprecated}} -A::enumerator; // expected-warning {{access declarations are deprecated}} -A::tagname; // expected-warning {{access declarations are deprecated}} +A::type; +#if __cplusplus <= 199711L +// expected-warning@-2 {{access declarations are deprecated; use using declarations instead}} +#else +// expected-error@-4 {{ISO C++11 does not allow access declarations; use using declarations instead}} +#endif +A::hiding; +#if __cplusplus <= 199711L +// expected-warning@-2 {{access declarations are deprecated; use using declarations instead}} +#else +// expected-error@-4 {{ISO C++11 does not allow access declarations; use using declarations instead}} +#endif + +A::union_member; +#if __cplusplus <= 199711L +// expected-warning@-2 {{access declarations are deprecated; use using declarations instead}} +#else +// expected-error@-4 {{ISO C++11 does not allow access declarations; use using declarations instead}} +#endif + +A::enumerator; +#if __cplusplus <= 199711L +// expected-warning@-2 {{access declarations are deprecated; use using declarations instead}} +#else +// expected-error@-4 {{ISO C++11 does not allow access declarations; use usi
[PATCH] D19131: Lit C++11 Compatibility Patch #8
tigerleapgorge created this revision. tigerleapgorge added a reviewer: rsmith. tigerleapgorge added a subscriber: cfe-commits. 24 tests have been updated for C++11 compatibility. CXX/basic/basic.lookup/basic.lookup.classref/p1.cpp Ambiguous class member lookup has been fixed in C++11 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html# Restrict the following diagnostics to C++98. C++98: warning: lookup of 'set' in member access expression is ambiguous; using member of 'Value' note: lookup in the object type 'Value' refers here note: lookup from the current scope refers here CXX/class/class.friend/p1.cpp Restrict the following diagnostics to C++98. C++98 error: friends cannot be members of the declaring class CXX/class/class.friend/p2.cpp Restrict the following 2 diagnostics to C++98. C++98: warning: non-class friend type 'int' is a C++11 extension C++98: warning: unelaborated friend declaration is a C++11 extension; specify 'struct' to befriend 'B0' CXX/stmt.stmt/stmt.dcl/p3.cpp Definition of POD has been relaxed in C++11 such that a struct with a trivial copy assignment operator is still considered POD. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2294.html In the above paper, the following clause has been crossed out. “and has no user-declared copy assignment operator and no user-declared destructor” For this test, struct Z is still a POD struct in C++11. Therefore goto can jump over Z’s instantiation without causing a compiler Error. Restrict the following to C++98 C++98: error: cannot jump from this goto statement to its label C++98: note: jump bypasses initialization of non-POD variable CXX/temp/temp.arg/temp.arg.nontype/p1.cpp C++11 accepts arbitrary literal types for non-type template parameters http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3413.html Change in diagnostics. C++98: error: non-type template argument for template parameter of pointer type 'int *' must have its address taken C++11: error: non-type template argument of type 'int' is not a constant expression note: read of non-const variable 'i' is not allowed in a constant expression note: declared here Restrict the following to C++98 C++98: warning: non-type template argument referring to object 'ki' with internal linkage is a C++11 extension Note: non-type template argument refers to object here Change in diagnostics. C++98: error: non-type template argument refers to thread-local object note: non-type template argument refers here C++11: error: non-type template argument of type 'int *' is not a constant expression note: template parameter is declared here Restrict the following to C++98 C++98: non-type template argument referring to function 'f_internal' with internal linkage is a C++11 extension note: non-type template argument refers to function here Change in diagnostics C++98: error: non-type template argument refers to object 'n' that does not have linkage note: non-type template argument refers to object here C++11: error: non-type template argument of type 'int *' is not a constant expression note: pointer to 'n' is not a constant expression note: declared here note: template parameter is declared here Change in diagnostics C++98: error: non-type template argument for template parameter of pointer type 'int *' must have its address taken C++11: error: non-type template argument of type 'int *' is not a constant expression note: read of non-constexpr variable 'iptr' is not allowed in a constant expression note: declared here CXX/temp/temp.arg/temp.arg.type/p2.cpp Unnamed types can now be used as template arguments in C++11 http://stackoverflow.com/questions/5131691/what-is-an-unnamed-type-in-c Restrict the following diagnostics to C++98. C++98: Warning: template argument uses unnamed type CXX/temp/temp.fct.spec/temp.deduct/p9.cpp Template argument constant expression narrowing is not allowed. http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1809 Restrict the following diagnostics to C++98. C++98: error: call to 'f' is ambiguous note: candidate function note: candidate function CXX/temp/temp.spec/no-body.cpp Explicit instantiation of a template inside a nested namespace is an Error in C++11. This could be the result of the following defect fix. http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#995 Added 3 instances of the following diagnostics. C++11: error: explicit instantiation of 'x' must occur at global scope note: explicit instantiation refers here Also remove these 3 explicit instantiations from the -fixit runs. CodeGenCXX/const-init.cpp Use constexpr instead of const in C++11 so the compiler
r266387 - Lit C++11 Compatibility Patch #8
Author: lcharles Date: Thu Apr 14 18:47:07 2016 New Revision: 266387 URL: http://llvm.org/viewvc/llvm-project?rev=266387&view=rev Log: Lit C++11 Compatibility Patch #8 24 tests have been updated for C++11 compatibility. Modified: cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.classref/p1.cpp cfe/trunk/test/CXX/class/class.friend/p1.cpp cfe/trunk/test/CXX/class/class.friend/p2.cpp cfe/trunk/test/CXX/stmt.stmt/stmt.dcl/p3.cpp cfe/trunk/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp cfe/trunk/test/CXX/temp/temp.arg/temp.arg.type/p2.cpp cfe/trunk/test/CXX/temp/temp.fct.spec/temp.deduct/p9.cpp cfe/trunk/test/CXX/temp/temp.spec/no-body.cpp cfe/trunk/test/CodeGenCXX/const-init.cpp cfe/trunk/test/Parser/cxx-class.cpp cfe/trunk/test/Parser/cxx-decl.cpp cfe/trunk/test/Parser/cxx-friend.cpp cfe/trunk/test/SemaCXX/anonymous-struct.cpp cfe/trunk/test/SemaCXX/class.cpp cfe/trunk/test/SemaCXX/conversion-function.cpp cfe/trunk/test/SemaCXX/cxx1y-variable-templates_in_class.cpp cfe/trunk/test/SemaCXX/cxx1y-variable-templates_top_level.cpp cfe/trunk/test/SemaCXX/exceptions.cpp cfe/trunk/test/SemaCXX/qual-id-test.cpp cfe/trunk/test/SemaCXX/unused.cpp cfe/trunk/test/SemaCXX/warn-unused-value.cpp cfe/trunk/test/SemaTemplate/member-access-expr.cpp cfe/trunk/test/SemaTemplate/recovery-crash.cpp cfe/trunk/test/SemaTemplate/temp_arg_type.cpp Modified: cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.classref/p1.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.classref/p1.cpp?rev=266387&r1=266386&r2=266387&view=diff == --- cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.classref/p1.cpp (original) +++ cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.classref/p1.cpp Thu Apr 14 18:47:07 2016 @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-option -verify %s +// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-option -verify -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-option -verify -std=c++11 %s // C++98 [basic.lookup.classref]p1: // In a class member access expression (5.2.5), if the . or -> token is @@ -21,10 +23,16 @@ // From PR 7247 template -struct set{}; // expected-note{{lookup from the current scope refers here}} +struct set{}; +#if __cplusplus <= 199711L +// expected-note@-2 {{lookup from the current scope refers here}} +#endif struct Value { template - void set(T value) {} // expected-note{{lookup in the object type 'Value' refers here}} + void set(T value) {} +#if __cplusplus <= 199711L + // expected-note@-2 {{lookup in the object type 'Value' refers here}} +#endif void resolves_to_same() { Value v; @@ -36,7 +44,10 @@ void resolves_to_different() { Value v; // The fact that the next line is a warning rather than an error is an // extension. -v.set(3.2); // expected-warning{{lookup of 'set' in member access expression is ambiguous; using member of 'Value'}} +v.set(3.2); +#if __cplusplus <= 199711L +// expected-warning@-2 {{lookup of 'set' in member access expression is ambiguous; using member of 'Value'}} +#endif } { int set; // Non-template. Modified: cfe/trunk/test/CXX/class/class.friend/p1.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class/class.friend/p1.cpp?rev=266387&r1=266386&r2=266387&view=diff == --- cfe/trunk/test/CXX/class/class.friend/p1.cpp (original) +++ cfe/trunk/test/CXX/class/class.friend/p1.cpp Thu Apr 14 18:47:07 2016 @@ -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 struct Outer { struct Inner { @@ -41,7 +43,10 @@ class A { UndeclaredSoFar x; // expected-error {{unknown type name 'UndeclaredSoFar'}} void a_member(); - friend void A::a_member(); // expected-error {{friends cannot be members of the declaring class}} + friend void A::a_member(); +#if __cplusplus <= 199711L + // expected-error@-2 {{friends cannot be members of the declaring class}} +#endif friend void a_member(); // okay (because we ignore class scopes when looking up friends) friend class A::AInner; // this is okay as an extension friend class AInner; // okay, refers to ::AInner Modified: cfe/trunk/test/CXX/class/class.friend/p2.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class/class.friend/p2.cpp?rev=266387&r1=266386&r2=266387&view=diff == --- cfe/trunk/test/CXX/class/class.friend/p2.cpp (original) +++ cfe/trunk/test/CXX/class/class.friend/p2.cpp Thu Apr 14 18:47:07 2016 @@ -1,10 +1,18 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -
Re: [PATCH] D19131: Lit C++11 Compatibility Patch #8
tigerleapgorge closed this revision. tigerleapgorge added a comment. Committed to Trunk in r266387 http://reviews.llvm.org/D19131 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D20710: Lit C++11 Compatibility Patch #9
tigerleapgorge created this revision. tigerleapgorge added a reviewer: rsmith. tigerleapgorge added a subscriber: cfe-commits. Hi everyone, I am back again with Lit test C++11 compatibility patch #9. 30 tests are updated this time. They are follows. CXX/basic/basic.stc/basic.stc.dynamic/p2-noexceptions.cpp Operator delete’s throwing prototype has changed. (C++ standard 18.6 [support.dynamic]) C++98 prototype: void operator delete (void* ptr) throw(); C++11 prototype: void operator delete (void* ptr) noexcept; This test redeclares operator delete without “noexcept” Added the following expected Warning for C++11 (2 instances) C++11: warning: function previously declared with an explicit exception specification redeclared with an implicit exception specification [-Wimplicit-exception-spec-mismatch] CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp Operator new’s throwing prototype has changed: C++98 prototype: void* operator new (std::size_t size) throw (std::bad_alloc); C++11 prototype: void* operator new (std::size_t size); This test declares operator new with “throw(std::bad_alloc)” then redeclares operator new again without a throw. In C++11 the redeclaration is the same as the prototype. Restricted the following to warning C++98. C++98: warning: 'operator new' is missing exception specification 'throw(std::bad_alloc)' [-Wmissing-exception-spec] note: previous declaration is here Operator delete’s throwing prototype has also changed (see previous test p2-noexceptions.cpp for prototypes): This test declares operator delete with “throw()”, then redeclares operator delete without a throw. Expect the following change in diagnostics. C++98: warning: 'operator delete' is missing exception specification 'throw()' [-Wmissing-exception-spec] note: previous declaration is here C++11: warning: function previously declared with an explicit exception specification redeclared with an implicit exception specification [-Wimplicit-exception-spec-mismatch] note: previous declaration is here CXX/class.access/class.friend/p1.cpp This test verifies when a class befriends another class. C++11’s “constexpr” feature interferes with Clang’s “befriend implicitly-declared members” feature. This test contains 2 parts: test6 and test7. Test6: (r101122 – “Allow classes to befriend implicitly-declared members.”) Struct A is declared as POD. Struct B befriends A’s implicitly-declared constructor. This amounts to a re-declaration of struct A with a different const-ness. Therefore, add the following diagnostics to the expected diagnostics. C++11: error: non-constexpr declaration of 'A' follows constexpr declaration note: previous declaration is here For test7: (r101173 – “Support befriending members of class template specializations.”) This test is intended to verify A’s private constructor inside struct template X’s specialization. However, struct X’s constructor and destructor are explicitly declared, struct X’s copy-constructor is implicitly declared. When class A befriends X’s implicitly declared copy-constructor, Clang issues a similar error to that of test 6. But, this error stops the generation of subsequent errors. Since the intended target of this test are the subsequent errors, I added a struct X copy constructor declaration to stop the first error. CXX/class.access/p4.cpp When constructing a class that contains a member that cannot be initialized, C++98 and C++11 issues similar diagnostics but in opposite order. C++98 messages begin with the innermost member that failed to initialize. C++11 messages begin with the outermost constructor that was implicitly deleted. The diff here is quite large. It has 3 parts. Test2: Change in diagnostics. (2 sets) C++98: error: base class 'test2::A' has private default constructor note: declared private here note: implicit default constructor for 'test2::B' first required here C++11: error: call to implicitly-deleted default constructor of 'test2::B' note: default constructor of 'B' is implicitly deleted because base class 'test2::A' has an inaccessible default constructor C++98: error: inherited virtual base class 'test2::A' has private default constructor note: declared private here note: implicit default constructor for 'test2::D' first required here C++11: error: call to implicitly-deleted default constructor of 'test2::D' note: default constructor of 'D' is implicitly deleted because base class 'test2::A' has an inaccessible default constructor Test3: Massive reduction in diagnostics issued. Class template “Base” has a priva
Re: [PATCH] D20710: Lit C++11 Compatibility Patch #9
tigerleapgorge updated this revision to Diff 60385. tigerleapgorge added a comment. Forgot to provide context last time. Last patch was created using command: svn diff This patch was created using command: svn diff --diff-cmd=diff -x -U99 http://reviews.llvm.org/D20710 Files: test/CXX/basic/basic.stc/basic.stc.dynamic/p2-noexceptions.cpp test/CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp test/CXX/class.access/class.friend/p1.cpp test/CXX/class.access/p4.cpp test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p4.cpp test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x-fixits.cpp test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp test/CXX/dcl.decl/dcl.init/p5.cpp test/CXX/special/class.dtor/p9.cpp test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp test/CXX/temp/temp.spec/temp.expl.spec/p4.cpp test/CXX/temp/temp.spec/temp.explicit/p4.cpp 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,74 @@ } 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}} +#ifdef MSABI +// expected-note@-6 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}} +#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/SemaT
[PATCH] D21626: Lit C++11 Compatibility Patch #10
tigerleapgorge created this revision. tigerleapgorge added a reviewer: rsmith. tigerleapgorge added a subscriber: cfe-commits. Hi Everyone, I am continuing with updating the Lit tests for C++11 compatibility. 11 tests this time. test/Modules/Inputs/merge-using-decls/a.h test/Modules/Inputs/merge-using-decls/b.h test/Modules/merge-using-decls.cpp This test verifies the interaction between Modules and Using declarations. Part of this test, template struct “E” checks for mismatch between using declarations in a.h and Access declarations in b.h. Since C++11 has deprecated Access declarations, module “B” will fail to build. Therefore, I have restricted this part of the test to only use C++98. 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 ('}') 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/PR9572.cpp This test verifies 2 types of diagnostics. Type 1: Warning for unsupported C++11 feature when compiling at C++98. Guard the following Warning under C++98. C++98: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions] Type 2: Errors when derived class inherit a private virtual destructor in the base class. Class Base has a private virtual destructor. Struct Foo inherits Base. Foo does not explicitly declare a destructor. Struct Bar inherits Foo. Bar explicitly declares a destructor. Struct Baz contains an instance of Foo as its member. Because C++11 introduced ‘delete’, this results in the following changes in diagnostics. C++98 issues 1 Error on Base’s private destructor. C++11 issues 4 Errors at all points of the inheritance chain where the destructor is implicitly deleted. C++98: error: base class 'Base' has private destructor note: implicitly declared private here note: implicit destructor for 'Foo' first required here C++11: error: deleted function '~Foo' cannot override a non-deleted function note: overridden virtual function is here C++11: error: non-deleted function '~Bar' cannot override a deleted function note: overridden virtual function is here C++11: error: attempt to use a deleted function note: destructor of 'Foo' is implicitly deleted because base class 'Base' has an inaccessible destructor C++11: error: attempt to use a deleted function note: destructor of 'Foo' is implicitly deleted because base class 'Base' has an inaccessible destructor test/SemaCXX/default-assignment-operator.cpp C++11 introduced ‘delete’. Change in diagnostics regarding implicitly deleted copy assignment operator. This test change contains 3 parts: Test1, Test5, ProtectedCheck. Test1 Class Base has a member “int &ref” that is never initialized. Class X is derived from Base. Neither Base nor X
r253371 - [Lit Test] Updated 34 Lit tests to be C++11 compatible.
Author: lcharles Date: Tue Nov 17 14:25:05 2015 New Revision: 253371 URL: http://llvm.org/viewvc/llvm-project?rev=253371&view=rev Log: [Lit Test] Updated 34 Lit tests to be C++11 compatible. Added expected diagnostics new to C++11. Expanded RUN line to: default, C++98/03 and C++11. Modified: cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp cfe/trunk/test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp cfe/trunk/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p2.cpp cfe/trunk/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp cfe/trunk/test/CXX/temp/temp.decls/temp.class/temp.static/p1-inst.cpp cfe/trunk/test/CXX/temp/temp.decls/temp.class/temp.static/p1.cpp cfe/trunk/test/CXX/temp/temp.param/p3.cpp cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p1.cpp cfe/trunk/test/OpenMP/for_reduction_messages.cpp cfe/trunk/test/OpenMP/for_simd_reduction_messages.cpp cfe/trunk/test/OpenMP/parallel_for_reduction_messages.cpp cfe/trunk/test/OpenMP/parallel_for_simd_reduction_messages.cpp cfe/trunk/test/OpenMP/parallel_reduction_messages.cpp cfe/trunk/test/OpenMP/parallel_sections_reduction_messages.cpp cfe/trunk/test/OpenMP/sections_reduction_messages.cpp cfe/trunk/test/OpenMP/simd_reduction_messages.cpp cfe/trunk/test/OpenMP/teams_reduction_messages.cpp cfe/trunk/test/SemaCXX/constructor-initializer.cpp cfe/trunk/test/SemaCXX/converting-constructor.cpp cfe/trunk/test/SemaCXX/crashes.cpp cfe/trunk/test/SemaCXX/default1.cpp cfe/trunk/test/SemaCXX/direct-initializer.cpp cfe/trunk/test/SemaCXX/expressions.cpp cfe/trunk/test/SemaCXX/namespace.cpp cfe/trunk/test/SemaCXX/overload-call-copycon.cpp cfe/trunk/test/SemaCXX/overloaded-builtin-operators.cpp cfe/trunk/test/SemaCXX/vector.cpp cfe/trunk/test/SemaTemplate/class-template-ctor-initializer.cpp cfe/trunk/test/SemaTemplate/constructor-template.cpp cfe/trunk/test/SemaTemplate/default-expr-arguments.cpp cfe/trunk/test/SemaTemplate/fun-template-def.cpp cfe/trunk/test/SemaTemplate/qualified-names-diag.cpp Modified: cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp?rev=253371&r1=253370&r2=253371&view=diff == --- cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp (original) +++ cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp Tue Nov 17 14:25:05 2015 @@ -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 namespace A { class A { @@ -20,6 +22,9 @@ namespace D { namespace C { class C {}; // expected-note {{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'B::B' to 'const C::C &' for 1st argument}} +#if __cplusplus >= 201103L // C++11 or later + // expected-note@-2 {{candidate constructor (the implicit move constructor) not viable: no known conversion from 'B::B' to 'C::C &&' for 1st argument}} +#endif void func(C); // expected-note {{'C::func' declared here}} \ // expected-note {{passing argument to parameter here}} C operator+(C,C); Modified: cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp?rev=253371&r1=253370&r2=253371&view=diff == --- cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp (original) +++ cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp Tue Nov 17 14:25:05 2015 @@ -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 namespace Ints { int zero = 0; // expected-note {{candidate found by name lookup is 'Ints::zero'}} @@ -31,7 +33,11 @@ void test() { } namespace Numbers { - struct Number { // expected-note 2 {{candidate}} + struct Number { // expected-note 2 {{candidate constructor (the implicit copy constructor) not viable}} +#if __cplusplus >= 201103L // C++11 or later + // expected-note@-2 2 {{candidate constructor (the implicit move constructor) not viable}} +#endif + explicit Number(double d) : d(d) {} double d; }; @@ -66,7 +72,11 @@ void test3() { namespace inline_ns { int x; // expected-note 2{{found}} - inline namespace A { // expected-warning {{C++11}} + inline namespace A { +#if __cplusplus <= 199711L // C++03 or earlier + //
r255196 - [Lit Test] Updated 20 Lit tests to be C++11 compatible.
Author: lcharles Date: Wed Dec 9 19:07:17 2015 New Revision: 255196 URL: http://llvm.org/viewvc/llvm-project?rev=255196&view=rev Log: [Lit Test] Updated 20 Lit tests to be C++11 compatible. This is the 5th Lit test patch. Expanded expected diagnostics to vary by C++ dialect. Expanded RUN line to: default, C++98/03 and C++11. Modified: cfe/trunk/test/CXX/class/class.nest/p1.cpp cfe/trunk/test/Parser/cxx-casting.cpp cfe/trunk/test/Parser/cxx-reference.cpp cfe/trunk/test/Parser/cxx-template-argument.cpp cfe/trunk/test/Parser/cxx-typeof.cpp cfe/trunk/test/Parser/objc-init.m cfe/trunk/test/Parser/objcxx-lambda-expressions-neg.mm cfe/trunk/test/SemaCXX/decl-expr-ambiguity.cpp cfe/trunk/test/SemaCXX/overload-call.cpp cfe/trunk/test/SemaCXX/pragma-init_seg.cpp cfe/trunk/test/SemaCXX/typo-correction-delayed.cpp cfe/trunk/test/SemaCXX/unknown-type-name.cpp cfe/trunk/test/SemaCXX/writable-strings-deprecated.cpp cfe/trunk/test/SemaObjCXX/message.mm cfe/trunk/test/SemaTemplate/instantiate-function-2.cpp cfe/trunk/test/SemaTemplate/instantiate-static-var.cpp cfe/trunk/test/SemaTemplate/nested-name-spec-template.cpp cfe/trunk/test/SemaTemplate/overload-candidates.cpp cfe/trunk/test/SemaTemplate/partial-spec-instantiate.cpp cfe/trunk/test/SemaTemplate/temp_arg_template.cpp Modified: cfe/trunk/test/CXX/class/class.nest/p1.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class/class.nest/p1.cpp?rev=255196&r1=255195&r2=255196&view=diff == --- cfe/trunk/test/CXX/class/class.nest/p1.cpp (original) +++ cfe/trunk/test/CXX/class/class.nest/p1.cpp Wed Dec 9 19:07:17 2015 @@ -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 class Outer { int x; @@ -7,7 +9,10 @@ class Outer { // C++11 does relax this rule (see 5.1.1.10) in the first case, but we need to enforce it in C++03 mode. class Inner { -static char a[sizeof(x)]; // expected-error {{invalid use of non-static data member 'x'}} +static char a[sizeof(x)]; +#if __cplusplus <= 199711L +// expected-error@-2 {{invalid use of non-static data member 'x'}} +#endif static char b[sizeof(sx)]; // okay static char c[sizeof(f)]; // expected-error {{call to non-static member function without an object argument}} }; Modified: cfe/trunk/test/Parser/cxx-casting.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-casting.cpp?rev=255196&r1=255195&r2=255196&view=diff == --- cfe/trunk/test/Parser/cxx-casting.cpp (original) +++ cfe/trunk/test/Parser/cxx-casting.cpp Wed Dec 9 19:07:17 2015 @@ -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 char *const_cast_test(const char *var) { @@ -41,10 +43,25 @@ namespace test1 { typedef char* c; typedef A* a; void test2(char x, struct B * b) { - (void)const_cast<::c>(&x); // expected-error{{found '<::' after a const_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} - (void)dynamic_cast<::a>(b); // expected-error{{found '<::' after a dynamic_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} - (void)reinterpret_cast<::c>(x); // expected-error{{found '<::' after a reinterpret_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} - (void)static_cast<::c>(&x); // expected-error{{found '<::' after a static_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} + (void)const_cast<::c>(&x); +#if __cplusplus <= 199711L + // expected-error@-2 {{found '<::' after a const_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} +#endif + + (void)dynamic_cast<::a>(b); +#if __cplusplus <= 199711L + // expected-error@-2 {{found '<::' after a dynamic_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} +#endif + + (void)reinterpret_cast<::c>(x); +#if __cplusplus <= 199711L + // expected-error@-2 {{found '<::' after a reinterpret_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} +#endif + + (void)static_cast<::c>(&x); +#if __cplusplus <= 199711L + // expected-error@-2 {{found '<::' after a static_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} +#endif // Do not do digraph correction. (void)static_cast<: :c>(&x); //\ @@ -64,8 +81,15 @@ void test2(char x, struct B * b) { (void)static_cast<:C c>(&x); // expected-error {{expected '<' after 'static_cast'}} expected-error 2{{}} expected-note{{}} #define LCC <:: - test1::A LCC B> e; // expected-error{{found '<::' after a template name