clang 17.0.0git
HLSLExternalSemaSource.h
Go to the documentation of this file.
1//===--- HLSLExternalSemaSource.h - HLSL Sema Source ------------*- C++ -*-===//
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//
9// This file defines the HLSLExternalSemaSource interface.
10//
11//===----------------------------------------------------------------------===//
12#ifndef CLANG_SEMA_HLSLEXTERNALSEMASOURCE_H
13#define CLANG_SEMA_HLSLEXTERNALSEMASOURCE_H
14
15#include "llvm/ADT/DenseMap.h"
16
18
19namespace clang {
20class NamespaceDecl;
21class Sema;
22
24 Sema *SemaPtr = nullptr;
25 NamespaceDecl *HLSLNamespace = nullptr;
26 CXXRecordDecl *ResourceDecl;
27
28 using CompletionFunction = std::function<void(CXXRecordDecl *)>;
29 llvm::DenseMap<CXXRecordDecl *, CompletionFunction> Completions;
30
31 void defineHLSLVectorAlias();
32 void defineTrivialHLSLTypes();
33 void forwardDeclareHLSLTypes();
34
35 void completeBufferType(CXXRecordDecl *Record);
36
37public:
38 ~HLSLExternalSemaSource() override;
39
40 /// Initialize the semantic source with the Sema instance
41 /// being used to perform semantic analysis on the abstract syntax
42 /// tree.
43 void InitializeSema(Sema &S) override;
44
45 /// Inform the semantic consumer that Sema is no longer available.
46 void ForgetSema() override { SemaPtr = nullptr; }
47
49 /// Complete an incomplete HLSL builtin type
50 void CompleteType(TagDecl *Tag) override;
51};
52
53} // namespace clang
54
55#endif // CLANG_SEMA_HLSLEXTERNALSEMASOURCE_H
Represents a C++ struct/union/class.
Definition: DeclCXX.h:254
virtual void CompleteType(TagDecl *Tag)
Gives the external AST source an opportunity to complete an incomplete type.
An abstract interface that should be implemented by external AST sources that also provide informatio...
void CompleteType(TagDecl *Tag) override
Complete an incomplete HLSL builtin type.
void ForgetSema() override
Inform the semantic consumer that Sema is no longer available.
void InitializeSema(Sema &S) override
Initialize the semantic source with the Sema instance being used to perform semantic analysis on the ...
Represent a C++ namespace.
Definition: Decl.h:544
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:358
Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:3438