1*bdd1243dSDimitry Andric //===- SemaHLSL.cpp - Semantic Analysis for HLSL constructs ---------------===// 2*bdd1243dSDimitry Andric // 3*bdd1243dSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*bdd1243dSDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5*bdd1243dSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*bdd1243dSDimitry Andric // 7*bdd1243dSDimitry Andric //===----------------------------------------------------------------------===// 8*bdd1243dSDimitry Andric // This implements Semantic Analysis for HLSL constructs. 9*bdd1243dSDimitry Andric //===----------------------------------------------------------------------===// 10*bdd1243dSDimitry Andric 11*bdd1243dSDimitry Andric #include "clang/Sema/Sema.h" 12*bdd1243dSDimitry Andric 13*bdd1243dSDimitry Andric using namespace clang; 14*bdd1243dSDimitry Andric 15*bdd1243dSDimitry Andric Decl *Sema::ActOnStartHLSLBuffer(Scope *BufferScope, bool CBuffer, 16*bdd1243dSDimitry Andric SourceLocation KwLoc, IdentifierInfo *Ident, 17*bdd1243dSDimitry Andric SourceLocation IdentLoc, 18*bdd1243dSDimitry Andric SourceLocation LBrace) { 19*bdd1243dSDimitry Andric // For anonymous namespace, take the location of the left brace. 20*bdd1243dSDimitry Andric DeclContext *LexicalParent = getCurLexicalContext(); 21*bdd1243dSDimitry Andric HLSLBufferDecl *Result = HLSLBufferDecl::Create( 22*bdd1243dSDimitry Andric Context, LexicalParent, CBuffer, KwLoc, Ident, IdentLoc, LBrace); 23*bdd1243dSDimitry Andric 24*bdd1243dSDimitry Andric PushOnScopeChains(Result, BufferScope); 25*bdd1243dSDimitry Andric PushDeclContext(BufferScope, Result); 26*bdd1243dSDimitry Andric 27*bdd1243dSDimitry Andric return Result; 28*bdd1243dSDimitry Andric } 29*bdd1243dSDimitry Andric 30*bdd1243dSDimitry Andric void Sema::ActOnFinishHLSLBuffer(Decl *Dcl, SourceLocation RBrace) { 31*bdd1243dSDimitry Andric auto *BufDecl = cast<HLSLBufferDecl>(Dcl); 32*bdd1243dSDimitry Andric BufDecl->setRBraceLoc(RBrace); 33*bdd1243dSDimitry Andric PopDeclContext(); 34*bdd1243dSDimitry Andric } 35