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 all 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
17 changes: 8 additions & 9 deletions clang/include/clang/Sema/HLSLExternalSemaSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
#ifndef CLANG_SEMA_HLSLEXTERNALSEMASOURCE_H
#define CLANG_SEMA_HLSLEXTERNALSEMASOURCE_H

#include "llvm/ADT/DenseMap.h"

#include "clang/Sema/ExternalSemaSource.h"
#include "llvm/ADT/DenseMap.h"

namespace clang {
class NamespaceDecl;
Expand All @@ -27,14 +26,8 @@ class HLSLExternalSemaSource : public ExternalSemaSource {
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 +40,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