[cfe-dev] get predefined typedefs and vars
Chris Lattner
clattner at apple.com
Wed Jun 9 10:12:59 PDT 2010
On Jun 9, 2010, at 9:50 AM, Maximilian Odendahl wrote:
> 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...
I'm not sure what "it" is here, but try Decl::getLocation() instead. You should check to make sure it isn't an invalid source location though with SourceLocation::isValid()
-Chris
>
> Am I doing sth. wrong here?
>
> Thanks,
> Max
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
More information about the cfe-dev
mailing list