clang 19.0.0git
SemaHLSL.cpp
Go to the documentation of this file.
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();
22 Context, LexicalParent, CBuffer, KwLoc, Ident, IdentLoc, LBrace);
23
24 PushOnScopeChains(Result, BufferScope);
25 PushDeclContext(BufferScope, Result);
26
27 return Result;
28}
29
31 auto *BufDecl = cast<HLSLBufferDecl>(Dcl);
32 BufDecl->setRBraceLoc(RBrace);
34}
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1446
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:85
HLSLBufferDecl - Represent a cbuffer or tbuffer declaration.
Definition: Decl.h:4905
static HLSLBufferDecl * Create(ASTContext &C, DeclContext *LexicalParent, bool CBuffer, SourceLocation KwLoc, IdentifierInfo *ID, SourceLocation IDLoc, SourceLocation LBrace)
Definition: Decl.cpp:5600
One of these records is kept for each identifier that is lexed.
Scope - A scope is a transient data structure that is used while parsing the program.
Definition: Scope.h:41
ASTContext & Context
Definition: Sema.h:1030
void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext=true)
Add this decl to the scope shadowed decl chains.
Definition: SemaDecl.cpp:1517
Decl * ActOnStartHLSLBuffer(Scope *BufferScope, bool CBuffer, SourceLocation KwLoc, IdentifierInfo *Ident, SourceLocation IdentLoc, SourceLocation LBrace)
Definition: SemaHLSL.cpp:15
DeclContext * getCurLexicalContext() const
Definition: Sema.h:873
void ActOnFinishHLSLBuffer(Decl *Dcl, SourceLocation RBrace)
Definition: SemaHLSL.cpp:30
void PushDeclContext(Scope *S, DeclContext *DC)
Set the current declaration context until it gets popped.
Definition: SemaDecl.cpp:1324
void PopDeclContext()
Definition: SemaDecl.cpp:1331
Encodes a location in the source.
The JSON file list parser is used to communicate input to InstallAPI.
@ Result
The result type of a method or function.