Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:37:00

0001 //===--- HLSLExternalSemaSource.h - HLSL Sema Source ------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 //  This file defines the HLSLExternalSemaSource interface.
0010 //
0011 //===----------------------------------------------------------------------===//
0012 #ifndef CLANG_SEMA_HLSLEXTERNALSEMASOURCE_H
0013 #define CLANG_SEMA_HLSLEXTERNALSEMASOURCE_H
0014 
0015 #include "llvm/ADT/DenseMap.h"
0016 
0017 #include "clang/Sema/ExternalSemaSource.h"
0018 
0019 namespace clang {
0020 class NamespaceDecl;
0021 class Sema;
0022 
0023 class HLSLExternalSemaSource : public ExternalSemaSource {
0024   Sema *SemaPtr = nullptr;
0025   NamespaceDecl *HLSLNamespace = nullptr;
0026 
0027   using CompletionFunction = std::function<void(CXXRecordDecl *)>;
0028   llvm::DenseMap<CXXRecordDecl *, CompletionFunction> Completions;
0029 
0030   void defineHLSLVectorAlias();
0031   void defineTrivialHLSLTypes();
0032   void defineHLSLTypesWithForwardDeclarations();
0033 
0034   void onCompletion(CXXRecordDecl *Record, CompletionFunction Fn);
0035 
0036 public:
0037   ~HLSLExternalSemaSource() override;
0038 
0039   /// Initialize the semantic source with the Sema instance
0040   /// being used to perform semantic analysis on the abstract syntax
0041   /// tree.
0042   void InitializeSema(Sema &S) override;
0043 
0044   /// Inform the semantic consumer that Sema is no longer available.
0045   void ForgetSema() override { SemaPtr = nullptr; }
0046 
0047   using ExternalASTSource::CompleteType;
0048   /// Complete an incomplete HLSL builtin type
0049   void CompleteType(TagDecl *Tag) override;
0050 };
0051 
0052 } // namespace clang
0053 
0054 #endif // CLANG_SEMA_HLSLEXTERNALSEMASOURCE_H