[cfe-dev] Comparing SourceRanges

Jonas Toth via cfe-dev cfe-dev at lists.llvm.org
Tue Nov 27 10:01:25 PST 2018


You can compare both the beginning and the end of the SourceRange.
SourceLocations itself are comparable.

With this you can build a small helper function to the inclusion check.

Best, Jonas

Am 27.11.18 um 18:52 schrieb Pardis Pashakhanloo via cfe-dev:
> Hi all,
>
> How can I check if a SourceRange is inside another SourceRange?
> For example, if I have a FunctionDecl *FD and a Stmt *S, how to check
> if S->getSourceRange() is located inside FD->getSourceRange()?
>
> Best,
> Pardis
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181127/792f6513/attachment.html>


More information about the cfe-dev mailing list