[lld] r325158 - Convert an assert to a static_assert. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 14 14:43:41 PST 2018


I'll revert it now.

On Wed, Feb 14, 2018 at 2:42 PM, Vitaly Buka <vitalybuka at google.com> wrote:

> +ruiu
> Also this one is broken on Windows.
>
>
> On Wed, Feb 14, 2018 at 2:25 PM, Vitaly Buka <vitalybuka at google.com>
> wrote:
>
>> Windows bot does not like it: http://lab.llvm.org:8011/b
>> uilders/sanitizer-windows/builds/24153
>>
>> c:\b\slave\sanitizer-windows\llvm\tools\lld\coff\Symbols.h(425): error C2057: expected constant expression
>>
>>
>>
>> On Wed, Feb 14, 2018 at 11:28 AM, Sam Clegg via llvm-commits <
>> llvm-commits at lists.llvm.org> wrote:
>>
>>> Author: sbc
>>> Date: Wed Feb 14 11:28:46 2018
>>> New Revision: 325158
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=325158&view=rev
>>> Log:
>>> Convert an assert to a static_assert. NFC.
>>>
>>> Differential Revision: https://reviews.llvm.org/D43305
>>>
>>> Modified:
>>>     lld/trunk/COFF/Symbols.h
>>>     lld/trunk/ELF/Symbols.h
>>>     lld/trunk/wasm/Symbols.h
>>>
>>> Modified: lld/trunk/COFF/Symbols.h
>>> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Symbols.h
>>> ?rev=325158&r1=325157&r2=325158&view=diff
>>> ============================================================
>>> ==================
>>> --- lld/trunk/COFF/Symbols.h (original)
>>> +++ lld/trunk/COFF/Symbols.h Wed Feb 14 11:28:46 2018
>>> @@ -421,8 +421,8 @@ void replaceSymbol(Symbol *S, ArgT &&...
>>>    static_assert(sizeof(T) <= sizeof(SymbolUnion), "Symbol too small");
>>>    static_assert(alignof(T) <= alignof(SymbolUnion),
>>>                  "SymbolUnion not aligned enough");
>>> -  assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) == nullptr &&
>>> -         "Not a Symbol");
>>> +  static_assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) ==
>>> nullptr,
>>> +                "Not a Symbol");
>>>    new (S) T(std::forward<ArgT>(Arg)...);
>>>  }
>>>  } // namespace coff
>>>
>>> Modified: lld/trunk/ELF/Symbols.h
>>> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?
>>> rev=325158&r1=325157&r2=325158&view=diff
>>> ============================================================
>>> ==================
>>> --- lld/trunk/ELF/Symbols.h (original)
>>> +++ lld/trunk/ELF/Symbols.h Wed Feb 14 11:28:46 2018
>>> @@ -355,8 +355,8 @@ void replaceSymbol(Symbol *S, ArgT &&...
>>>    static_assert(sizeof(T) <= sizeof(SymbolUnion), "SymbolUnion too
>>> small");
>>>    static_assert(alignof(T) <= alignof(SymbolUnion),
>>>                  "SymbolUnion not aligned enough");
>>> -  assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) == nullptr &&
>>> -         "Not a Symbol");
>>> +  static_assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) ==
>>> nullptr,
>>> +                "Not a Symbol");
>>>
>>>    Symbol Sym = *S;
>>>
>>>
>>> Modified: lld/trunk/wasm/Symbols.h
>>> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Symbols.h
>>> ?rev=325158&r1=325157&r2=325158&view=diff
>>> ============================================================
>>> ==================
>>> --- lld/trunk/wasm/Symbols.h (original)
>>> +++ lld/trunk/wasm/Symbols.h Wed Feb 14 11:28:46 2018
>>> @@ -242,8 +242,8 @@ T *replaceSymbol(Symbol *S, ArgT &&... A
>>>    static_assert(sizeof(T) <= sizeof(SymbolUnion), "Symbol too small");
>>>    static_assert(alignof(T) <= alignof(SymbolUnion),
>>>                  "SymbolUnion not aligned enough");
>>> -  assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) == nullptr &&
>>> -         "Not a Symbol");
>>> +  static_assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) ==
>>> nullptr,
>>> +                "Not a Symbol");
>>>    return new (S) T(std::forward<ArgT>(Arg)...);
>>>  }
>>>
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180214/f7fce3a6/attachment.html>


More information about the llvm-commits mailing list