Swiftc and -parse-sil?


(Alex Blewitt) #1

The swift compiler has an option '-parse-sil' which could previously be used to parse SIL code. However, it looks like the swift compiler is assuming it's still Swift code:

$ echo "sil_stage canonical" | xcrun swiftc -parse-sil -
<stdin>:1:10: error: consecutive statements on a line must be separated by ';'
sil_stage canonical
         ^
         ;
<stdin>:1:1: error: use of unresolved identifier 'sil_stage'
sil_stage canonical
^~~~~~~~~
<stdin>:1:11: error: use of unresolved identifier 'canonical'
sil_stage canonical
          ^~~~~~~~~
A similar message was posted to the list at the end of last year, indicating that it should work: https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151228/000615.html but no indication that there was a bug raised or fixed at the time.

Is this a known issue or should I rase a bug?

Alex


(Mark Lacey) #2

The swift compiler has an option '-parse-sil' which could previously be used to parse SIL code. However, it looks like the swift compiler is assuming it's still Swift code:

I just opened a PR with a very minimal fix: https://github.com/apple/swift/pull/5345

The problem is that it was still looking for a filename ending in ‘.sil’ even with -parse-sil specified.

Mark

···

On Oct 18, 2016, at 3:43 AM, Alex Blewitt via swift-dev <swift-dev@swift.org> wrote:

$ echo "sil_stage canonical" | xcrun swiftc -parse-sil -
<stdin>:1:10: error: consecutive statements on a line must be separated by ';'
sil_stage canonical
         ^
         ;
<stdin>:1:1: error: use of unresolved identifier 'sil_stage'
sil_stage canonical
^~~~~~~~~
<stdin>:1:11: error: use of unresolved identifier 'canonical'
sil_stage canonical
          ^~~~~~~~~
A similar message was posted to the list at the end of last year, indicating that it should work: https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151228/000615.html but no indication that there was a bug raised or fixed at the time.

Is this a known issue or should I rase a bug?

Alex
_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev


(Alex Blewitt) #3

Nice, thanks.

···

On 18 Oct 2016, at 14:58, Mark Lacey <mark.lacey@apple.com> wrote:

On Oct 18, 2016, at 3:43 AM, Alex Blewitt via swift-dev <swift-dev@swift.org <mailto:swift-dev@swift.org>> wrote:

The swift compiler has an option '-parse-sil' which could previously be used to parse SIL code. However, it looks like the swift compiler is assuming it's still Swift code:

I just opened a PR with a very minimal fix: https://github.com/apple/swift/pull/5345

The problem is that it was still looking for a filename ending in ‘.sil’ even with -parse-sil specified.

Mark