[PATCH] clang-cl: Add support for -o

Reid Kleckner rnk at google.com
Mon May 19 12:03:07 PDT 2014


On Mon, May 19, 2014 at 5:10 AM, Timur Iskhodzhanov <timurrrr at google.com>wrote:

> 2014-05-15 11:00 GMT+04:00 Reid Kleckner <rnk at google.com>:
> > Maybe we should just run these tests with the gcc driver frontend.
>
> So the problem with that is a combination of the following factors:
> a) The ASan lit tests use RUN lines like "%clangxx_asan %s -o %t"
>   [e.g. see test/asan/TestCases/stack-buffer-overflow.cc]
>
> b) The clang-cl driver doesn't support "-o"
>
> c) By default, %clangxx_asan is COMPILER_RT_TEST_COMPILER
>
> d) We have to use clang-cl to build ASan gtest-based tests as gtest
> itself uses exceptions.
>   Currently clang doesn't support exception, thus clang-cl falls back.
>

Try using -DGTEST_HAS_SEH=0, this should compile out any use of __try.  I
use that to self-host.

It's my fault for not documenting this more widely, but it's not really
clean yet.


> e) COMPILER_RT_TEST_COMPILER is apparently used to build gtest-based tests
>   [see cmake/Modules/CompilerRTCompile.cmake]
>
>
> Looks like making any of (a-c,e) false fixes the problems.
>
> Possible solutions are (at least):
> A) Use a %exe_out macro in asan lit tests.
>   This implies a big (yet trivial) diff and a small-but-annoying
> maintenance burden for new tests.
>
> B) Add "-o" support to clang-cl, this is being discussed here.
>
> C) We can un-override %clangxx_asan to be clang rather than clang-cl on
> Windows
>

That could work.


>   Or we could use a wrapper for clang-cl which replaces "-o" with
> "-Fo" when lit tests are run...
>   (there's a "android_commands/android_compile.py" wrapper around anyways)
>

No wrapper please, a macro would be better.


> E) We could set COMPILER_RT_TEST_COMPILER to clang (rather than
> clang-cl) and override it for gtest-based tests.
>
> Opinions?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140519/4c224bb7/attachment.html>


More information about the cfe-commits mailing list