Comparing SourceRanges

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()?

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