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

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Apr 25 11:34:06 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Finn Plummer (inbelic)

<details>
<summary>Changes</summary>

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`)

---
Full diff: https://github.com/llvm/llvm-project/pull/137381.diff


8 Files Affected:

- (renamed) clang/include/clang/Sema/ParseHLSLRootSignature.h () 
- (modified) clang/lib/Parse/CMakeLists.txt (-1) 
- (modified) clang/lib/Sema/CMakeLists.txt (+1) 
- (renamed) clang/lib/Sema/ParseHLSLRootSignature.cpp (+1-1) 
- (modified) clang/unittests/CMakeLists.txt (-1) 
- (removed) clang/unittests/Parse/CMakeLists.txt (-20) 
- (modified) clang/unittests/Sema/CMakeLists.txt (+2) 
- (renamed) clang/unittests/Sema/ParseHLSLRootSignatureTest.cpp (+1-1) 


``````````diff
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;

``````````

</details>


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


More information about the llvm-branch-commits mailing list