[clang] [clang][bytecode][NFC] Add an additional assertion (PR #105927)

via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 23 23:51:21 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

<details>
<summary>Changes</summary>

Since this must be true, add an assertion instead of just documenting it via the comment.

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


1 Files Affected:

- (modified) clang/lib/AST/ByteCode/Interp.h (+5-3) 


``````````diff
diff --git a/clang/lib/AST/ByteCode/Interp.h b/clang/lib/AST/ByteCode/Interp.h
index 7ba51f737db491..81c547991c3d7d 100644
--- a/clang/lib/AST/ByteCode/Interp.h
+++ b/clang/lib/AST/ByteCode/Interp.h
@@ -2608,9 +2608,11 @@ inline bool Call(InterpState &S, CodePtr OpPC, const Function *Func,
     // the function we're about to call is a lambda call operator,
     // skip the CheckInvoke, since the ThisPtr is a null pointer
     // anyway.
-    if (!(S.Current->getFunction() &&
-          S.Current->getFunction()->isLambdaStaticInvoker() &&
-          Func->isLambdaCallOperator())) {
+    if (S.Current->getFunction() &&
+        S.Current->getFunction()->isLambdaStaticInvoker() &&
+        Func->isLambdaCallOperator()) {
+      assert(ThisPtr.isZero());
+    } else {
       if (!CheckInvoke(S, OpPC, ThisPtr))
         return false;
     }

``````````

</details>


https://github.com/llvm/llvm-project/pull/105927


More information about the cfe-commits mailing list