I have a project which contains both Objective-C and Swift. I want to get the LLVM IR by using Xcode, is there anyway to do that?
I try to put -emit-ir
into "Other Swift flag", but it doesn't work.
Asked
Active
Viewed 255 times
3
-
I think the correct flag is `-emit-llvm` https://github.com/stanislaw/LLVM-Cheatsheet/blob/master/README.md#generate-human-readable-llvm-ir-from-a-file= You'd then have to check the build log, because that's where it would probably end up being dumped. – Alexander May 03 '22 at 17:29
-
`-emit-llvm` is the flag for `clang`, and I think the correct flag for `Swiftc` is `-emit-ir`. – Anditty May 03 '22 at 18:16
1 Answers
3
I found the solution.
You need to put -Xfrontend -emit-ir
into Other Swift Flags
, and the LLVM IR
is in the .o
file!

iosMentalist
- 3,066
- 1
- 30
- 40

Anditty
- 61
- 4