kadircet wrote:

> We're currently inconsistent regarding attributes; sometimes we include the 
> attributes in the range, sometimes we don't. But declaration source ranges 
> are tough to reason about in general because there's many different moving 
> parts.

I totally agree. I was asking to change them deliberately and systematically 
for the same reason. Such changes, even if they make sense and look good in 
isolation, introduce more chaos into the system. As they change one set of 
random behavior with another and each of these changes need to be handled by 
source tooling consumers.

> Consider: `#pragma clang section bss = "test" .. static int i = 12;`

I'd rather not dive into the weeds here and make a general decision around 
whether we should refrain from such changes to semantics of source locations. I 
am happy to discuss how we can improve things systematically in a separate 
medium.

> I suspect the least amount of churn for tools is to continue to go with the 
> maximal range and improve what we track at the edges. But I also suspect that 
> will always be best-effort and tools are going to have to handle those on a 
> case-by-case basis sometimes.

I am also leaning towards this direction, having all that information available 
at least gives the tools always something to build on top (rather than lacking 
information, which is a lot harder to recover).

But I think we should be tackling that as a separate problem, if we want to 
reduce churn and regressions for source tools. E.g. if we decide that we're 
going to fix source ranges involving attribute tokens, we should try our best 
to cover all the places that parse/contain attributes. Instead of improving 
things here and there as we're making other changes. That's just death by 
thousand cuts, and most of the time these will be small enough regressions that 
no one prioritizes/fixes.

https://github.com/llvm/llvm-project/pull/133107
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to