RTTI on Windows

Hello,

I’ve recently started using Clang on Windows (VC10), and quickly ran into this limitation.
I have started to try to split the code paths into Itanium-specific and Microsoft-specific methods, but lack a bit of experience with Clang to really get this off the ground.

Undoubtedly, I’m making a serious mistake, but it seems to me that this is a serious limitation (in the Windows world, where it is not at all common practice to have access to all the source code for all the dependencies). I see this as a problem stemming from the failure to link with existing libraries (precompiled with MS-style compilers, such as the CRT), and therefore an ABI issue.

I would like to help to try to produce a solution. I’ve seen the code and realize this is a large (huge?) undertaking. Is it even thinkable (for some reason that escapes now me)?

The question is: who has any specific knowledge of this part of the code (RTTI and virtual table construction)? Among those people, are there any who could spare some time to comment on this undertaking and perhaps provide a bit of guidance? Has anyone already tried to do this, or has it slated?

Thanks,
Dan

Hello Daniel,

I am currently working on an implementation of RTTI for MSVC compatibility. As it stands, there is a lot left to do.

If you’d like to help me, I think a good first step that has to happen is to achieve an understanding of what the different flags mean in the Base Class Descriptors.

I’m available on IRC if you have any specific questions.

Hi,

I just read http://llvm.org/bugs/show_bug.cgi?id=18332
and http://llvm.org/bugs/show_bug.cgi?id=17403 after finding the following issue (first attempt at using the toolchain for windows).
Am I correct that the following problem is also due to the lack of RTTI support?

It looks like I can’t use std::array.

Program (compiled with LLVM-VS2013):

#include
int main()
{
std::array<int,42> my_array;
}

Output:

------ Build started: Project: Test_ClangToolchain, Configuration: Debug Win32 ------
1>clang-cl.exe : warning : argument unused during compilation: ‘/ZI’
1>clang-cl.exe : warning : argument unused during compilation: ‘/Gm’
1>clang-cl.exe : warning : argument unused during compilation: ‘/EHsc’
1>clang-cl.exe : warning : argument unused during compilation: ‘/GS’
1>clang-cl.exe : warning : argument unused during compilation: ‘/fp:precise’
1>clang-cl.exe : warning : argument unused during compilation: ‘/FdDebug\vc120.pdb’
1>clang-cl.exe : warning : argument unused during compilation: ‘/Gd’
1>main.cpp(4,23): warning : unused variable ‘my_array’ [-Wunused-variable]
1> std::array<int,42> my_array;
1> ^
1>CL : error : cannot mangle RTTI descriptors for type ‘codecvt’ yet
1>CL : error : cannot mangle the name of type ‘codecvt’ into RTTI descriptors yet
1>CL : error : cannot mangle RTTI descriptors for type ‘codecvt_base’ yet
1>CL : error : cannot mangle the name of type ‘codecvt_base’ into RTTI descriptors yet
1>CL : error : cannot mangle RTTI descriptors for type ‘facet’ yet
1>CL : error : cannot mangle the name of type ‘facet’ into RTTI descriptors yet
1>CL : error : cannot mangle RTTI descriptors for type ‘_Facet_base’ yet
1>CL : error : cannot mangle the name of type ‘_Facet_base’ into RTTI descriptors yet
1> 1 warning and 8 errors generated.
Build has been canceled.
Build Summary

Thanks for trying it!

MSVC compatible RTTI is not yet implemented. Try disabling RTTI with /GR- or the corresponding IDE project property checkbox. This example compiles fine for me.