[llvm-branch-commits] [clang] [NFC][HLSL][RootSignature] Move `HLSLRootSignatureParser` into clangSema (PR #137381)

Finn Plummer via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Apr 25 11:33:32 PDT 2025


https://github.com/inbelic created https://github.com/llvm/llvm-project/pull/137381

Noting:
- Currently, `HLSLRootSignatureParser` is defined in `clangParse`, as it would naturally seem an appropriate place to place.

- Surprisingly, `clangParse` has a dependency on `clangSema`. So we can't introduce a dependency of `clangSema` onto `clangParse`.

- Given the users of `HLSLRootSignatureParser` will be `SemaHLSL` when parsing from source and `clangFrontend` when we are parsing as a command line argument.

- Therefore, we are required to move this out of `clangParse` so that `clangSema` can reference it.

This commit moves `HLSLRootSignatureParser` into `clangSema` so it can be linked to all its dependencies (`clangFrontend` already depends on `clangSema`)

>From 92d1d83b3fbb43523819b5be338922ab614d2054 Mon Sep 17 00:00:00 2001
From: Finn Plummer <canadienfinn at gmail.com>
Date: Fri, 25 Apr 2025 18:21:36 +0000
Subject: [PATCH] [NFC][HLSL][RootSignature] Move `HLSLRootSignatureParser`
 into clangSema

Noting:
- Currently, `HLSLRootSignatureParser` is defined in `clangParse`, as it
would naturally seem an appropriate place to place.

- Surprisingly, `clangParse` has a dependency on `clangSema`. So we can't
introduce a dependency of `clangSema` onto `clangParse`.

- Given the users of `HLSLRootSignatureParser` will be `SemaHLSL` when
parsing from source and `clangFrontend` when we are parsing as a
command line argument.

- Therefore, we are required to move this out of `clangParse` so that
`clangSema` can reference it.

This commit moves `HLSLRootSignatureParser` into `clangSema` so it can
be linked to all its dependencies (`clangFrontend` already depends on
`clangSema`)
---
 .../{Parse => Sema}/ParseHLSLRootSignature.h  |  0
 clang/lib/Parse/CMakeLists.txt                |  1 -
 clang/lib/Sema/CMakeLists.txt                 |  1 +
 .../ParseHLSLRootSignature.cpp                |  2 +-
 clang/unittests/CMakeLists.txt                |  1 -
 clang/unittests/Parse/CMakeLists.txt          | 20 -------------------
 clang/unittests/Sema/CMakeLists.txt           |  2 ++
 .../ParseHLSLRootSignatureTest.cpp            |  2 +-
 8 files changed, 5 insertions(+), 24 deletions(-)
 rename clang/include/clang/{Parse => Sema}/ParseHLSLRootSignature.h (100%)
 rename clang/lib/{Parse => Sema}/ParseHLSLRootSignature.cpp (99%)
 delete mode 100644 clang/unittests/Parse/CMakeLists.txt
 rename clang/unittests/{Parse => Sema}/ParseHLSLRootSignatureTest.cpp (99%)

diff --git a/clang/include/clang/Parse/ParseHLSLRootSignature.h b/clang/include/clang/Sema/ParseHLSLRootSignature.h
similarity index 100%
rename from clang/include/clang/Parse/ParseHLSLRootSignature.h
rename to clang/include/clang/Sema/ParseHLSLRootSignature.h
diff --git a/clang/lib/Parse/CMakeLists.txt b/clang/lib/Parse/CMakeLists.txt
index 00fde537bb9c6..22e902f7e1bc5 100644
--- a/clang/lib/Parse/CMakeLists.txt
+++ b/clang/lib/Parse/CMakeLists.txt
@@ -14,7 +14,6 @@ add_clang_library(clangParse
   ParseExpr.cpp
   ParseExprCXX.cpp
   ParseHLSL.cpp
-  ParseHLSLRootSignature.cpp
   ParseInit.cpp
   ParseObjc.cpp
   ParseOpenMP.cpp
diff --git a/clang/lib/Sema/CMakeLists.txt b/clang/lib/Sema/CMakeLists.txt
index 4b87004e4b8ea..9ca4b8e6ab96b 100644
--- a/clang/lib/Sema/CMakeLists.txt
+++ b/clang/lib/Sema/CMakeLists.txt
@@ -26,6 +26,7 @@ add_clang_library(clangSema
   JumpDiagnostics.cpp
   MultiplexExternalSemaSource.cpp
   ParsedAttr.cpp
+  ParseHLSLRootSignature.cpp
   Scope.cpp
   ScopeInfo.cpp
   Sema.cpp
diff --git a/clang/lib/Parse/ParseHLSLRootSignature.cpp b/clang/lib/Sema/ParseHLSLRootSignature.cpp
similarity index 99%
rename from clang/lib/Parse/ParseHLSLRootSignature.cpp
rename to clang/lib/Sema/ParseHLSLRootSignature.cpp
index 042aedbf1af52..87b5022cb0abe 100644
--- a/clang/lib/Parse/ParseHLSLRootSignature.cpp
+++ b/clang/lib/Sema/ParseHLSLRootSignature.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "clang/Parse/ParseHLSLRootSignature.h"
+#include "clang/Sema/ParseHLSLRootSignature.h"
 
 #include "clang/Lex/LiteralSupport.h"
 
diff --git a/clang/unittests/CMakeLists.txt b/clang/unittests/CMakeLists.txt
index f3823ba309420..580533a97d700 100644
--- a/clang/unittests/CMakeLists.txt
+++ b/clang/unittests/CMakeLists.txt
@@ -49,7 +49,6 @@ endfunction()
 
 add_subdirectory(Basic)
 add_subdirectory(Lex)
-add_subdirectory(Parse)
 add_subdirectory(Driver)
 if(CLANG_ENABLE_STATIC_ANALYZER)
   add_subdirectory(Analysis)
diff --git a/clang/unittests/Parse/CMakeLists.txt b/clang/unittests/Parse/CMakeLists.txt
deleted file mode 100644
index 2a31be625042e..0000000000000
--- a/clang/unittests/Parse/CMakeLists.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-set(LLVM_LINK_COMPONENTS
-  Support
-  )
-add_clang_unittest(ParseTests
-  ParseHLSLRootSignatureTest.cpp
-  )
-clang_target_link_libraries(ParseTests
-  PRIVATE
-  clangAST
-  clangBasic
-  clangLex
-  clangParse
-  clangSema
-  )
-target_link_libraries(ParseTests
-  PRIVATE
-  LLVMTestingAnnotations
-  LLVMTestingSupport
-  clangTesting
-  )
diff --git a/clang/unittests/Sema/CMakeLists.txt b/clang/unittests/Sema/CMakeLists.txt
index acc76c932afeb..a5c6b44926460 100644
--- a/clang/unittests/Sema/CMakeLists.txt
+++ b/clang/unittests/Sema/CMakeLists.txt
@@ -3,6 +3,7 @@ add_clang_unittest(SemaTests
   CodeCompleteTest.cpp
   HeuristicResolverTest.cpp
   GslOwnerPointerInference.cpp
+  ParseHLSLRootSignatureTest.cpp
   SemaLookupTest.cpp
   SemaNoloadLookupTest.cpp
   CLANG_LIBS
@@ -10,6 +11,7 @@ add_clang_unittest(SemaTests
   clangASTMatchers
   clangBasic
   clangFrontend
+  clangLex
   clangParse
   clangSema
   clangSerialization
diff --git a/clang/unittests/Parse/ParseHLSLRootSignatureTest.cpp b/clang/unittests/Sema/ParseHLSLRootSignatureTest.cpp
similarity index 99%
rename from clang/unittests/Parse/ParseHLSLRootSignatureTest.cpp
rename to clang/unittests/Sema/ParseHLSLRootSignatureTest.cpp
index 2d4e37463bef3..76c437689c4d3 100644
--- a/clang/unittests/Parse/ParseHLSLRootSignatureTest.cpp
+++ b/clang/unittests/Sema/ParseHLSLRootSignatureTest.cpp
@@ -21,7 +21,7 @@
 #include "clang/Lex/PreprocessorOptions.h"
 
 #include "clang/Lex/LexHLSLRootSignature.h"
-#include "clang/Parse/ParseHLSLRootSignature.h"
+#include "clang/Sema/ParseHLSLRootSignature.h"
 #include "gtest/gtest.h"
 
 using namespace clang;



More information about the llvm-branch-commits mailing list