1//===-- LangStandards.def - Language Standard Data --------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LANGSTANDARD
10#error "LANGSTANDARD must be defined before including this file"
11#endif
12
13/// LANGSTANDARD(IDENT, NAME, LANG, DESC, FEATURES)
14///
15/// \param IDENT - The name of the standard as a C++ identifier.
16/// \param NAME - The name of the standard.
17/// \param LANG - The Language for which this is a standard.
18/// \param DESC - A short description of the standard.
19/// \param FEATURES - The standard features as flags, these are enums from the
20/// clang::frontend namespace, which is assumed to be be available.
21
22/// LANGSTANDARD_ALIAS(IDENT, ALIAS)
23/// \param IDENT - The name of the standard as a C++ identifier.
24/// \param ALIAS - The alias of the standard.
25
26/// LANGSTANDARD_ALIAS_DEPR(IDENT, ALIAS)
27/// Same as LANGSTANDARD_ALIAS, but for a deprecated alias.
28
29#ifndef LANGSTANDARD_ALIAS
30#define LANGSTANDARD_ALIAS(IDENT, ALIAS)
31#endif
32
33#ifndef LANGSTANDARD_ALIAS_DEPR
34#define LANGSTANDARD_ALIAS_DEPR(IDENT, ALIAS) LANGSTANDARD_ALIAS(IDENT, ALIAS)
35#endif
36
37// C89-ish modes.
38LANGSTANDARD(c89, "c89",
39             C, "ISO C 1990",
40             ImplicitInt)
41LANGSTANDARD_ALIAS(c89, "c90")
42LANGSTANDARD_ALIAS(c89, "iso9899:1990")
43
44LANGSTANDARD(c94, "iso9899:199409",
45             C, "ISO C 1990 with amendment 1",
46             Digraphs | ImplicitInt)
47
48LANGSTANDARD(gnu89, "gnu89",
49             C, "ISO C 1990 with GNU extensions",
50             LineComment | Digraphs | GNUMode | ImplicitInt)
51LANGSTANDARD_ALIAS(gnu89, "gnu90")
52
53// C99-ish modes
54LANGSTANDARD(c99, "c99",
55             C, "ISO C 1999",
56             LineComment | C99 | Digraphs | HexFloat)
57LANGSTANDARD_ALIAS(c99, "iso9899:1999")
58LANGSTANDARD_ALIAS_DEPR(c99, "c9x")
59LANGSTANDARD_ALIAS_DEPR(c99, "iso9899:199x")
60
61LANGSTANDARD(gnu99, "gnu99",
62             C, "ISO C 1999 with GNU extensions",
63             LineComment | C99 | Digraphs | GNUMode | HexFloat)
64LANGSTANDARD_ALIAS_DEPR(gnu99, "gnu9x")
65
66// C11 modes
67LANGSTANDARD(c11, "c11",
68             C, "ISO C 2011",
69             LineComment | C99 | C11 | Digraphs | HexFloat)
70LANGSTANDARD_ALIAS(c11, "iso9899:2011")
71LANGSTANDARD_ALIAS_DEPR(c11, "c1x")
72LANGSTANDARD_ALIAS_DEPR(c11, "iso9899:201x")
73
74LANGSTANDARD(gnu11, "gnu11",
75             C, "ISO C 2011 with GNU extensions",
76             LineComment | C99 | C11 | Digraphs | GNUMode | HexFloat)
77LANGSTANDARD_ALIAS_DEPR(gnu11, "gnu1x")
78
79// C17 modes
80LANGSTANDARD(c17, "c17",
81             C, "ISO C 2017",
82             LineComment | C99 | C11 | C17 | Digraphs | HexFloat)
83LANGSTANDARD_ALIAS(c17, "iso9899:2017")
84LANGSTANDARD_ALIAS(c17, "c18")
85LANGSTANDARD_ALIAS(c17, "iso9899:2018")
86LANGSTANDARD(gnu17, "gnu17",
87             C, "ISO C 2017 with GNU extensions",
88             LineComment | C99 | C11 | C17 | Digraphs | GNUMode | HexFloat)
89LANGSTANDARD_ALIAS(gnu17, "gnu18")
90
91// C2x modes
92LANGSTANDARD(c2x, "c2x",
93             C, "Working Draft for ISO C2x",
94             LineComment | C99 | C11 | C17 | C2x | Digraphs | HexFloat)
95LANGSTANDARD(gnu2x, "gnu2x",
96             C, "Working Draft for ISO C2x with GNU extensions",
97             LineComment | C99 | C11 | C17 | C2x | Digraphs | GNUMode | HexFloat)
98
99// C++ modes
100LANGSTANDARD(cxx98, "c++98",
101             CXX, "ISO C++ 1998 with amendments",
102             LineComment | CPlusPlus | Digraphs)
103LANGSTANDARD_ALIAS(cxx98, "c++03")
104
105LANGSTANDARD(gnucxx98, "gnu++98",
106             CXX, "ISO C++ 1998 with amendments and GNU extensions",
107             LineComment | CPlusPlus | Digraphs | GNUMode)
108LANGSTANDARD_ALIAS(gnucxx98, "gnu++03")
109
110LANGSTANDARD(cxx11, "c++11",
111             CXX, "ISO C++ 2011 with amendments",
112             LineComment | CPlusPlus | CPlusPlus11 | Digraphs)
113LANGSTANDARD_ALIAS_DEPR(cxx11, "c++0x")
114
115LANGSTANDARD(gnucxx11, "gnu++11", CXX,
116             "ISO C++ 2011 with amendments and GNU extensions",
117             LineComment | CPlusPlus | CPlusPlus11 | Digraphs | GNUMode)
118LANGSTANDARD_ALIAS_DEPR(gnucxx11, "gnu++0x")
119
120LANGSTANDARD(cxx14, "c++14",
121             CXX, "ISO C++ 2014 with amendments",
122             LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | Digraphs)
123LANGSTANDARD_ALIAS_DEPR(cxx14, "c++1y")
124
125LANGSTANDARD(gnucxx14, "gnu++14",
126             CXX, "ISO C++ 2014 with amendments and GNU extensions",
127             LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | Digraphs |
128             GNUMode)
129LANGSTANDARD_ALIAS_DEPR(gnucxx14, "gnu++1y")
130
131LANGSTANDARD(cxx17, "c++17",
132             CXX, "ISO C++ 2017 with amendments",
133             LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
134             Digraphs | HexFloat)
135LANGSTANDARD_ALIAS_DEPR(cxx17, "c++1z")
136
137LANGSTANDARD(gnucxx17, "gnu++17",
138             CXX, "ISO C++ 2017 with amendments and GNU extensions",
139             LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
140             Digraphs | HexFloat | GNUMode)
141LANGSTANDARD_ALIAS_DEPR(gnucxx17, "gnu++1z")
142
143LANGSTANDARD(cxx20, "c++20",
144             CXX, "ISO C++ 2020 DIS",
145             LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
146             CPlusPlus20 | Digraphs | HexFloat)
147LANGSTANDARD_ALIAS_DEPR(cxx20, "c++2a")
148
149LANGSTANDARD(gnucxx20, "gnu++20",
150             CXX, "ISO C++ 2020 DIS with GNU extensions",
151             LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
152             CPlusPlus20 | Digraphs | HexFloat | GNUMode)
153LANGSTANDARD_ALIAS_DEPR(gnucxx20, "gnu++2a")
154
155LANGSTANDARD(cxx2b, "c++2b",
156             CXX, "Working draft for ISO C++ 2023 DIS",
157             LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
158             CPlusPlus20 | CPlusPlus2b | Digraphs | HexFloat)
159
160LANGSTANDARD(gnucxx2b, "gnu++2b",
161             CXX, "Working draft for ISO C++ 2023 DIS with GNU extensions",
162             LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
163             CPlusPlus20 | CPlusPlus2b | Digraphs | HexFloat | GNUMode)
164
165// OpenCL
166LANGSTANDARD(opencl10, "cl1.0",
167             OpenCL, "OpenCL 1.0",
168             LineComment | C99 | Digraphs | HexFloat | OpenCL)
169LANGSTANDARD_ALIAS_DEPR(opencl10, "cl")
170
171LANGSTANDARD(opencl11, "cl1.1",
172             OpenCL, "OpenCL 1.1",
173             LineComment | C99 | Digraphs | HexFloat | OpenCL)
174LANGSTANDARD(opencl12, "cl1.2",
175             OpenCL, "OpenCL 1.2",
176             LineComment | C99 | Digraphs | HexFloat | OpenCL)
177LANGSTANDARD(opencl20, "cl2.0",
178             OpenCL, "OpenCL 2.0",
179             LineComment | C99 | Digraphs | HexFloat | OpenCL)
180LANGSTANDARD(opencl30, "cl3.0",
181             OpenCL, "OpenCL 3.0",
182             LineComment | C99 | Digraphs | HexFloat | OpenCL)
183LANGSTANDARD(openclcpp, "clc++",
184             OpenCL, "C++ for OpenCL",
185             LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
186             Digraphs | HexFloat | OpenCL)
187
188LANGSTANDARD_ALIAS_DEPR(opencl10, "CL")
189LANGSTANDARD_ALIAS_DEPR(opencl11, "CL1.1")
190LANGSTANDARD_ALIAS_DEPR(opencl12, "CL1.2")
191LANGSTANDARD_ALIAS_DEPR(opencl20, "CL2.0")
192LANGSTANDARD_ALIAS_DEPR(opencl30, "CL3.0")
193LANGSTANDARD_ALIAS_DEPR(openclcpp, "CLC++")
194
195// CUDA
196LANGSTANDARD(cuda, "cuda", CUDA, "NVIDIA CUDA(tm)",
197             LineComment | CPlusPlus | Digraphs)
198
199// HIP
200LANGSTANDARD(hip, "hip", HIP, "HIP",
201             LineComment | CPlusPlus | Digraphs)
202
203#undef LANGSTANDARD
204#undef LANGSTANDARD_ALIAS
205#undef LANGSTANDARD_ALIAS_DEPR
206