[swift-dev] Problem in parsing SIL

Mikio Takeuchi mikio.takeuchi at gmail.com
Tue Jun 14 04:39:08 CDT 2016


Hi,

I am learning SIL and trying to compile SIL generated by the Swift compiler.
I succeeded in doing so with a simple Swift program for just printing "hi",
but I got errors with another simple program which includes a declaration
of a trivial class.

I am running swift-3.0-preview-1 bundled with Xcode8-beta on OS X El
Capitan.

$ uname -a
Darwin localhost 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36
PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64
$ swiftc --version
Apple Swift version 3.0 (swiftlang-800.0.30 clang-800.0.24)
Target: x86_64-apple-macosx10.9
$ cat print.swift
print("hi")
$ swiftc -emit-silgen print.swift > print.sil
$ swiftc -parse-sil print.sil
$ ./print
hi
$ cat classdecl.swift
class MyObject { }
$ swiftc -emit-silgen classdecl.swift > classdecl.sil
$ swiftc -parse-sil classdecl.sil
classdecl.sil:26:105: error: use of undeclared type 'MyObject'
sil_scope 2 { loc "classdecl.swift":1:7 parent @_TFC9classdecl8MyObjectD :
$@convention(method) (@owned MyObject) -> () }

^~~~~~~~
classdecl.sil:26:121: error: extraneous '}' at top level
sil_scope 2 { loc "classdecl.swift":1:7 parent @_TFC9classdecl8MyObjectD :
$@convention(method) (@owned MyObject) -> () }

^

(omitted)

If anybody know any clue, please let me know.

Thanks,
Mikio Takeuchi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20160614/ffc1edfc/attachment.html>


More information about the swift-dev mailing list