Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to view Assembly File?

In Xcode 4 I could see the assembly file by clicking on Product\Generate Output\Assembly File.

But in Xcode 6 and 7 I do not see that option for a Swift file.

Is this feature removed or where do I find it?

like image 825
Binarian Avatar asked Jul 13 '15 09:07

Binarian


2 Answers

This only works for pure Swift, but a nice swift assembler is online here: https://swift.godbolt.org. It even color-codes different sections so you can see which lines the assembly comes from.

like image 119
TheLivingForce Avatar answered Oct 07 '22 21:10

TheLivingForce


Xcode 6 and Xcode 7 (up to the current Xcode 7.3) do not offer the option to view the generated assembly file for Swift input. (Perhaps that feature will be added in a later release.)

Currently the only way that I know of is to call the compiler on the command line with the "-emit-assembly" option, e.g.

xcrun -sdk macosx swiftc -emit-assembly main.swift
like image 38
Martin R Avatar answered Oct 07 '22 20:10

Martin R