diff options
author | Chris B <chris.bieneman@me.com> | 2024-09-13 16:11:19 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-13 16:11:19 -0500 |
commit | 2222e27d9e1438b0c723d46c62b1364391b58311 (patch) | |
tree | 6a1f8fa1f85911c2b921d2f54e8635f698f87874 /clang/lib/Sema/DeclSpec.cpp | |
parent | ebf25d9509d19a381d94a0383135ee37f5b7b6e2 (diff) | |
download | llvm-2222e27d9e1438b0c723d46c62b1364391b58311.zip llvm-2222e27d9e1438b0c723d46c62b1364391b58311.tar.gz llvm-2222e27d9e1438b0c723d46c62b1364391b58311.tar.bz2 |
[HLSL] Add HLSL 202y language mode (#108437)
This change adds a new HLSL 202y language mode. Currently HLSL 202y is
planned to add `auto` and `constexpr`.
This change updates extension diagnostics to state that lambadas are a
"clang HLSL" extension (since we have no planned release yet to include
them), and that `auto` is a HLSL 202y extension when used in earlier
language modes.
Note: This PR does temporarily work around some differences between HLSL
2021 and 202x in Clang by changing test cases to explicitly specify
202x. A subsequent PR will update 2021's language flags to match 202x.
Diffstat (limited to 'clang/lib/Sema/DeclSpec.cpp')
-rw-r--r-- | clang/lib/Sema/DeclSpec.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Sema/DeclSpec.cpp b/clang/lib/Sema/DeclSpec.cpp index 5272786..12d2d3f 100644 --- a/clang/lib/Sema/DeclSpec.cpp +++ b/clang/lib/Sema/DeclSpec.cpp @@ -1418,7 +1418,11 @@ void DeclSpec::Finish(Sema &S, const PrintingPolicy &Policy) { // specifier in a pre-C++11 dialect of C++ or in a pre-C23 dialect of C. if (!S.getLangOpts().CPlusPlus11 && !S.getLangOpts().C23 && TypeSpecType == TST_auto) - S.Diag(TSTLoc, diag::ext_auto_type_specifier); + S.Diag(TSTLoc, diag::ext_auto_type_specifier) << /*C++*/ 0; + if (S.getLangOpts().HLSL && + S.getLangOpts().getHLSLVersion() < LangOptions::HLSL_202y && + TypeSpecType == TST_auto) + S.Diag(TSTLoc, diag::ext_hlsl_auto_type_specifier) << /*HLSL*/ 1; if (S.getLangOpts().CPlusPlus && !S.getLangOpts().CPlusPlus11 && StorageClassSpec == SCS_auto) S.Diag(StorageClassSpecLoc, diag::warn_auto_storage_class) |