<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I think it is an -Xllvm option.<br class=""><div><blockquote type="cite" class=""><div class="">On Apr 4, 2017, at 7:41 PM, Ben Ng &lt;<a href="mailto:me@benng.me" class="">me@benng.me</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class="">

<title class=""></title>

<div class="">
<div name="messageBodySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;" class="">Do you mean like:
<div class=""><br class=""></div>
<blockquote style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #1abc9c;" class="">
<div class="">$ swiftc -O moof.sil -o moof -Xfrontend -assume-parsing-unqualified-ownership-sil</div>
</blockquote>
<div class=""><br class=""></div>
<div class="">It seems like the `-assume-parsing-unqualified-ownership-sil` argument isn’t understood without the -Xfrontend flag.</div>
<div class=""><br class=""></div>
<div class="">The above command results in a different error:</div>
<div class=""><br class=""></div>
<blockquote style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #1abc9c;" class="">
<div class="">
<div class="">Cannot construct Inlined loc from the given location.</div>
</div>
<div class="">
<div class="">UNREACHABLE executed at /swift/lib/SIL/SILLocation.cpp:209!</div>
</div>
<div class="">
<div class="">0 &nbsp;swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000010ee694d8 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;) + 40</div>
</div>
<div class="">
<div class="">1 &nbsp;swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000010ee69b86 SignalHandler(int) + 454</div>
</div>
<div class="">
<div class="">2 &nbsp;libsystem_platform.dylib 0x00007fffa3c8eb3a _sigtramp + 26</div>
</div>
<div class="">
<div class="">3 &nbsp;libsystem_platform.dylib 0x0000000100000001 _sigtramp + 1547113697</div>
</div>
<div class="">
<div class="">4 &nbsp;libsystem_c.dylib &nbsp; &nbsp; &nbsp; &nbsp;0x00007fffa3b13420 abort + 129</div>
</div>
<div class="">
<div class="">5 &nbsp;swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000010ee06bd7 llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 471</div>
</div>
<div class="">
<div class="">6 &nbsp;swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000010c670d83 swift::InlinedLocation::getInlinedLocation(swift::SILLocation) + 387</div>
</div>
<div class="">
<div class="">7 &nbsp;swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000010c3a64af swift::SILInliner::inlineFunction(swift::FullApplySite, llvm::ArrayRef&lt;swift::SILValue&gt;) + 255</div>
</div>
<div class="">
<div class="">8 &nbsp;swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000010c48f93e (anonymous namespace)::SILPerformanceInlinerPass::run() + 1854</div>
</div>
<div class="">
<div class="">9 &nbsp;swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000010c3c9732 swift::SILPassManager::runPassOnFunction(swift::SILFunctionTransform*, swift::SILFunction*) + 2258</div>
</div>
<div class="">
<div class="">10 swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000010c3ca5ba swift::SILPassManager::runFunctionPasses(llvm::ArrayRef&lt;swift::SILFunctionTransform*&gt;) + 1082</div>
</div>
<div class="">
<div class="">11 swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000010c3cb8d4 swift::SILPassManager::runOneIteration() + 948</div>
</div>
<div class="">
<div class="">12 swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000010bca963b swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&amp;) + 187</div>
</div>
<div class="">
<div class="">13 swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000010c3d4322 swift::runSILOptimizationPasses(swift::SILModule&amp;) + 114</div>
</div>
<div class="">
<div class="">14 swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000010bb54fb7 swift::performFrontend(llvm::ArrayRef&lt;char const*&gt;, char const*, void*, swift::FrontendObserver*) + 12887</div>
</div>
<div class="">
<div class="">15 swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000010bb0f8f0 main + 3312</div>
</div>
<div class="">
<div class="">16 libdyld.dylib &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x00007fffa3a7f235 start + 1</div>
</div>
<div class="">
<div class="">17 libdyld.dylib &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000000000000f start + 1549274587</div>
</div>
</blockquote>
<br class="">
<div class="">So, I tried again without optimizations, and got this instead:</div>
<div class=""><br class=""></div>
<blockquote style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #1abc9c;" class="">
<div class="">
<div class="">$ swiftc moof.sil -o moof -Xfrontend -assume-parsing-unqualified-ownership-sil</div>
<div class=""><br class=""></div>
<div class="">Undefined symbols for architecture x86_64:</div>
</div>
<div class="">
<div class="">&nbsp; "__T0s27_allocateUninitializedArraySayxG_BptBwlFyp_Tgq5", referenced from:</div>
</div>
<div class="">
<div class="">&nbsp; &nbsp; &nbsp; _main in .last_generated-41ab00.o</div>
</div>
<div class="">
<div class="">ld: symbol(s) not found for architecture x86_64</div>
</div>
</blockquote>
</div>
<div name="messageSignatureSection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;" class=""><br class="">
Ben Ng
<div class=""><a href="https://benng.me/" class="">https://benng.me</a><br class=""></div>
</div>
<div name="messageReplySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;" class=""><br class="">
On Apr 4, 2017, 2:02 AM -0400, Michael Gottesman &lt;<a href="mailto:mgottesman@apple.com" class="">mgottesman@apple.com</a>&gt;, wrote:<br class="">
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #1abc9c;" class=""><br class="">
<div class="">
<blockquote type="cite" class="" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #e67e22;">
<div class="">On Apr 3, 2017, at 7:55 PM, Ben Ng via swift-dev &lt;<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>&gt; wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">
<div name="messageBodySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;" class="">
<div class="">
<div class="">I see that <a href="https://bugs.swift.org/browse/SR-3774" class="">SR-3774</a> already exists, but that ticket was about declarations not appearing in the emitted SIL.</div>
<div class=""><br class=""></div>
<div class="">I'm able to get declarations to appear with the -frontend flag, but the emitted SIL <i class="">still</i> doesn't parse on master:<br class=""></div>
</div>
<div class=""><br class=""></div>
<blockquote style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #3498db;" class="">
<div class="">
<div class="">$ &nbsp;echo 'print("moof")' &gt; test.swift</div>
</div>
<div class="">
<div class="">$ &nbsp;swiftc -frontend -emit-sil test.swift &gt; test.sil</div>
</div>
<div class="">
<div class="">$ &nbsp;swiftc -parse-sil test.sil</div>
</div>
<div class=""><br class=""></div>
<div class="">Assertion failed: ((Qualifier != StoreOwnershipQualifier::Unqualified) || F.hasUnqualifiedOwnership() &amp;&amp; "Unqualified inst in qualified function"), function createStore, file /swift-dev/swift/include/swift/SIL/SILBuilder.h, line 503.</div>
<div class="">0 &nbsp;swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000011298d4d8 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;) + 40</div>
<div class="">1 &nbsp;swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000011298db86 SignalHandler(int) + 454</div>
<div class="">2 &nbsp;libsystem_platform.dylib 0x00007fffa48ceb3a _sigtramp + 26</div>
<div class="">3 &nbsp;libsystem_platform.dylib 000000000000000000 _sigtramp + 1534268640</div>
<div class="">4 &nbsp;libsystem_c.dylib &nbsp; &nbsp; &nbsp; &nbsp;0x00007fffa4753420 abort + 129</div>
<div class="">5 &nbsp;libsystem_c.dylib &nbsp; &nbsp; &nbsp; &nbsp;0x00007fffa471a893 basename_r + 0</div>
<div class="">6 &nbsp;swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000011017b2fc swift::SILBuilder::createStore(swift::SILLocation, swift::SILValue, swift::SILValue, swift::StoreOwnershipQualifier) + 396</div>
<div class="">7 &nbsp;swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000011038ddec (anonymous namespace)::SILParser::parseSILInstruction(swift::SILBasicBlock*, swift::SILBuilder&amp;) + 70412</div>
<div class="">8 &nbsp;swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x0000000110373217 swift::Parser::parseDeclSIL() + 5111</div>
<div class="">9 &nbsp;swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000011033112d swift::Parser::parseTopLevel() + 269</div>
<div class="">10 swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x0000000110367edb swift::parseIntoSourceFile(swift::SourceFile&amp;, unsigned int, bool*, swift::SILParserState*, swift::PersistentParserState*, swift::DelayedParsingCallbacks*) + 283</div>
<div class="">11 swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000011011da0c swift::CompilerInstance::performSema() + 3580</div>
<div class="">12 swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000010f676f6d swift::performFrontend(llvm::ArrayRef&lt;char const*&gt;, char const*, void*, swift::FrontendObserver*) + 4621</div>
<div class="">13 swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000010f6338f0 main + 3312</div>
<div class="">14 libdyld.dylib &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x00007fffa46bf235 start + 1</div>
</blockquote>
<br class="">
<div class="">Is this a bug? Am I using the wrong combination of flags?</div>
</div>
</div>
</div>
</blockquote>
<div class=""><br class=""></div>
<div class="">You need the flag -assume-parsing-unqualified-ownership-sil.</div>
<br class="">
<blockquote type="cite" class="" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #e67e22;">
<div class="">
<div class="">
<div name="messageBodySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;" class=""></div>
<div name="messageSignatureSection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;" class=""><br class="">
Ben Ng
<div class=""><a href="https://benng.me/" class="">https://benng.me</a><br class=""></div>
</div>
</div>
_______________________________________________<br class="">
swift-dev mailing list<br class="">
<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-dev" class="">https://lists.swift.org/mailman/listinfo/swift-dev</a><br class=""></div>
</blockquote>
</div>
<br class=""></blockquote>
</div>
</div>

</div></blockquote></div><br class=""></body></html>