[cfe-dev] get predefined typedefs and vars

Maximilian Odendahl maxodendahl at gmail.com
Wed Jun 9 09:50:13 PDT 2010


Hi,

thanks for the quick reply.

>> Is there a way to find out if this Var or Typedef was already predefined
>> or actually coming from my parsed source file?
>
> The best way to do this is to use the SourceManager::isFromMainFile method

I tried using

...
case Decl::Typedef:

if (s.getSourceManager().isFromMainFile(it->getSourceRange().getBegin())
	it->dump();
...


But then I get an assertion:

clang-cc: clang/lib/Basic/SourceManager.cpp:429: clang::FileID 
clang::SourceManager::getFileIDSlow(unsigned int) const: Assertion 
`SLocOffset && "Invalid FileID"' failed.

The first typedef to hit this line is __int128_t...

Am I doing sth. wrong here?

Thanks,
Max





More information about the cfe-dev mailing list