[swift-dev] Problem in parsing SIL

Jordan Rose jordan_rose at apple.com
Tue Jun 21 16:25:00 CDT 2016


> On Jun 21, 2016, at 14:10, Joe Groff via swift-dev <swift-dev at swift.org> wrote:
> 
> 
>> On Jun 21, 2016, at 2:03 PM, Slava Pestov via swift-dev <swift-dev at swift.org> wrote:
>> 
>> Hi Mikio,
>> 
>> Try this:
>> 
>> swiftc -frontend -emit-silgen classdecl.swift > classdecl.sil
>> swiftc -parse-sil classdecl.sil
>> 
>> I'm not sure why -emit-silgen sometimes emits type declarations and other times not. The only difference I can see is what without the -frontend flag, the driver passes in -primary-file, whereas with -frontend, it does not.
>> 
>> Perhaps Joe or Jordan can chime in.
> 
> This is clearly a bug, but SIL's parser and printer quality generally doesn't have much pressure on it beyond what's minimally necessary to enable optimizer and codegen debugging.

We don't try to print ASTs when -primary-file is passed because it would mean merging ASTs from different files, which isn't going to be correct in the presence of 'private'.

Jordan



More information about the swift-dev mailing list