[cfe-dev] "clang-cl --analyze" and exceptions
Reid Kleckner via cfe-dev
cfe-dev at lists.llvm.org
Mon Oct 12 13:40:46 PDT 2015
I actually undid the effect of [1] last Thursday in r249704, so one way to
solve your problem is to build a fresh clang-cl or wait until Hans puts
together a weekly build.
If you're only interested in static analyzer results, and you want to stick
with clang 3.7, you may be able to convince clang that it doesn't need to
emit code in order to bypass the assertions by adding -fsyntax-only to the
command line.
If you need clang 3.7 with code generation and static analyzer results, I
think you're out of luck.
On Mon, Oct 12, 2015 at 7:02 AM, Nikolai Kosjar <
nikolai.kosjar at theqtcompany.com> wrote:
> Hi!
>
> As already observed in [1], things changed with regard to exceptions.
>
> However, this also seems to break the clang static analyzer use case,
> which worked fine before. Is there a workaround for the *analyzer* case for
> 3.7.x? No actual code generation or catching of exceptions should be needed
> for this one.
>
>
> Details:
>
> --8<----main.cpp----------
> #include <iostream>
>
> int main()
> {
> try {
> throw 1;
> } catch (int) {
> return 1;
> }
>
> return 0;
> }
> --8<----------------------
>
> This works fine with 3.6.1:
>
> $ llvm-3.6.1\bin\clang-cl.exe --analyze /EHcs main.cpp
>
> It stopped working with 3.7.0:
>
> $ llvm-3.7.0_64\bin\clang-cl.exe --analyze /EHcs main.cpp
> main.cpp(6,5) : error: cannot use 'throw' with exceptions disabled
> throw 1;
> ^
> main.cpp(5,3) : error: cannot use 'try' with exceptions disabled
> try {
> ^
> 2 errors generated.
>
> Same results without the "/EHcs" flag. In [1] the following flags are
> suggested:
>
> -Xclang -fexceptions -Xclang -fcxx-exceptions -Xclang -fnew-ms-eh
>
> However, 3.7.0 does not know '-fnew-ms-eh' and will crash with the
> remaining options.
>
> Nikolai
>
>
> [1] https://groups.google.com/forum/#!topic/llvm-dev/WPn8uSpgCis
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151012/1f555156/attachment.html>
More information about the cfe-dev
mailing list