Skip to content

Commit

Permalink
Fix this==nullptr in Clang
Browse files Browse the repository at this point in the history
Provide a workaround for Clang deleting a check for `this==Empty()`,
where `Empty()` returns null.

Fixes chakra-core#6847
  • Loading branch information
ShortDevelopment authored and rhuanjl committed Apr 18, 2024
1 parent 5249f3d commit 5cdd17f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/Common/DataStructures/ImmutableList.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Copyright (c) ChakraCore Project Contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#pragma once
Expand Down Expand Up @@ -748,10 +749,12 @@ namespace regex
return result;
}

bool __attribute__((noinline)) CheckNull( void* obj ) { return obj == nullptr; }

// Info: Return true if the list is empty.
bool IsEmpty()
{
return this==Empty();
return CheckNull(this);
}

// Info: Return a list containing the given single value
Expand Down

0 comments on commit 5cdd17f

Please # to comment.