r320250 - Switch to gnu++14 as the default dialect.
Tim Northover via cfe-commits
cfe-commits at lists.llvm.org
Sat Dec 9 04:09:54 PST 2017
Author: tnorthover
Date: Sat Dec 9 04:09:54 2017
New Revision: 320250
URL: http://llvm.org/viewvc/llvm-project?rev=320250&view=rev
Log:
Switch to gnu++14 as the default dialect.
This is C++14 with conforming GNU extensions.
Modified:
cfe/trunk/docs/ReleaseNotes.rst
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/CodeGenCXX/new-overflow.cpp
cfe/trunk/test/CodeGenCXX/new.cpp
cfe/trunk/test/CodeGenCXX/vtable-available-externally.cpp
cfe/trunk/test/Lexer/cxx-features.cpp
cfe/trunk/test/Lexer/half-literal.cpp
cfe/trunk/test/OpenMP/taskloop_reduction_codegen.cpp
cfe/trunk/test/OpenMP/taskloop_simd_reduction_codegen.cpp
cfe/trunk/test/Parser/cxx1z-nested-namespace-definition.cpp
cfe/trunk/test/SemaCXX/new-array-size-conv.cpp
cfe/trunk/test/SemaCXX/new-delete.cpp
cfe/trunk/test/SemaCXX/unknown-type-name.cpp
cfe/trunk/test/SemaTemplate/class-template-decl.cpp
cfe/trunk/test/SemaTemplate/explicit-instantiation.cpp
Modified: cfe/trunk/docs/ReleaseNotes.rst
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=320250&r1=320249&r2=320250&view=diff
==============================================================================
--- cfe/trunk/docs/ReleaseNotes.rst (original)
+++ cfe/trunk/docs/ReleaseNotes.rst Sat Dec 9 04:09:54 2017
@@ -176,7 +176,10 @@ C11 Feature Support
C++ Language Changes in Clang
-----------------------------
-...
+- Clang's default C++ dialect is now ``gnu++14`` instead of ``gnu++98``. This
+ means Clang will by default accept code using features from C++14 and
+ conforming GNU extensions. Projects incompatible with C++14 can add
+ ``-std=gnu++98`` to their build settings to restore the previous behaviour.
C++1z Feature Support
^^^^^^^^^^^^^^^^^^^^^
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=320250&r1=320249&r2=320250&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Sat Dec 9 04:09:54 2017
@@ -1729,11 +1729,7 @@ void CompilerInvocation::setLangDefaults
break;
case InputKind::CXX:
case InputKind::ObjCXX:
- // The PS4 uses C++11 as the default C++ standard.
- if (T.isPS4())
- LangStd = LangStandard::lang_gnucxx11;
- else
- LangStd = LangStandard::lang_gnucxx98;
+ LangStd = LangStandard::lang_gnucxx14;
break;
case InputKind::RenderScript:
LangStd = LangStandard::lang_c99;
Modified: cfe/trunk/test/CodeGenCXX/new-overflow.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/new-overflow.cpp?rev=320250&r1=320249&r2=320250&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/new-overflow.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/new-overflow.cpp Sat Dec 9 04:09:54 2017
@@ -85,9 +85,7 @@ namespace test4 {
// CHECK: define [[A:%.*]]* @_ZN5test44testEs(i16 signext
// CHECK: [[N:%.*]] = sext i16 {{%.*}} to i32
- // CHECK-NEXT: [[T0:%.*]] = icmp slt i32 [[N]], 0
- // CHECK-NEXT: [[T1:%.*]] = select i1 [[T0]], i32 -1, i32 [[N]]
- // CHECK-NEXT: call i8* @_Znaj(i32 [[T1]])
+ // CHECK-NEXT: call i8* @_Znaj(i32 [[N]])
// CHECK: getelementptr inbounds {{.*}}, i32 [[N]]
elt *test(short s) {
return new elt[s];
@@ -104,9 +102,7 @@ namespace test5 {
// CHECK: define [[A:%.*]]* @_ZN5test54testEi(i32
// CHECK: [[N:%.*]] = load i32, i32*
- // CHECK-NEXT: [[T0:%.*]] = icmp slt i32 [[N]], 0
- // CHECK-NEXT: [[T1:%.*]] = select i1 [[T0]], i32 -1, i32 [[N]]
- // CHECK-NEXT: call i8* @_Znaj(i32 [[T1]])
+ // CHECK-NEXT: call i8* @_Znaj(i32 [[N]])
// CHECK: getelementptr inbounds {{.*}}, i32 [[N]]
elt *test(int s) {
return new elt[s];
@@ -169,13 +165,11 @@ namespace test8 {
// CHECK: define [[A:%.*]]* @_ZN5test84testEx(i64
// CHECK: [[N:%.*]] = load i64, i64*
- // CHECK-NEXT: [[T0:%.*]] = icmp uge i64 [[N]], 4294967296
// CHECK-NEXT: [[T1:%.*]] = trunc i64 [[N]] to i32
// CHECK-NEXT: [[T2:%.*]] = call { i32, i1 } @llvm.umul.with.overflow.i32(i32 [[T1]], i32 4)
// CHECK-NEXT: [[T3:%.*]] = extractvalue { i32, i1 } [[T2]], 1
- // CHECK-NEXT: [[T4:%.*]] = or i1 [[T0]], [[T3]]
// CHECK-NEXT: [[T5:%.*]] = extractvalue { i32, i1 } [[T2]], 0
- // CHECK-NEXT: [[T6:%.*]] = select i1 [[T4]], i32 -1, i32 [[T5]]
+ // CHECK-NEXT: [[T6:%.*]] = select i1 [[T3]], i32 -1, i32 [[T5]]
// CHECK-NEXT: call i8* @_Znaj(i32 [[T6]])
// CHECK: getelementptr inbounds {{.*}}, i32 [[T1]]
elt *test(long long s) {
@@ -194,13 +188,11 @@ namespace test9 {
// CHECK: define [[A:%.*]]* @_ZN5test94testEy(i64
// CHECK: [[N:%.*]] = load i64, i64*
- // CHECK-NEXT: [[T0:%.*]] = icmp uge i64 [[N]], 4294967296
// CHECK-NEXT: [[T1:%.*]] = trunc i64 [[N]] to i32
// CHECK-NEXT: [[T2:%.*]] = call { i32, i1 } @llvm.umul.with.overflow.i32(i32 [[T1]], i32 4)
// CHECK-NEXT: [[T3:%.*]] = extractvalue { i32, i1 } [[T2]], 1
- // CHECK-NEXT: [[T4:%.*]] = or i1 [[T0]], [[T3]]
// CHECK-NEXT: [[T5:%.*]] = extractvalue { i32, i1 } [[T2]], 0
- // CHECK-NEXT: [[T6:%.*]] = select i1 [[T4]], i32 -1, i32 [[T5]]
+ // CHECK-NEXT: [[T6:%.*]] = select i1 [[T3]], i32 -1, i32 [[T5]]
// CHECK-NEXT: call i8* @_Znaj(i32 [[T6]])
// CHECK: getelementptr inbounds {{.*}}, i32 [[T1]]
elt *test(unsigned long long s) {
Modified: cfe/trunk/test/CodeGenCXX/new.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/new.cpp?rev=320250&r1=320249&r2=320250&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/new.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/new.cpp Sat Dec 9 04:09:54 2017
@@ -255,8 +255,6 @@ namespace test15 {
// CHECK-LABEL: define void @_ZN6test155test2EPvi(
// CHECK: [[N:%.*]] = load i32, i32*
// CHECK-NEXT: [[T0:%.*]] = sext i32 [[N]] to i64
- // CHECK-NEXT: [[T1:%.*]] = icmp slt i64 [[T0]], 0
- // CHECK-NEXT: [[T2:%.*]] = select i1 [[T1]], i64 -1, i64 [[T0]]
// CHECK-NEXT: [[P:%.*]] = load i8*, i8**
// CHECK: [[BEGIN:%.*]] = bitcast i8* [[P]] to [[A:%.*]]*
// CHECK-NEXT: [[ISEMPTY:%.*]] = icmp eq i64 [[T0]], 0
Modified: cfe/trunk/test/CodeGenCXX/vtable-available-externally.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/vtable-available-externally.cpp?rev=320250&r1=320249&r2=320250&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/vtable-available-externally.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/vtable-available-externally.cpp Sat Dec 9 04:09:54 2017
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -o %t
-// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -O2 -disable-llvm-passes -emit-llvm -o %t.opt
+// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -std=c++98 -emit-llvm -o %t
+// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -std=c++98 -O2 -disable-llvm-passes -emit-llvm -o %t.opt
// RUN: FileCheck --check-prefix=CHECK-TEST1 %s < %t
// RUN: FileCheck --check-prefix=CHECK-TEST2 %s < %t
// RUN: FileCheck --check-prefix=CHECK-TEST5 %s < %t
Modified: cfe/trunk/test/Lexer/cxx-features.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/cxx-features.cpp?rev=320250&r1=320249&r2=320250&view=diff
==============================================================================
--- cfe/trunk/test/Lexer/cxx-features.cpp (original)
+++ cfe/trunk/test/Lexer/cxx-features.cpp Sat Dec 9 04:09:54 2017
@@ -4,8 +4,8 @@
// RUN: %clang_cc1 -std=c++14 -fcxx-exceptions -fsized-deallocation -verify %s
// RUN: %clang_cc1 -std=c++1z -fcxx-exceptions -fsized-deallocation -verify %s
// RUN: %clang_cc1 -std=c++1z -fcxx-exceptions -fsized-deallocation -fconcepts-ts -DCONCEPTS_TS=1 -verify %s
-// RUN: %clang_cc1 -fno-rtti -fno-threadsafe-statics -verify %s -DNO_EXCEPTIONS -DNO_RTTI -DNO_THREADSAFE_STATICS
-// RUN: %clang_cc1 -fcoroutines-ts -DNO_EXCEPTIONS -DCOROUTINES -verify %s
+// RUN: %clang_cc1 -fno-rtti -fno-threadsafe-statics -verify %s -DNO_EXCEPTIONS -DNO_RTTI -DNO_THREADSAFE_STATICS -fsized-deallocation
+// RUN: %clang_cc1 -fcoroutines-ts -DNO_EXCEPTIONS -DCOROUTINES -verify -fsized-deallocation %s
// expected-no-diagnostics
Modified: cfe/trunk/test/Lexer/half-literal.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/half-literal.cpp?rev=320250&r1=320249&r2=320250&view=diff
==============================================================================
--- cfe/trunk/test/Lexer/half-literal.cpp (original)
+++ cfe/trunk/test/Lexer/half-literal.cpp Sat Dec 9 04:09:54 2017
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
-float a = 1.0h; // expected-error{{invalid suffix 'h' on floating constant}}
+float a = 1.0h; // expected-error{{no matching literal operator for call to 'operator""h' with argument of type 'long double' or 'const char *', and no matching literal operator template}}
float b = 1.0H; // expected-error{{invalid suffix 'H' on floating constant}}
_Float16 c = 1.f166; // expected-error{{invalid suffix 'f166' on floating constant}}
Modified: cfe/trunk/test/OpenMP/taskloop_reduction_codegen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/taskloop_reduction_codegen.cpp?rev=320250&r1=320249&r2=320250&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/taskloop_reduction_codegen.cpp (original)
+++ cfe/trunk/test/OpenMP/taskloop_reduction_codegen.cpp Sat Dec 9 04:09:54 2017
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fopenmp -x c++ %s -verify -debug-info-kind=limited -emit-llvm -o - -triple powerpc64le-unknown-linux-gnu | FileCheck %s
+// RUN: %clang_cc1 -fopenmp -x c++ %s -verify -debug-info-kind=limited -emit-llvm -o - -triple powerpc64le-unknown-linux-gnu -std=c++98 | FileCheck %s
// expected-no-diagnostics
struct S {
Modified: cfe/trunk/test/OpenMP/taskloop_simd_reduction_codegen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/taskloop_simd_reduction_codegen.cpp?rev=320250&r1=320249&r2=320250&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/taskloop_simd_reduction_codegen.cpp (original)
+++ cfe/trunk/test/OpenMP/taskloop_simd_reduction_codegen.cpp Sat Dec 9 04:09:54 2017
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fopenmp -x c++ %s -verify -debug-info-kind=limited -emit-llvm -o - -triple powerpc64le-unknown-linux-gnu | FileCheck %s
+// RUN: %clang_cc1 -fopenmp -x c++ %s -verify -debug-info-kind=limited -emit-llvm -o - -triple powerpc64le-unknown-linux-gnu -std=c++98 | FileCheck %s
// expected-no-diagnostics
struct S {
Modified: cfe/trunk/test/Parser/cxx1z-nested-namespace-definition.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx1z-nested-namespace-definition.cpp?rev=320250&r1=320249&r2=320250&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx1z-nested-namespace-definition.cpp (original)
+++ cfe/trunk/test/Parser/cxx1z-nested-namespace-definition.cpp Sat Dec 9 04:09:54 2017
@@ -1,5 +1,5 @@
// RUN: cp %s %t
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++98
// RUN: not %clang_cc1 -x c++ -fixit %t -Werror -DFIXIT
// RUN: %clang_cc1 -x c++ %t -DFIXIT
// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++17 -Wc++14-compat
Modified: cfe/trunk/test/SemaCXX/new-array-size-conv.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/new-array-size-conv.cpp?rev=320250&r1=320249&r2=320250&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/new-array-size-conv.cpp (original)
+++ cfe/trunk/test/SemaCXX/new-array-size-conv.cpp Sat Dec 9 04:09:54 2017
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify -std=gnu++98 %s
// RUN: %clang_cc1 -fsyntax-only -pedantic -verify -std=c++98 %s
// RUN: %clang_cc1 -fsyntax-only -pedantic -verify -std=c++11 %s
Modified: cfe/trunk/test/SemaCXX/new-delete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/new-delete.cpp?rev=320250&r1=320249&r2=320250&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/new-delete.cpp (original)
+++ cfe/trunk/test/SemaCXX/new-delete.cpp Sat Dec 9 04:09:54 2017
@@ -80,12 +80,21 @@ void bad_news(int *ip)
(void)new int[1.1];
#if __cplusplus <= 199711L
// expected-error at -2 {{array size expression must have integral or enumeration type, not 'double'}}
-#else
+#elif __cplusplus <= 201103L
// expected-error at -4 {{array size expression must have integral or unscoped enumeration type, not 'double'}}
+#else
+ // expected-warning at -6 {{implicit conversion from 'double' to 'unsigned int' changes value from 1.1 to 1}}
#endif
- (void)new int[1][i]; // expected-error {{only the first dimension}} expected-note {{read of non-const variable 'i' is not allowed in a constant expression}}
- (void)new (int[1][i]); // expected-error {{only the first dimension}} expected-note {{read of non-const variable 'i' is not allowed in a constant expression}}
+ (void)new int[1][i]; // expected-note {{read of non-const variable 'i' is not allowed in a constant expression}}
+ (void)new (int[1][i]); // expected-note {{read of non-const variable 'i' is not allowed in a constant expression}}
+#if __cplusplus <= 201103L
+ // expected-error at -3 {{only the first dimension}}
+ // expected-error at -3 {{only the first dimension}}
+#else
+ // expected-error at -6 {{array size is not a constant expression}}
+ // expected-error at -6 {{array size is not a constant expression}}
+#endif
(void)new (int[i]); // expected-warning {{when type is in parentheses}}
(void)new int(*(S*)0); // expected-error {{no viable conversion from 'S' to 'int'}}
(void)new int(1, 2); // expected-error {{excess elements in scalar initializer}}
@@ -94,13 +103,20 @@ void bad_news(int *ip)
(void)new const int; // expected-error {{default initialization of an object of const type 'const int'}}
(void)new float*(ip); // expected-error {{cannot initialize a new value of type 'float *' with an lvalue of type 'int *'}}
// Undefined, but clang should reject it directly.
- (void)new int[-1]; // expected-error {{array size is negative}}
+ (void)new int[-1];
+#if __cplusplus <= 201103L
+ // expected-error at -2 {{array size is negative}}
+#else
+ // expected-error at -4 {{array is too large}}
+#endif
(void)new int[2000000000]; // expected-error {{array is too large}}
(void)new int[*(S*)0];
#if __cplusplus <= 199711L
// expected-error at -2 {{array size expression must have integral or enumeration type, not 'S'}}
-#else
+#elif __cplusplus <= 201103L
// expected-error at -4 {{array size expression must have integral or unscoped enumeration type, not 'S'}}
+#else
+ // expected-error at -6 {{converting 'S' to incompatible type}}
#endif
(void)::S::new int; // expected-error {{expected unqualified-id}}
Modified: cfe/trunk/test/SemaCXX/unknown-type-name.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/unknown-type-name.cpp?rev=320250&r1=320249&r2=320250&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/unknown-type-name.cpp (original)
+++ cfe/trunk/test/SemaCXX/unknown-type-name.cpp Sat Dec 9 04:09:54 2017
@@ -95,7 +95,10 @@ template<typename T> int A<T>::h(T::type
template<typename T> int h(T::type, int); // expected-error{{missing 'typename'}}
template<typename T> int h(T::type x, char); // expected-error{{missing 'typename'}}
-template<typename T> int junk1(T::junk); // expected-warning{{variable templates are a C++14 extension}}
+template<typename T> int junk1(T::junk);
+#if __cplusplus <= 201103L
+// expected-warning at -2 {{variable templates are a C++14 extension}}
+#endif
template<typename T> int junk2(T::junk) throw(); // expected-error{{missing 'typename'}}
template<typename T> int junk3(T::junk) = delete; // expected-error{{missing 'typename'}}
#if __cplusplus <= 199711L
@@ -106,7 +109,11 @@ template<typename T> int junk4(T::junk j
// FIXME: We can tell this was intended to be a function because it does not
// have a dependent nested name specifier.
-template<typename T> int i(T::type, int()); // expected-warning{{variable templates are a C++14 extension}}
+template<typename T> int i(T::type, int());
+#if __cplusplus <= 201103L
+// expected-warning at -2 {{variable templates are a C++14 extension}}
+#endif
+
// FIXME: We know which type specifier should have been specified here. Provide
// a fix-it to add 'typename A<T>::type'
Modified: cfe/trunk/test/SemaTemplate/class-template-decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/class-template-decl.cpp?rev=320250&r1=320249&r2=320250&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/class-template-decl.cpp (original)
+++ cfe/trunk/test/SemaTemplate/class-template-decl.cpp Sat Dec 9 04:09:54 2017
@@ -57,8 +57,7 @@ void f() {
template<typename T> class X; // expected-error{{expression}}
}
-template<typename T> class X1 var; // expected-warning{{variable templates are a C++14 extension}} \
- // expected-error {{variable has incomplete type 'class X1'}} \
+template<typename T> class X1 var; // expected-error {{variable has incomplete type 'class X1'}} \
// expected-note {{forward declaration of 'X1'}}
namespace M {
Modified: cfe/trunk/test/SemaTemplate/explicit-instantiation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/explicit-instantiation.cpp?rev=320250&r1=320249&r2=320250&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/explicit-instantiation.cpp (original)
+++ cfe/trunk/test/SemaTemplate/explicit-instantiation.cpp Sat Dec 9 04:09:54 2017
@@ -124,10 +124,10 @@ namespace PR10086 {
namespace undefined_static_data_member {
template<typename T> struct A {
static int a; // expected-note {{here}}
- template<typename U> static int b; // expected-note {{here}} expected-warning {{extension}}
+ template<typename U> static int b; // expected-note {{here}} expected-warning 0+ {{extension}}
};
struct B {
- template<typename U> static int c; // expected-note {{here}} expected-warning {{extension}}
+ template<typename U> static int c; // expected-note {{here}} expected-warning 0+ {{extension}}
};
template int A<int>::a; // expected-error {{explicit instantiation of undefined static data member 'a' of class template 'undefined_static_data_member::A<int>'}}
@@ -137,14 +137,14 @@ namespace undefined_static_data_member {
template<typename T> struct C {
static int a;
- template<typename U> static int b; // expected-warning {{extension}}
+ template<typename U> static int b; // expected-warning 0+ {{extension}}
};
struct D {
- template<typename U> static int c; // expected-warning {{extension}}
+ template<typename U> static int c; // expected-warning 0+ {{extension}}
};
template<typename T> int C<T>::a;
- template<typename T> template<typename U> int C<T>::b; // expected-warning {{extension}}
- template<typename U> int D::c; // expected-warning {{extension}}
+ template<typename T> template<typename U> int C<T>::b; // expected-warning 0+ {{extension}}
+ template<typename U> int D::c; // expected-warning 0+ {{extension}}
template int C<int>::a;
template int C<int>::b<int>;
More information about the cfe-commits
mailing list