Просмотр исходного кода

Fix this==nullptr in Clang

Provide a workaround for Clang deleting a check for `this==Empty()`,
where `Empty()` returns null.

Fixes #6847
Lukas Kurz 1 год назад
Родитель
Сommit
5cdd17fcfc
1 измененных файлов с 4 добавлено и 1 удалено
  1. 4 1
      lib/Common/DataStructures/ImmutableList.h

+ 4 - 1
lib/Common/DataStructures/ImmutableList.h

@@ -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
@@ -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