Created
December 27, 2017 18:47
-
-
Save kastiglione/6e13255bb787742a56be81ece123f2e0 to your computer and use it in GitHub Desktop.
Get the module that matches a given header
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Examples: | |
# hdrtomod objc/runtime.h | |
# hdrtomod mach-o/dyld.h | |
# hdrtomod Foundation/Foundation.h | |
hdrtomod() { | |
readonly header=$1 | |
echo "#import <$header>" \ | |
| clang -fmodules -fsyntax-only -x objective-c -Xclang -ast-dump - \ | |
| grep ImportDecl \ | |
| egrep -o 'implicit \S+' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note you may want to change
clang
toxcrun -sdk ... clang