Skip to content

Conversation

@andykaylor
Copy link
Contributor

This moves a call inside an assert to avoid a warning about the result variable being unused in release builds.

This moves a call inside an assert to avoid a warning about the
result variable being unused in release builds.
@llvmbot llvmbot added clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project labels Dec 2, 2025
@llvmbot
Copy link
Member

llvmbot commented Dec 2, 2025

@llvm/pr-subscribers-clangir

@llvm/pr-subscribers-clang

Author: Andy Kaylor (andykaylor)

Changes

This moves a call inside an assert to avoid a warning about the result variable being unused in release builds.


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

1 Files Affected:

  • (modified) clang/lib/CIR/CodeGen/CIRGenClass.cpp (+1-2)
diff --git a/clang/lib/CIR/CodeGen/CIRGenClass.cpp b/clang/lib/CIR/CodeGen/CIRGenClass.cpp
index c98d9bb0724f6..ca9fe939139cd 100644
--- a/clang/lib/CIR/CodeGen/CIRGenClass.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenClass.cpp
@@ -126,8 +126,7 @@ static void emitMemberInitializer(CIRGenFunction &cgf,
                             lhs.isVolatileQualified());
       // Ensure that we destroy the objects if an exception is thrown later in
       // the constructor.
-      QualType::DestructionKind dtorKind = fieldType.isDestructedType();
-      assert(!cgf.needsEHCleanup(dtorKind) &&
+      assert(!cgf.needsEHCleanup(fieldType.isDestructedType()) &&
              "Arrays of non-record types shouldn't need EH cleanup");
       return;
     }

@andykaylor andykaylor enabled auto-merge (squash) December 2, 2025 20:19
@andykaylor andykaylor merged commit ca3de05 into llvm:main Dec 2, 2025
12 of 13 checks passed
@andykaylor andykaylor deleted the cir-warning-fix branch December 2, 2025 20:48
kcloudy0717 pushed a commit to kcloudy0717/llvm-project that referenced this pull request Dec 4, 2025
This moves a call inside an assert to avoid a warning about the result
variable being unused in release builds.
honeygoyal pushed a commit to honeygoyal/llvm-project that referenced this pull request Dec 9, 2025
This moves a call inside an assert to avoid a warning about the result
variable being unused in release builds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants