SemaHLSL.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. //===- SemaHLSL.cpp - Semantic Analysis for HLSL constructs ---------------===//
  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. // This implements Semantic Analysis for HLSL constructs.
  9. //===----------------------------------------------------------------------===//
  10. #include "clang/Sema/Sema.h"
  11. using namespace clang;
  12. Decl *Sema::ActOnStartHLSLBuffer(Scope *BufferScope, bool CBuffer,
  13. SourceLocation KwLoc, IdentifierInfo *Ident,
  14. SourceLocation IdentLoc,
  15. SourceLocation LBrace) {
  16. // For anonymous namespace, take the location of the left brace.
  17. DeclContext *LexicalParent = getCurLexicalContext();
  18. HLSLBufferDecl *Result = HLSLBufferDecl::Create(
  19. Context, LexicalParent, CBuffer, KwLoc, Ident, IdentLoc, LBrace);
  20. PushOnScopeChains(Result, BufferScope);
  21. PushDeclContext(BufferScope, Result);
  22. return Result;
  23. }
  24. void Sema::ActOnFinishHLSLBuffer(Decl *Dcl, SourceLocation RBrace) {
  25. auto *BufDecl = cast<HLSLBufferDecl>(Dcl);
  26. BufDecl->setRBraceLoc(RBrace);
  27. PopDeclContext();
  28. }