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

Keno Fischer kfischer at college.harvard.edu
Fri Aug 15 09:38:54 PDT 2014


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



More information about the cfe-dev mailing list