[cfe-users] Generate mingw object files via clang-cl

JVApen via cfe-users cfe-users at lists.llvm.org
Wed Sep 9 12:38:18 PDT 2015


Hi all

We are looking at a large project that has been written only with the MSVC
compiler.
I've already tried to compile this with Clang-Cl, which goes actually very
nicely and already uncovered some bugs.
(Let me thank all developers that already worked on making clang-cl such a
good tool)

Unfortunately, we still have more than  50% of that code base that does not
compile with Clang-Cl, mainly because of exceptions (also in the
STL-implementation of MS)
We already tried to enable this via Xclang, though than in crashes, which
is the reason it currently is not yet available.

You could say to use the /fallback option, which is very nice if you try to
use clang for code generation, though for now that is not an option (yet).
However, clang has very nice reporting and tools which we are trying to use
in some experiments. (First prove it works, than suggest using it)
We like to use this reporting if we no longer get why our code isn't
compiling. (And sometimes even cl is not getting it, which results in no
information at all on internal compiler error, not even mentioning the
performance issues at compile time if it succeeds)

There comes the first use-case in which we could use clang and keep it
local to a small part of the code-base. (1 cpp file and a lot of headers)
​Unfortunately, Clang-cl does not support exceptions which fails the
compilation way too early because of some stupid try-catch or throw.
Yes, you cannot generate code for this, though we don't expect you to do
this (yet).

So we came up with a new idea, if we tell clang-cl to use the mingw triple.
(Note, I might be wrong in the triple value, I cannot look this up right
now)
We tried:
clang-cl -Xclang -triple=x86_64-pc-mingw32 OtherArgs
clang-cl -triple=x86_64-pc-mingw32 ​OtherArgs

​However for some reason we did not get this working ​cause it did not
accept this arguments.

So naively I would ask for a way to generate incompatible object files.
However, if someone has a better solution into dry-running the compiler
(Has to be clang-cl) it would be appreciated.

JVApen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20150909/c59126e5/attachment.html>


More information about the cfe-users mailing list