diff options
author | Xiang Li <python3kgae@outlook.com> | 2022-07-15 10:45:57 -0700 |
---|---|---|
committer | Xiang Li <python3kgae@outlook.com> | 2022-09-21 10:07:43 -0700 |
commit | 782ac2182c2b02de775c0f5a3d935613f2b748f5 (patch) | |
tree | 55127bbcb01ad97421cdcfeff44665606e075319 /clang/lib/Basic/IdentifierTable.cpp | |
parent | 1f4d3c681c9552f9b0327a9c6d9db6c2153fc459 (diff) | |
download | llvm-782ac2182c2b02de775c0f5a3d935613f2b748f5.zip llvm-782ac2182c2b02de775c0f5a3d935613f2b748f5.tar.gz llvm-782ac2182c2b02de775c0f5a3d935613f2b748f5.tar.bz2 |
[HLSL] Support cbuffer/tbuffer for hlsl.
This is first part for support cbuffer/tbuffer.
The format for cbuffer/tbuffer is
BufferType [Name] [: register(b#)] { VariableDeclaration [: packoffset(c#.xyzw)]; ... };
More details at https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-constants
New keyword 'cbuffer' and 'tbuffer' are added.
New AST node HLSLBufferDecl is added.
Build AST for simple cbuffer/tbuffer without attribute support.
The special thing is variables declared inside cbuffer is exposed into global scope.
So isTransparentContext should return true for HLSLBuffer.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D129883
Diffstat (limited to 'clang/lib/Basic/IdentifierTable.cpp')
-rw-r--r-- | clang/lib/Basic/IdentifierTable.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Basic/IdentifierTable.cpp b/clang/lib/Basic/IdentifierTable.cpp index 2035ca2..63b08d8 100644 --- a/clang/lib/Basic/IdentifierTable.cpp +++ b/clang/lib/Basic/IdentifierTable.cpp @@ -109,7 +109,8 @@ namespace { KEYMSCOMPAT = 0x400000, KEYSYCL = 0x800000, KEYCUDA = 0x1000000, - KEYMAX = KEYCUDA, // The maximum key + KEYHLSL = 0x2000000, + KEYMAX = KEYHLSL, // The maximum key KEYALLCXX = KEYCXX | KEYCXX11 | KEYCXX20, KEYALL = (KEYMAX | (KEYMAX-1)) & ~KEYNOMS18 & ~KEYNOOPENCL // KEYNOMS18 and KEYNOOPENCL are used to exclude. @@ -199,6 +200,8 @@ static KeywordStatus getKeywordStatusHelper(const LangOptions &LangOpts, return LangOpts.isSYCL() ? KS_Enabled : KS_Unknown; case KEYCUDA: return LangOpts.CUDA ? KS_Enabled : KS_Unknown; + case KEYHLSL: + return LangOpts.HLSL ? KS_Enabled : KS_Unknown; case KEYNOCXX: // This is enabled in all non-C++ modes, but might be enabled for other // reasons as well. |