<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55239>55239</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
VTable Optimizations; Invalid application of 'sizeof' to an incomplete type llvm::pdb::PDBSymbolFunc / llvm::lto::InputFile
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
EmmaJaneBonestell
</td>
</tr>
</table>
<pre>
Tested with clang 13, 14, 15.
If attempting to compile LLVM with '-fforce-emit-vtables' and/or '-fwhole-program-vtables', the following files will fail with the respective errors:
<details>
<summary>llvm/lib/DebugInfo/PDB/Native/LinePrinter.cpp</summary>
```
In file included from /opt/venv/llvm-
project/llvm/lib/DebugInfo/PDB/Native/LinePrinter.cpp:9:
In file included from /opt/venv/llvm-
project/llvm/include/llvm/DebugInfo/PDB/Native/LinePrinter.h:12:
In file included from /opt/venv/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:14:
In file included from /opt/venv/llvm-
project/llvm/include/llvm/ADT/SmallVector.h:28:
In file included from /usr/bin/../lib/gcc/x86_64-linux-
gnu/11/../../../../include/c++/11/memory:76:
/usr/bin/../lib/gcc/x86_64-linux-
gnu/11/../../../../include/c++/11/bits/unique_ptr.h:83:16: error: invalid application of
'sizeof' to an incomplete type 'llvm::pdb::PDBSymbolFunc'
static_assert(sizeof(_Tp)>0,
^~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-
gnu/11/../../../../include/c++/11/bits/unique_ptr.h:361:4: note: in instantiation of
member function 'std::default_delete<llvm::pdb::PDBSymbolFunc>::operator()'
requested here
get_deleter()(std::move(__ptr));
^
/usr/bin/../lib/gcc/x86_64-linux-
gnu/11/../../../../include/c++/11/bits/stl_construct.h:140:19: note: in instantiation
of member function 'std::unique_ptr<llvm::pdb::PDBSymbolFunc>::~unique_ptr'
requested here
__pointer->~_Tp();
^
/usr/bin/../lib/gcc/x86_64-linux-
gnu/11/../../../../include/c++/11/bits/stl_construct.h:185:2: note: in instantiation of
function template specialization
'std::_Destroy_aux<false>::__destroy<std::unique_ptr<llvm::pdb::PDBSymbolFunc> *>'
requested here
__destroy(__first, __last);
^
/usr/bin/../lib/gcc/x86_64-linux-
gnu/11/../../../../include/c++/11/bits/alloc_traits.h:746:7: note: in instantiation of
function template specialization
'std::_Destroy<std::unique_ptr<llvm::pdb::PDBSymbolFunc> *>' requested here
_Destroy(__first, __last);
^
/usr/bin/../lib/gcc/x86_64-linux-
gnu/11/../../../../include/c++/11/bits/stl_vector.h:680:7: note: in instantiation of
function template specialization
'std::_Destroy<std::unique_ptr<llvm::pdb::PDBSymbolFunc> *,
std::unique_ptr<llvm::pdb::PDBSymbolFunc>>' requested here
std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
^
/opt/venv/llvm-project/llvm/include/llvm/DebugInfo/PDB/UDTLayout.h:109:7: note:
in instantiation of member function
'std::vector<std::unique_ptr<llvm::pdb::PDBSymbolFunc>>::~vector' requested here
class UDTLayoutBase : public LayoutItemBase {
^
/opt/venv/llvm-project/llvm/include/llvm/DebugInfo/PDB/PDBTypes.h:41:7: note:
forward declaration of 'llvm::pdb::PDBSymbolFunc'
class PDBSymbolFunc;
^
1 error generated
```
</details>
<details>
<summary>tools/lld/MachO/CMakeFiles/lldMachO.dir/...</summary>
Arch/ARM64_32.cpp
Arch/ARM64Common.cpp
Arch/ARM64.cpp
Arch/ARM.cpp
Arch/X86_64.cpp
ConcatOutputSection.cpp
Dwarf.cpp
ExportTrie.cpp
ICF.cpp
InputSection.cpp
MapFile.cpp
MarkLive.cpp
ObjC.cpp
OutputSection.cpp
OutputSegment.cpp
Relocations.cpp
SectionPriorities.cpp
Symbols.cpp
SymbolTable.cpp
SyntheticSections.cpp
UnwindInfoSection.cpp
Writer.cpp
```
In file included from /opt/venv/llvm-project/lld/MachO/Arch/ARM64Common.cpp:9:
In file included from /opt/venv/llvm-project/lld/MachO/Arch/ARM64Common.h:12:
In file included from /opt/venv/llvm-project/lld/MachO/InputFiles.h:13:
In file included from /opt/venv/llvm-project/lld/MachO/Target.h:13:
In file included from /opt/venv/llvm-project/lld/MachO/Relocations.h:13:
In file included from /opt/venv/llvm-
project/llvm/include/llvm/ADT/PointerUnion.h:20:
In file included from /opt/venv/llvm-project/llvm/include/llvm/ADT/STLExtras.h:38:
In file included from /usr/bin/../lib/gcc/x86_64-linux-
gnu/11/../../../../include/c++/11/memory:76:
/usr/bin/../lib/gcc/x86_64-linux-
gnu/11/../../../../include/c++/11/bits/unique_ptr.h:83:16: error: invalid application of
'sizeof' to an incomplete type 'llvm::lto::InputFile'
static_assert(sizeof(_Tp)>0,
^~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-
gnu/11/../../../../include/c++/11/bits/unique_ptr.h:361:4: note: in instantiation of
member function 'std::default_delete<llvm::lto::InputFile>::operator()' requested here
get_deleter()(std::move(__ptr));
^
/opt/venv/llvm-project/lld/MachO/InputFiles.h:247:7: note: in instantiation of
member function 'std::unique_ptr<llvm::lto::InputFile>::~unique_ptr' requested here
class BitcodeFile final : public InputFile {
^
/opt/venv/llvm-project/lld/MachO/InputFiles.h:30:7: note: forward declaration of
'llvm::lto::InputFile'
class InputFile;
^
1 error generated
```
</details>
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztWVtv2zoM_jXJi5DAl9z6kIfcCvSgPS3WbOe8GbItJ9pkyUeS02a_fpTsJM61Tdp1O8CKQHFIiaT4iTSphiJe9qdEaRKjJ6rnKGKYz5Dr17wRclt2bDdRzRnXnMFNgrDWJM00hTlaoEikGWUE3d5-uSuW17xuI0mEjEiDpFQ3FhqHjCggI8zjmnctZDHnaS4YaWRSzCROK9OMRj0nKBGMiSejJwENCqQzhhJMWaHHTJFEZSTSdEEQkVJIVfMHhaHl6I9iomEJMCYFCSEgqjxNsVwCkbFFCjYxGsI4JmE-u-GJgOeH8RDGv7ERDg-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