Exception handling on Windows

Howdy there,
I'm big user of the D programming language (www.digitalmars.com/d).
Some folks are working hard on an LLVM-based D compiler, but they are
saying they're stuck on Windows, because LLVM doesn't support Windows
SEH for C++ exception handling.

So what does clang do about exception handling on Windows? Or is
clang also not available on Windows?

Thanks for any insight you can provide.
--bb

Bill Baxter wrote:

Howdy there,
I'm big user of the D programming language (www.digitalmars.com/d).
Some folks are working hard on an LLVM-based D compiler, but they are
saying they're stuck on Windows, because LLVM doesn't support Windows
SEH for C++ exception handling.

So what does clang do about exception handling on Windows? Or is
clang also not available on Windows?
  

Clang completely relies on LLVM when it comes to handling issues like that. If LLVM doesn't support Win32 (or Win64) unwinding, then Clang doesn't either. (I don't think Clang supports exception codegen at all at the moment. At least, it doesn't fully support parsing C++ exception constructs.)

Sebastian

Bill Baxter wrote:

Howdy there,
I'm big user of the D programming language (www.digitalmars.com/d).
Some folks are working hard on an LLVM-based D compiler, but they are
saying they're stuck on Windows, because LLVM doesn't support Windows
SEH for C++ exception handling.

So what does clang do about exception handling on Windows? Or is
clang also not available on Windows?

Clang completely relies on LLVM when it comes to handling issues like that.
If LLVM doesn't support Win32 (or Win64) unwinding, then Clang doesn't
either.

I see. So clang isn't really usable on Windows right now then?

(I don't think Clang supports exception codegen at all at the
moment. At least, it doesn't fully support parsing C++ exception
constructs.)

I presume this is something the clang devs would like to address eventually?
A C++ compiler without exception handling is hardly a C++ compiler.

A slightly different question -- any idea how many developers are
actively working on clang and how many are actively working on the
core parts of LLVM that clang relies on?

My impression is that LLVM is a pretty big project with some nice
corporate backing. But maybe the actual amount of activity is less
than I'm thinking... I'm just surprised that something like
exception handling is working yet. Or maybe it's just that none of
the devs or corporate backers are interested in Windows?

--bb

Bill Baxter wrote:

  

Bill Baxter wrote:
    

Howdy there,
I'm big user of the D programming language (www.digitalmars.com/d).
Some folks are working hard on an LLVM-based D compiler, but they are
saying they're stuck on Windows, because LLVM doesn't support Windows
SEH for C++ exception handling.

So what does clang do about exception handling on Windows? Or is
clang also not available on Windows?

Clang completely relies on LLVM when it comes to handling issues like that.
If LLVM doesn't support Win32 (or Win64) unwinding, then Clang doesn't
either.
    
I see. So clang isn't really usable on Windows right now then?
  

I suppose the C part is about as usable as on Linux. The Objective-C part is as usable as you'd expect from an Objective-C compiler under Windows. The C++ part is too incomplete to be usable anywhere.

(I don't think Clang supports exception codegen at all at the
moment. At least, it doesn't fully support parsing C++ exception
constructs.)
    
I presume this is something the clang devs would like to address eventually?
A C++ compiler without exception handling is hardly a C++ compiler.
  

Of course. But C++ is big.

A slightly different question -- any idea how many developers are
actively working on clang and how many are actively working on the
core parts of LLVM that clang relies on?

My impression is that LLVM is a pretty big project with some nice
corporate backing. But maybe the actual amount of activity is less
than I'm thinking... I'm just surprised that something like
exception handling is working yet. Or maybe it's just that none of
the devs or corporate backers are interested in Windows?
  

The main corporate backer of LLVM is Apple. Do the math. :slight_smile:

contributors to Clang, in various areas. The C++ part is mostly done by three people (Doug, Argiris, and me). Of those, I believe Doug is the only one who works on this as part of his job. I'm not sure about Argiris. I'm just a student working on Clang as a hobby.

Sebastian

Bill Baxter wrote:

I see. So clang isn't really usable on Windows right now then?

I suppose the C part is about as usable as on Linux. The Objective-C part is
as usable as you'd expect from an Objective-C compiler under Windows. The
C++ part is too incomplete to be usable anywhere.

I see.
The LLVM - D compiler guys (LDC) seem to have exception handling
working properly in their linux version, so apparently that part of
LLVM works.

(I don't think Clang supports exception codegen at all at the
moment. At least, it doesn't fully support parsing C++ exception
constructs.)

