Print AST in ObjC

Hello,

I want to be able to print the AST of a .m file (Objective-C) i tried with

clang -fmodules -F/System/Library/Frameworks -Xclang -ast-dump -fsyntax-only MandatoryViewController.m

This file is part of a xcode file, so it has some dependencies.

Do any of you know what i need to do? so this can work?

Thanks in advance.

Sorry, i forgot to tell that clang show this error after run the command that i posted in the previous message:

MandatoryViewController.m:1:9: fatal error: module ‘UIKit’ not found
@import UIKit;

Thanks!

The framework search you are using is for macOS frameworks, if you want to dump ast for iOS related code, then you need to point it to the iOS SDK frameworks.

Try to look at xcrun command for some hints on how to get the right path.

I hope it helps.

Cheers,
Alex.

Thanks Alex, that was indeed the problem.