clang  19.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 
19 namespace clang {
20 class NamespaceDecl;
21 class Sema;
22 
24  Sema *SemaPtr = nullptr;
25  NamespaceDecl *HLSLNamespace = nullptr;
26  CXXRecordDecl *ResourceDecl = nullptr;
27 
28  using CompletionFunction = std::function<void(CXXRecordDecl *)>;
29  llvm::DenseMap<CXXRecordDecl *, CompletionFunction> Completions;
30 
31  void defineHLSLVectorAlias();
32  void defineTrivialHLSLTypes();
33  void defineHLSLTypesWithForwardDeclarations();
34 
35  void onCompletion(CXXRecordDecl *Record, CompletionFunction Fn);
36 
37 public:
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
llvm::MachO::Record Record
Definition: MachO.h:31
Represents a C++ struct/union/class.
Definition: DeclCXX.h:258
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 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 ...
virtual void CompleteType(TagDecl *Tag)
Gives the external AST source an opportunity to complete an incomplete type.
Represent a C++ namespace.
Definition: Decl.h:548
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:462
Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:3587
The JSON file list parser is used to communicate input to InstallAPI.