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

Timur Iskhodzhanov timurrrr at google.com
Fri May 23 05:53:46 PDT 2014


OK -- this turned out to be doable (sent D3893).

Reid, feel free to close D3771.

2014-05-20 2:06 GMT+04:00 Alexey Samsonov <samsonov at google.com>:
>
>
> On Mon, May 19, 2014 at 12:03 PM, Reid Kleckner <rnk at google.com> wrote:
>>
>> 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?
>
>
> I'm fine with using clang instead of clang-cl for lit tests. Option E sounds
> slightly better.
>
>
> --
> Alexey Samsonov, Mountain View, CA



More information about the cfe-commits mailing list