Clang 3.4 modules load but still get "declaration not found" errors when visiting AST nodes for Obj C programs


Using command line clang (3.4 open source), my objective C file compiles
fine and produces a .o file as expected. But when I parse the AST
programmatically (clang::ParseAST) and visit the AST nodes (using
ASTConsumer), I get declarations not found errors such as:
error: cannot find protocol declaration for 'UIApplicationDelegate'
@interface APLAppDelegate : UIResponder <UIApplicationDelegate>

unknown type name 'UIWindow'
@property (nonatomic) UIWindow *window;

I have matched the command line options to the options I pass to
CompilerInvocation. I have passed -fmodules and -fmodules-cache-path as
args. I dumped the .pcm file from the module-cache-path and ensured that it
has the above declarations in it.

What am I missing here ? Why are the declarations for UIWindow and
UIApplicationDelegate not being found by the parseAST when they are present
in the module-map file and even the .pcm file ? How do I turn on additional
diagnostics to figure why this is failing and where ?

Thanks and awaiting response.
Babita Sharma.