[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / lib / Sema / SemaHLSL.cpp
blobcf82cc9bccdf51cfe04ecab5f47e2277772953bc
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 //===----------------------------------------------------------------------===//
11 #include "clang/Sema/Sema.h"
13 using namespace clang;
15 Decl *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 Context, LexicalParent, CBuffer, KwLoc, Ident, IdentLoc, LBrace);
24 PushOnScopeChains(Result, BufferScope);
25 PushDeclContext(BufferScope, Result);
27 return Result;
30 void Sema::ActOnFinishHLSLBuffer(Decl *Dcl, SourceLocation RBrace) {
31 auto *BufDecl = cast<HLSLBufferDecl>(Dcl);
32 BufDecl->setRBraceLoc(RBrace);
33 PopDeclContext();