[cfe-dev] parsing multiple source files
Hironobu TAKEI
hironobu_takei at zipc.com
Thu Jan 27 07:09:54 PST 2011
Hello
I'd like to get ASTContext-s for multiple input files (by calling
ParseAST)
I've looked into web and clang's sources but I lost my way...
My understand is that each of FileManager, SourceManager, IdentifierTable,
SelectorTable and HeaderSearch is unique to MY PROGRAM,
then, each of Preprocessor and ASTContext is unique to each of INPUT FILES.
Is it correct?
My code:
{
...
SourceManager srcMgr(diag);
...
foreach input-files {
if (file-is-main) {
srcMgr.createMainFileID(file);
}
else {
srcMgr.createFileID(file, ...);
}
ASTContext context(langOpts, srcMgr, ...);
Preprocessor cpp(diag, langOpts, targetInfo, srcMgr, headerSearch);
ParseAST(cpp, consumer, context);
...
} parses only the main file.
Preprocessor and ASTContext must have a reference to its SourceManager
but never know any specific FileID. How can I tell my program to parse
other files?
Could anyone point to or suggest any solutions?
Thanks and regards,
Takei
=====================================================================
Hironobu TAKEI @ CATS Co.,Ltd. System Div.
KAWAASA BLDG. 2-11-5 Shin-Yokohama Kohoku, Yokohama 222-0033 Japan.
http://www.zipc.com TEL: +81-45-473-2088 FAX: +81-45-473-2689
More information about the cfe-dev
mailing list