I presume this is something the clang devs would like to address
eventually?
A C++ compiler without exception handling is hardly a C++ compiler.

Of course. But C++ is big.

Well, the LLVM-based D compiler is mostly working on Linux now, if
you're interested. :wink:

A slightly different question -- any idea how many developers are
actively working on clang and how many are actively working on the
core parts of LLVM that clang relies on?

My impression is that LLVM is a pretty big project with some nice
corporate backing. But maybe the actual amount of activity is less
than I'm thinking... I'm just surprised that something like
exception handling is working yet. Or maybe it's just that none of
the devs or corporate backers are interested in Windows?

The main corporate backer of LLVM is Apple. Do the math. :slight_smile:

Yeh, ok. But development on core LLVM is not /all/ done by Apple,
right? There must be a few who are interested in making LLVM a great
cross-platform compiler infrastructure in addition to being a great
tool for Apple.

From my time on the mailing list, I think there's around 12 regular
contributors to Clang, in various areas. The C++ part is mostly done by
three people (Doug, Argiris, and me). Of those, I believe Doug is the only
one who works on this as part of his job. I'm not sure about Argiris. I'm
just a student working on Clang as a hobby.

Thanks for the useful info.

--bb

Absolutely. But Clang isn't a C++ compiler .... yet.

At the last LLVM developer's meeting, it was stated that ( note use of passive voice - since my notes don't show who said it ;-)) that full C++ functionality was a target for 2010.

Absolutely. But Clang isn't a C++ compiler .... yet.

Hmm that makes me wonder -- what's the most sophisticated compiler
built on top of LLVM today?

Could it be that this LLVM D compiler is it? From what I understand,
it already compiles a large D standard library suite, exceptions and
templates and all -- under Linux at least.

At the last LLVM developer's meeting, it was stated that ( note use of
passive voice - since my notes don't show who said it ;-)) that full C++
functionality was a target for 2010.

Ok. Well, at least there is a target. That's good to hear. Is there
a chance some pushing from you guys and the D guys combined could get
Windows exception handling prioritized a little higher? (That's
assuming it's something you'd like to see too). Or is LLVM
development not really steerable in that way?

Thanks,
--bb

Naw, llvm-gcc has been around for a while. :slight_smile:

Clang/LLVM is open sourced. Feel free to propose patch to had Windows Exception support.
AFAK, patch from external contributors are welcome.

Bill Baxter wrote:

  

Absolutely. But Clang isn't a C++ compiler .... yet.
    
Hmm that makes me wonder -- what's the most sophisticated compiler
built on top of LLVM today?

Could it be that this LLVM D compiler is it? From what I understand,
it already compiles a large D standard library suite, exceptions and
templates and all -- under Linux at least.
  

Depends on whether you count llvm-gcc as built on top of LLVM. :slight_smile:

At the last LLVM developer's meeting, it was stated that ( note use of
passive voice - since my notes don't show who said it ;-)) that full C++
functionality was a target for 2010.
    
Ok. Well, at least there is a target. That's good to hear. Is there
a chance some pushing from you guys and the D guys combined could get
Windows exception handling prioritized a little higher?

Well, the Clang developer team and the LLVM core developer team overlap, but they're not the same. If you want to lobby for Windows exception support (be it MinGW's SJLJ implementation or, preferably, something compatible with MSVC++) the LLVM core mailing list is probably the better place.
Eventually, when we get to C++ codegen, we'll do the same, or go for the implementation, but right now we're too busy with parsing and semantic analysis.

Sebastian

Hello, Everyone

Well, the Clang developer team and the LLVM core developer team overlap,
but they're not the same. If you want to lobby for Windows exception
support (be it MinGW's SJLJ implementation or, preferably, something
compatible with MSVC++) the LLVM core mailing list is probably the
better place.

It seems, that I need to clarify some things here:

1. LLVM uses dwarf-based EH
2. There is more of less decent support of dw-style exceptions on
x86/linux & {x86,ppc}/darwin targets. There are some outstanding
issues, but hopefully they can be more or less easily solved.
3. Mingw differs alot. It will require some huge refactoring of asm &
dwarf printers to even emit needed dwarf-structures. I started this
project in summer, but it seemed to be quite gross, since it touches
many parts of assembler emission code and I really want to make things
properly, not hacky. So, when I found some more time I hope to finish
this project. This will allow us to have dw-style exceptions on mingw.
4. I'm not planning to spend time on other exceptions schemes, neither
generic sjlj, or quite target-specific SEH. If you will need them -
feel free to design and implement them :slight_smile:

PS: In any case, llvmdev ML is much better place for this topic.