Skip to content

Commit 2a574fa

Browse files
ppenzinrhuanjl
authored andcommitted
Provide MSVC-friendly wrapper for this==nullptr
MSVC neither supports the attribute we've used, nor deletes the check.
1 parent 5cdd17f commit 2a574fa

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/Common/DataStructures/ImmutableList.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -749,12 +749,16 @@ namespace regex
749749
return result;
750750
}
751751

752-
bool __attribute__((noinline)) CheckNull( void* obj ) { return obj == nullptr; }
752+
#ifndef _MSC_VER
753+
bool __attribute__((noinline)) CheckEq(void* obj1, void *obj2) { return obj1 == obj2; }
754+
#else
755+
#define CheckEq(a, b) (a) == (b)
756+
#endif
753757

754758
// Info: Return true if the list is empty.
755759
bool IsEmpty()
756760
{
757-
return CheckNull(this);
761+
return CheckEq(this, Empty());
758762
}
759763

760764
// Info: Return a list containing the given single value

0 commit comments

Comments
 (0)