Skip to content

Conversation

donneypr
Copy link
Contributor

@donneypr donneypr commented Oct 17, 2025

Regarding the discussion in #162346, this PR is to remove the trailing type from the 'interp__builtin_elementwise_int_unaryop' callbacks.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:bytecode Issues for the clang bytecode constexpr interpreter labels Oct 17, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 17, 2025

@llvm/pr-subscribers-clang

Author: don (donneypr)

Changes

This was missed in my pr #162346 for #160288.


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

1 Files Affected:

  • (modified) clang/lib/AST/ByteCode/InterpBuiltin.cpp (+1-1)
diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index 922d67940e22f..517c51a5f7de1 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -3173,7 +3173,7 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
   case Builtin::BI__builtin_ffsl:
   case Builtin::BI__builtin_ffsll:
     return interp__builtin_elementwise_int_unaryop(
-        S, OpPC, Call, [](const APSInt &Val) {
+        S, OpPC, Call, [](const APSInt &Val) -> APInt {
           return APInt(Val.getBitWidth(),
                        Val.isZero() ? 0u : Val.countTrailingZeros() + 1u);
         });

@donneypr
Copy link
Contributor Author

@RKSimon @tbaederr Following up on our discussion in #162346, I've created PR to add the trailing return type for the function that was missed.

@donneypr
Copy link
Contributor Author

I've added it for the other callbacks in InterpBuiltin.cpp as well now

case Builtin::BI__builtin_ffsll:
return interp__builtin_elementwise_int_unaryop(
S, OpPC, Call, [](const APSInt &Val) {
S, OpPC, Call, [](const APSInt &Val) -> APInt {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the plan was to remove all of these things?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the misunderstanding, removed them in InterpBuiltin.cpp

@donneypr donneypr requested a review from RKSimon October 17, 2025 15:47
Copy link
Collaborator

@RKSimon RKSimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - cheers

@RKSimon RKSimon changed the title [clang][x86][bytecode] added trailing type for ffs, missed in pr llvm#162346 for llvm#160288 [clang][x86][bytecode] remove trailing returns type from interp__builtin_elementwise_int_unaryop callbacks Oct 17, 2025
@RKSimon RKSimon merged commit df2ff3a into llvm:main Oct 17, 2025
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:bytecode Issues for the clang bytecode constexpr interpreter clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants