[cfe-dev] When are SourceLocation's actually required in the AST

Reid Kleckner rnk at google.com
Fri Aug 15 09:53:29 PDT 2014


My understanding is that the asserts were added to template instantiation
because previously it transformed types without transforming location
information. You ended up with QualTypes instead of TypeSourceInfo*'s or
TypeLocs, which lost a lot of information. I think those asserts were added
to make sure that the rest of the compiler continue to forward proper
slocs. I don't think they are truly needed for correctness.

I think Doug was responsible for those assertions. Maybe he has time now to
answer questions, but maybe not. :)


On Fri, Aug 15, 2014 at 9:38 AM, Keno Fischer <kfischer at college.harvard.edu>
wrote:

> I've recently been generating a lot of clang ASTs programmatically and
> I am wondering when SourceLocation's are supposed to be required in
> the AST for clang to compile it correctly and when they are not. From
> my experience, most of the time it works fine to just make it an
> invalid clang::SourceLocation, but some of the time (three or four
> instances I know of), it does not (e.g. template instantiations throw
> assertion failures when the source location is invalid). So I'm
> wondering if there is any rational on when a valid (even if
> nonsensical - that always works fine) source location is required and
> when not, so I know which are bugs and need fixing (which I'm happy to
> do) and which are expected and I should simply work around.
>
> Thanks,
> Keno
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140815/0276d33f/attachment.html>


More information about the cfe-dev mailing list