[llvm] [llubi] Fix evaluation order of logic operators (PR #195304)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Fri May 1 10:36:07 PDT 2026


https://github.com/dtcxzyw created https://github.com/llvm/llvm-project/pull/195304

`&&` is evaluated first, though it doesn't affect the result.


>From f1291de1be62c4564ff949e914385a65fa1fd880 Mon Sep 17 00:00:00 2001
From: Yingwei Zheng <dtcxzyw2333 at gmail.com>
Date: Sat, 2 May 2026 01:32:02 +0800
Subject: [PATCH] [llubi] Fix evaluation order of logic operators

---
 llvm/tools/llubi/lib/Library.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/llvm/tools/llubi/lib/Library.cpp b/llvm/tools/llubi/lib/Library.cpp
index b7596b117daf7..fb626e2ad7dd7 100644
--- a/llvm/tools/llubi/lib/Library.cpp
+++ b/llvm/tools/llubi/lib/Library.cpp
@@ -67,9 +67,9 @@ std::optional<std::string> Library::readStringFromMemory(const Pointer &Ptr) {
 AnyValue Library::executeMalloc(StringRef Name, Type *Type,
                                 ArrayRef<AnyValue> Args,
                                 MemAllocKind AllocKind) {
-  assert(AllocKind == MemAllocKind::Malloc || AllocKind == MemAllocKind::New ||
-         AllocKind == MemAllocKind::NewArray &&
-             "Unexpected MemAllocKind for malloc()/new/new[]");
+  assert((AllocKind == MemAllocKind::Malloc || AllocKind == MemAllocKind::New ||
+          AllocKind == MemAllocKind::NewArray) &&
+         "Unexpected MemAllocKind for malloc()/new/new[]");
 
   const auto &SizeVal = Args[0];
 



More information about the llvm-commits mailing list