[cfe-dev] Variable Context

Eli Friedman eli.friedman at gmail.com
Mon Oct 22 13:36:04 PDT 2012


On Mon, Oct 22, 2012 at 1:24 PM, madil90 <madil90 at gmail.com> wrote:
> Hi,
>    I want to find out whether a certain decl was present in the main file or
> came from some file inlcude through the "#include" directive. How can I do
> that?

SourceManager::isFromMainFile .

> I am using an ASTConsumer to parse an AST. Also, for declarations
> included from some other file, can I find the name of the file it came from?
> e.g. "cout" came from "<iostream>"

SourceManager::getFilename .

-Eli



More information about the cfe-dev mailing list