Skip to content

Conversation

spall
Copy link
Contributor

@spall spall commented Oct 13, 2025

Remove unused function, 'ContainsBitField', which was meant to be removed when bitfield support was added to HLSLAggregateSplatCast and HLSLElementwiseCast.

@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 Oct 13, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 13, 2025

@llvm/pr-subscribers-hlsl

@llvm/pr-subscribers-clang

Author: Sarah Spall (spall)

Changes

Remove unused function, 'ContainsBitField', which was meant to be removed when bitfield support was added to HLSLAggregateSplatCast and HLSLElementwiseCast.


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

2 Files Affected:

  • (modified) clang/include/clang/Sema/SemaHLSL.h (-1)
  • (modified) clang/lib/Sema/SemaHLSL.cpp (-34)
diff --git a/clang/include/clang/Sema/SemaHLSL.h b/clang/include/clang/Sema/SemaHLSL.h
index 46b088c0174b0..f9d3a4ea94806 100644
--- a/clang/include/clang/Sema/SemaHLSL.h
+++ b/clang/include/clang/Sema/SemaHLSL.h
@@ -215,7 +215,6 @@ class SemaHLSL : public SemaBase {
   bool diagnosePositionType(QualType T, const ParsedAttr &AL);
 
   bool CanPerformScalarCast(QualType SrcTy, QualType DestTy);
-  bool ContainsBitField(QualType BaseTy);
   bool CanPerformElementwiseCast(Expr *Src, QualType DestType);
   bool CanPerformAggregateSplatCast(Expr *Src, QualType DestType);
   ExprResult ActOnOutParamExpr(ParmVarDecl *Param, Expr *Arg);
diff --git a/clang/lib/Sema/SemaHLSL.cpp b/clang/lib/Sema/SemaHLSL.cpp
index 17cb1e4f153ca..72b2ac99ec53c 100644
--- a/clang/lib/Sema/SemaHLSL.cpp
+++ b/clang/lib/Sema/SemaHLSL.cpp
@@ -3544,40 +3544,6 @@ bool SemaHLSL::CanPerformScalarCast(QualType SrcTy, QualType DestTy) {
   llvm_unreachable("Unhandled scalar cast");
 }
 
-// Detect if a type contains a bitfield. Will be removed when
-// bitfield support is added to HLSLElementwiseCast and HLSLAggregateSplatCast
-bool SemaHLSL::ContainsBitField(QualType BaseTy) {
-  llvm::SmallVector<QualType, 16> WorkList;
-  WorkList.push_back(BaseTy);
-  while (!WorkList.empty()) {
-    QualType T = WorkList.pop_back_val();
-    T = T.getCanonicalType().getUnqualifiedType();
-    // only check aggregate types
-    if (const auto *AT = dyn_cast<ConstantArrayType>(T)) {
-      WorkList.push_back(AT->getElementType());
-      continue;
-    }
-    if (const auto *RT = dyn_cast<RecordType>(T)) {
-      const RecordDecl *RD = RT->getOriginalDecl()->getDefinitionOrSelf();
-      if (RD->isUnion())
-        continue;
-
-      const CXXRecordDecl *CXXD = dyn_cast<CXXRecordDecl>(RD);
-
-      if (CXXD && CXXD->isStandardLayout())
-        RD = CXXD->getStandardLayoutBaseWithFields();
-
-      for (const auto *FD : RD->fields()) {
-        if (FD->isBitField())
-          return true;
-        WorkList.push_back(FD->getType());
-      }
-      continue;
-    }
-  }
-  return false;
-}
-
 // Can perform an HLSL Aggregate splat cast if the Dest is an aggregate and the
 // Src is a scalar or a vector of length 1
 // Or if Dest is a vector and Src is a vector of length 1

@spall spall changed the title [NFC][HLSL] Remove unused function [NFC][HLSL] Remove unused function 'ContainsBitField' Oct 13, 2025
@spall spall merged commit 9bf88d0 into llvm:main Oct 13, 2025
11 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 13, 2025

LLVM Buildbot has detected a new failure on builder lldb-x86_64-debian running on lldb-x86_64-debian while building clang at step 6 "test".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/162/builds/33130

Here is the relevant piece of the build log for the reference
Step 6 (test) failure: build (failure)
...
PASS: lldb-shell :: Register/x86-mm-xmm-write.test (1454 of 3246)
PASS: lldb-shell :: SymbolFile/NativePDB/lookup-by-types.cpp (1455 of 3246)
PASS: lldb-shell :: SymbolFile/DWARF/dwo-static-data-member-access.test (1456 of 3246)
PASS: lldb-shell :: SymbolFile/NativePDB/simple-types.cpp (1457 of 3246)
PASS: lldb-shell :: SymbolFile/DWARF/dwo-relative-filename-only-binary-dir.c (1458 of 3246)
PASS: lldb-shell :: Expr/TestStringLiteralExpr.test (1459 of 3246)
PASS: lldb-unit :: Core/./LLDBCoreTests/83/118 (1460 of 3246)
PASS: lldb-shell :: SymbolFile/DWARF/DW_OP_piece-O3.c (1461 of 3246)
PASS: lldb-shell :: REPL/Basic.test (1462 of 3246)
PASS: lldb-unit :: DAP/./DAPTests/11/77 (1463 of 3246)
FAIL: lldb-unit :: DAP/./DAPTests/10/77 (1464 of 3246)
******************** TEST 'lldb-unit :: DAP/./DAPTests/10/77' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/worker/2.0.1/lldb-x86_64-debian/build/tools/lldb/unittests/DAP/./DAPTests-lldb-unit-1124077-10-77.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=77 GTEST_SHARD_INDEX=10 /home/worker/2.0.1/lldb-x86_64-debian/build/tools/lldb/unittests/DAP/./DAPTests
--

Script:
--
/home/worker/2.0.1/lldb-x86_64-debian/build/tools/lldb/unittests/DAP/./DAPTests --gtest_filter=DisconnectRequestHandlerTest.DisconnectTriggersTerminateCommands
--
/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/unittests/DAP/Handler/DisconnectTest.cpp:52: Failure
Actual function call count doesn't match EXPECT_CALL(client, Received(Output("2\n")))...
         Expected: to be called twice
           Actual: called once - unsatisfied and active


/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/unittests/DAP/Handler/DisconnectTest.cpp:52
Actual function call count doesn't match EXPECT_CALL(client, Received(Output("2\n")))...
         Expected: to be called twice
           Actual: called once - unsatisfied and active



********************
PASS: lldb-shell :: Breakpoint/dummy-target.test (1465 of 3246)
PASS: lldb-unit :: Core/./LLDBCoreTests/113/118 (1466 of 3246)
PASS: lldb-shell :: SymbolFile/DWARF/dwo-debug-file-search-paths-dwoname-absolute-compdir.c (1467 of 3246)
PASS: lldb-shell :: Commands/command-image-lookup.yaml (1468 of 3246)
PASS: lldb-shell :: Settings/TestCxxFrameFormat.test (1469 of 3246)
PASS: lldb-unit :: Core/./LLDBCoreTests/48/118 (1470 of 3246)
PASS: lldb-shell :: SymbolFile/DWARF/dwo-debug-file-search-path-symlink-relative-compdir.c (1471 of 3246)
PASS: lldb-shell :: SymbolFile/DWARF/dwo-debug-file-search-paths-relative-compdir.c (1472 of 3246)
PASS: lldb-unit :: Core/./LLDBCoreTests/79/118 (1473 of 3246)
PASS: lldb-unit :: Core/./LLDBCoreTests/12/118 (1474 of 3246)
PASS: lldb-unit :: Core/./LLDBCoreTests/85/118 (1475 of 3246)
PASS: lldb-shell :: ObjectFile/ELF/elf-memory.test (1476 of 3246)
PASS: lldb-unit :: Core/./LLDBCoreTests/1/118 (1477 of 3246)
PASS: lldb-unit :: Core/./LLDBCoreTests/39/118 (1478 of 3246)

akadutta pushed a commit to akadutta/llvm-project that referenced this pull request Oct 14, 2025
Remove unused function, 'ContainsBitField', which was meant to be
removed when bitfield support was added to HLSLAggregateSplatCast and
HLSLElementwiseCast.
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.

6 participants