[cfe-dev] clang/C# on LLVM

Chris Lattner clattner at apple.com
Sat Apr 28 08:58:52 PDT 2012


On Apr 27, 2012, at 3:59 PM, Richard Smith wrote:

> On Fri, Apr 27, 2012 at 11:56 AM, Sebastian Redl <sebastian.redl at getdesigned.at> wrote:
> 
> On 27.04.2012, at 19:43, Madrigal, Juan A wrote:
> 
>> Hi,
>> 
>> Just out of curiosity has the possibility of brining in C# support (minus .Net) to clang/LLVM been discussed?
>> 
>> Here's and interesting project: http://blog.prabir.me/post/LLVM-e28093-Native-C-Compiler.aspx
>> 
>> Thoughts?
> 
> While a C# -> LLVM compiler is an interesting project (though hard - there's a lot of runtime library stuff that you would have to reimplement if you forsake existing .Net implementations), Clang has nothing to do with it. C# is sufficiently different from the core C family that there's really no point in trying to reuse Clang.
> 
> I agree that extending Clang to parse C# is unlikely to be a natural fit; C# is a very distant cousin of the C language family, and there are enough significant differences that a separate compiler would probably be cleaner.

Right.  I completely agree.

> However, if we wanted a C# compiler to be part of the LLVM project, it might make sense to make available certain parts of clang for its use (such as the source manager, diagnostics system, and driver infrastructure, and possibly the lexer).

I think a C# frontend should just use llvm::SourceMgr, which is currently being used by things like filecheck, tblgen, the .ll parser, etc.

Comparing clang::SourceManager to llvm::SourceMgr, the former is really just a super-complicated form made neccesary by C macros (which doesn't apply to C#).  Likewise, I'd rather see the llvm::SMDiagnostic stuff get better (clang does still have some nice features it doesn't, like fixits) and to have Clang's diagnostics properly layered on top of it.

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120428/d61f8e31/attachment.html>


More information about the cfe-dev mailing list