[cfe-dev] Clang C asm and LLVM
patrick.a.moran at gmail.com
Sun Jan 24 21:06:36 CST 2010
Thanks for your prompt reply, and thanks for the information on __asm__.
> A few things. First, it seems that you think LLVM's invoke is a bit more magic than it is. All this does is define an exception handling region.
I am aware that there are many more complications awaiting me past
getting clang to use invoke. That is, I don't think that simply using
invoke appropriately was sufficient for exception handling, but it is
necessary, right? There were a few things that compiling to C would
have made simpler, but exception handling is definitely the hardest
part either way.
> If you want to use exceptions and don't want to write a personality function, then you might consider emitting C++ or Objective-C code, instead of C.
I definitely would prefer to just generate C++, but there are multiple
inheritance patterns allowed by the language I'm compiling but not
allowed by C++ (and definitely not by Obj-C), so not all my data
structures are representable as C++ classes. The vast majority of
classes will be, but not 100% of them. I suppose I will stick to the
original plan with regards to object layout and "roll my own" with C++
structs, just as I would have in C. That way, I still get free
exceptions, at no more work than before.
More information about the cfe-dev