[cfe-dev] SourceRange for QualifiedTypeLoc

John McCall rjmccall at apple.com
Wed May 19 12:43:28 PDT 2010


On May 19, 2010, at 4:00 AM, Abramo Bagnara wrote:

> 
> In QualifiedTypeLoc currently we have:
> 
>  SourceRange getSourceRange() const {
>    return SourceRange();
>  }
> 
> Taken for granted missing location of qualifiers I think that it would
> be a bit better to have:
> 
>  SourceRange getSourceRange() const {
>    return getUnqualifiedLoc().getSourceRange();
>  }
> 
> Can I proceed in this direction?

Generally a TypeLoc's getSourceRange() returns the source range
corresponding to that portion of the type, i.e. the "local" source range.
Since we don't record the qualifier locations, a QualifiedTypeLoc's source
range should be empty.  Clients should use getFullSourceRange() if they
want the source range for the entire type.

That said, I'm willing to consider deviating from that design if it's causing
problems.

...also, the names aren't great;  I wouldn't object to a couple of renames:
  getSourceRange -> getLocalSourceRange
  getFullSourceRange -> getSourceRange

John.



More information about the cfe-dev mailing list