[all-commits] [llvm/llvm-project] 782ac2: [HLSL] Support cbuffer/tbuffer for hlsl.

Xiang Li via All-commits all-commits at lists.llvm.org
Wed Sep 21 10:08:01 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 782ac2182c2b02de775c0f5a3d935613f2b748f5
      https://github.com/llvm/llvm-project/commit/782ac2182c2b02de775c0f5a3d935613f2b748f5
  Author: Xiang Li <python3kgae at outlook.com>
  Date:   2022-09-21 (Wed, 21 Sep 2022)

  Changed paths:
    M clang/include/clang/AST/Decl.h
    M clang/include/clang/AST/JSONNodeDumper.h
    M clang/include/clang/AST/RecursiveASTVisitor.h
    M clang/include/clang/AST/TextNodeDumper.h
    M clang/include/clang/Basic/DeclNodes.td
    M clang/include/clang/Basic/DiagnosticParseKinds.td
    M clang/include/clang/Basic/TokenKinds.def
    M clang/include/clang/Parse/Parser.h
    M clang/include/clang/Sema/Sema.h
    M clang/include/clang/Serialization/ASTBitCodes.h
    M clang/lib/AST/Decl.cpp
    M clang/lib/AST/DeclBase.cpp
    M clang/lib/AST/DeclPrinter.cpp
    M clang/lib/AST/JSONNodeDumper.cpp
    M clang/lib/AST/TextNodeDumper.cpp
    M clang/lib/Basic/IdentifierTable.cpp
    M clang/lib/Parse/ParseDecl.cpp
    M clang/lib/Parse/ParseHLSL.cpp
    M clang/lib/Parse/Parser.cpp
    M clang/lib/Sema/CMakeLists.txt
    M clang/lib/Sema/IdentifierResolver.cpp
    M clang/lib/Sema/SemaDecl.cpp
    A clang/lib/Sema/SemaHLSL.cpp
    M clang/lib/Sema/SemaLookup.cpp
    M clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
    M clang/lib/Serialization/ASTCommon.cpp
    M clang/lib/Serialization/ASTReaderDecl.cpp
    M clang/lib/Serialization/ASTWriter.cpp
    M clang/lib/Serialization/ASTWriterDecl.cpp
    A clang/test/AST/HLSL/Inputs/empty.hlsl
    A clang/test/AST/HLSL/ast-dump-comment-cbuffe-tbufferr.hlsl
    A clang/test/AST/HLSL/cbuffer_tbuffer.hlsl
    A clang/test/AST/HLSL/pch_hlsl_buffer.hlsl
    A clang/test/ParserHLSL/cb_error.hlsl
    A clang/test/ParserHLSL/invalid_inside_cb.hlsl
    A clang/test/SemaHLSL/cb_error.hlsl

  Log Message:
  -----------
  [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




More information about the All-commits mailing list