Skip to content

Conversation

@shafik
Copy link
Collaborator

@shafik shafik commented Aug 14, 2025

Static analysis flagged this line because we are copying Result instead of moving it.

Static analysis flagged this line because we are copying Result instead of
moving it.
@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 Aug 14, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 14, 2025

@llvm/pr-subscribers-clang

Author: Shafik Yaghmour (shafik)

Changes

Static analysis flagged this line because we are copying Result instead of moving it.


Full diff: https://github.com/llvm/llvm-project/pull/153664.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 ee2d532551583..3c0dd8f901dc0 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -2285,7 +2285,7 @@ static bool interp__builtin_elementwise_sat(InterpState &S, CodePtr OpPC,
       llvm_unreachable("Wrong builtin ID");
     }
 
-    pushInteger(S, APSInt(Result, !LHS.isSigned()), Call->getType());
+    pushInteger(S, APSInt(std::move(Result), !LHS.isSigned()), Call->getType());
     return true;
   }
 

Copy link
Contributor

@ojhunt ojhunt left a comment

Choose a reason for hiding this comment

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

Looks fine to me - really falls into the bucket of things it would be nice to be able to somehow turn into a (locally determinable) warning rather than depending on static analysis.

@shafik shafik merged commit 868efdc into llvm:main Aug 15, 2025
13 checks passed
@shafik shafik deleted the interpBuiltin_moveResult_interp__builtin_elementwise_sat branch August 16, 2025 02:54
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.

4 participants