[cfe-dev] clang/C# on LLVM

Chris Lattner clattner at apple.com
Sat Apr 28 09:34:33 PDT 2012


On Apr 28, 2012, at 8:58 AM, Chris Lattner wrote:
>> 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.

Oh, I guess the other difference is that llvm::SourceMgr hasn't been tuned.  SMLoc is sizeof(pointer), which makes them use twice the memory on 64-bit hosts.  This should be easy to fix, but no-one has bothered yet.

-Chris



More information about the cfe-dev mailing list