diff options
author | Andrew Rogers <andrurogerz@gmail.com> | 2025-03-11 09:47:20 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-11 09:47:20 -0700 |
commit | 4f60f45130c6bd96c79e468fe9927a29af760f56 (patch) | |
tree | f4b7818c3fff7244cc449f30c8ae4b58b33ff586 /llvm/lib/Support/LockFileManager.cpp | |
parent | f1598367b661e46c4ecc7dd8ea35f9eac79a654c (diff) | |
download | llvm-4f60f45130c6bd96c79e468fe9927a29af760f56.zip llvm-4f60f45130c6bd96c79e468fe9927a29af760f56.tar.gz llvm-4f60f45130c6bd96c79e468fe9927a29af760f56.tar.bz2 |
[llvm] replace static_assert with std::enable_if_t in ilist_node_impl (#127722)
## Purpose
Remove `static_assert` in `ilist_node_impl::isSentinel` and
conditionally include the functino using `std::enable_if_t` instead.
## Background
This fix is necessary to support building LLVM as a Windows DLL, tracked
by #109483.
The `static_assert` in `ilist_node_impl::isSentinel` fails when
compiling LLVM as a Windows DLL with the options `-D
LLVM_BUILD_LLVM_DYLIB=ON -D LLVM_BUILD_LLVM_DYLIB_VIS=ON -D
LLVM_LINK_LLVM_DYLIB=ON`:
```
S:\llvm\llvm-project\llvm\include\llvm/ADT/ilist_node.h(151): error C2338: static_assert failed: 'Use ilist_sentinel_tracking<true> to enable isSentinel()'
S:\llvm\llvm-project\llvm\include\llvm/ADT/ilist_node.h(151): note: the template instantiation context (the oldest one first) is
S:\llvm\llvm-project\llvm\include\llvm/IR/SymbolTableListTraits.h(113): note: see reference to class template instantiation 'llvm::SymbolTableListTraits<llvm::Function>' being compiled
S:\llvm\llvm-project\llvm\include\llvm/IR/SymbolTableListTraits.h(69): note: see reference to class template instantiation 'llvm::simple_ilist<ValueSubClass>' being compiled
with
[
ValueSubClass=llvm::Function
]
S:\llvm\llvm-project\llvm\include\llvm/ADT/simple_ilist.h(87): note: see reference to class template instantiation 'llvm::ilist_sentinel<llvm::ilist_detail::node_options<T,true,false,llvm::ilist_detail::extract_tag<>::type,false,llvm::ilist_detail::extract_parent<>::type>>' being compiled
with
[
T=llvm::Function
]
S:\llvm\llvm-project\llvm\include\llvm/ADT/ilist_node.h(301): note: see reference to class template instantiation 'llvm::ilist_node_impl<OptionsT>' being compiled
with
[
OptionsT=llvm::ilist_detail::node_options<llvm::Function,true,false,llvm::ilist_detail::extract_tag<>::type,false,llvm::ilist_detail::extract_parent<>::type>
]
S:\llvm\llvm-project\llvm\include\llvm/ADT/ilist_node.h(150): note: while compiling class template member function 'bool llvm::ilist_node_impl<OptionsT>::isSentinel(void) const'
with
[
OptionsT=llvm::ilist_detail::node_options<llvm::Function,true,false,llvm::ilist_detail::extract_tag<>::type,false,llvm::ilist_detail::extract_parent<>::type>
]
```
Conditionally including the function using `std::enable_if_t` has the
same effect of preventing the function's use when
`is_sentinel_tracking_explicit=false`, but avoids the issue when
DLL-exporting downstream classes.
## Validation
Verified I no longer fail compilation due to the `static_assert` when
building LLVM on Windows 11 with the options `-D
LLVM_BUILD_LLVM_DYLIB=ON -D LLVM_BUILD_LLVM_DYLIB_VIS=ON -D
LLVM_LINK_LLVM_DYLIB=ON`.
Diffstat (limited to 'llvm/lib/Support/LockFileManager.cpp')
0 files changed, 0 insertions, 0 deletions