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
11#include "clang/Sema/Sema.h"
12
13using namespace clang;
14
15Decl *Sema::ActOnStartHLSLBuffer(Scope *BufferScope, bool CBuffer,
16 SourceLocation KwLoc, IdentifierInfo *Ident,
17 SourceLocation IdentLoc,
18 SourceLocation LBrace) {
19 // For anonymous namespace, take the location of the left brace.
20 DeclContext *LexicalParent = getCurLexicalContext();
21 HLSLBufferDecl *Result = HLSLBufferDecl::Create(
22 C&: Context, LexicalParent, CBuffer, KwLoc, ID: Ident, IDLoc: IdentLoc, LBrace);
23
24 PushOnScopeChains(Result, BufferScope);
25 PushDeclContext(BufferScope, Result);
26
27 return Result;
28}
29
30void Sema::ActOnFinishHLSLBuffer(Decl *Dcl, SourceLocation RBrace) {
31 auto *BufDecl = cast<HLSLBufferDecl>(Val: Dcl);
32 BufDecl->setRBraceLoc(RBrace);
33 PopDeclContext();
34}
35

source code of clang/lib/Sema/SemaHLSL.cpp