From 2a574fa591e05febce5f23a0f6fa2af414c451ce Mon Sep 17 00:00:00 2001 From: Petr Penzin Date: Tue, 16 Apr 2024 23:31:39 -0700 Subject: [PATCH] Provide MSVC-friendly wrapper for this==nullptr MSVC neither supports the attribute we've used, nor deletes the check. --- lib/Common/DataStructures/ImmutableList.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/Common/DataStructures/ImmutableList.h b/lib/Common/DataStructures/ImmutableList.h index babe10a0335..f9d3acb42a6 100644 --- a/lib/Common/DataStructures/ImmutableList.h +++ b/lib/Common/DataStructures/ImmutableList.h @@ -749,12 +749,16 @@ namespace regex return result; } - bool __attribute__((noinline)) CheckNull( void* obj ) { return obj == nullptr; } +#ifndef _MSC_VER + bool __attribute__((noinline)) CheckEq(void* obj1, void *obj2) { return obj1 == obj2; } +#else +#define CheckEq(a, b) (a) == (b) +#endif // Info: Return true if the list is empty. bool IsEmpty() { - return CheckNull(this); + return CheckEq(this, Empty()); } // Info: Return a list containing the given single value