Skip to content

[HLSL][NFC] Refactor HLSLExternalSemaSource #131032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 24, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions clang/include/clang/Sema/HLSLExternalSemaSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,15 @@ class NamespaceDecl;
class Sema;

class HLSLExternalSemaSource : public ExternalSemaSource {
private:
Sema *SemaPtr = nullptr;
NamespaceDecl *HLSLNamespace = nullptr;

using CompletionFunction = std::function<void(CXXRecordDecl *)>;
llvm::DenseMap<CXXRecordDecl *, CompletionFunction> Completions;

void defineHLSLVectorAlias();
void defineTrivialHLSLTypes();
void defineHLSLTypesWithForwardDeclarations();

void onCompletion(CXXRecordDecl *Record, CompletionFunction Fn);

public:
~HLSLExternalSemaSource() override;
~HLSLExternalSemaSource() override {}

/// Initialize the semantic source with the Sema instance
/// being used to perform semantic analysis on the abstract syntax
Expand All @@ -47,6 +42,12 @@ class HLSLExternalSemaSource : public ExternalSemaSource {
using ExternalASTSource::CompleteType;
/// Complete an incomplete HLSL builtin type
void CompleteType(TagDecl *Tag) override;

private:
void defineTrivialHLSLTypes();
void defineHLSLVectorAlias();
void defineHLSLTypesWithForwardDeclarations();
void onCompletion(CXXRecordDecl *Record, CompletionFunction Fn);
};

} // namespace clang
Expand Down
1 change: 1 addition & 0 deletions clang/lib/Sema/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ add_clang_library(clangSema
DeclSpec.cpp
DelayedDiagnostic.cpp
HeuristicResolver.cpp
HLSLBuiltinTypeDeclBuilder.cpp
HLSLExternalSemaSource.cpp
IdentifierResolver.cpp
JumpDiagnostics.cpp
Expand Down
Loading