[cfe-dev] Origin of a Type

Eli Friedman eli.friedman at gmail.com
Sat Nov 10 18:35:10 PST 2012


On Sat, Nov 10, 2012 at 2:23 PM, madil90 <madil90 at gmail.com> wrote:
> Hi,
>    I want to find out the origin of a type. Consider a type "string" or
> "FILE". I want to find out where it came from. For "string", it would be
> string.h or whichever file the "string" class is defined. Also, can I get
> the original class declaration as a Record variable.

For a given SourceLocation, there are methods on SourceManager to
figure out which file it is located in.

If you have a RecordType, it has a getDecl() method.

-Eli



More information about the cfe-dev mailing list