Skip to content

Conversation

@inbelic
Copy link
Contributor

@inbelic inbelic commented Apr 25, 2025

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)

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" HLSL HLSL Language Support labels Apr 25, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 25, 2025

@llvm/pr-subscribers-clang

Author: Finn Plummer (inbelic)

Changes

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

@llvmbot
Copy link
Member

llvmbot commented Apr 25, 2025

@llvm/pr-subscribers-hlsl

Author: Finn Plummer (inbelic)

Changes

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

@inbelic inbelic changed the title [NFC][HLSL][RootSignature] Move HLSLRootSignatureParser into clangSema [NFC][HLSL][RootSignature] Move HLSLRootSignatureParser into clangSema Apr 25, 2025
@inbelic inbelic force-pushed the inbelic/rs-move-parser branch from 92d1d83 to a9f7a77 Compare April 25, 2025 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category HLSL HLSL Language Support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants