[PATCH] D103221: [HIP] Change default lang std to c++14
Yaxun Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 26 20:18:33 PDT 2021
yaxunl created this revision.
yaxunl added a reviewer: tra.
Herald added a subscriber: dexonsmith.
yaxunl requested review of this revision.
Currently clang and nvcc use c++14 as default std for C++.
gcc 11 even uses c++17 as default std for C++. However,
clang uses c++98 as default std for HIP.
As c++14 has been well adopted and became default for
clang, it seems reasonable to use c++14 as default std
for HIP.
https://reviews.llvm.org/D103221
Files:
clang/include/clang/Basic/LangStandards.def
clang/test/Preprocessor/lang-std.cu
Index: clang/test/Preprocessor/lang-std.cu
===================================================================
--- /dev/null
+++ clang/test/Preprocessor/lang-std.cu
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -dM -E -x hip %s | FileCheck -check-prefix=CXX14 %s
+// RUN: %clang_cc1 -dM -E %s | FileCheck -check-prefix=CXX98 %s
+// RUN: %clang_cc1 -dM -E -std=c++98 -x hip %s | FileCheck -check-prefix=CXX98 %s
+// RUN: %clang_cc1 -dM -E -std=c++14 %s | FileCheck -check-prefix=CXX14 %s
+
+// CXX98: #define __cplusplus 199711L
+// CXX14: #define __cplusplus 201402L
Index: clang/include/clang/Basic/LangStandards.def
===================================================================
--- clang/include/clang/Basic/LangStandards.def
+++ clang/include/clang/Basic/LangStandards.def
@@ -198,7 +198,7 @@
// HIP
LANGSTANDARD(hip, "hip", HIP, "HIP",
- LineComment | CPlusPlus | Digraphs)
+ LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | Digraphs)
#undef LANGSTANDARD
#undef LANGSTANDARD_ALIAS
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103221.348148.patch
Type: text/x-patch
Size: 1018 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210527/51fa021a/attachment.bin>
More information about the cfe-commits
mailing list