Richard Smith: Is there a reasonable way to get the ')' of an "if ()"
expression in the AST? Is it just a matter of going down and playing games
with source locations/lexing to get the token after the end location of the
condition expression?
On Thu, Jan 28, 2016 at 4:57 PM, Wolfgang Pieb via cfe-
wolfgangp added a comment.
> Clang (with patch)
> 3, 5, 4, 5, 7
> 9, 11, 10, 11, 14
>
> So that's somewhat problematic - we shouldn't visit 11 at all. (but we are
> today, as is GCC... so maybe NBD?)
Well, if op&& is overloaded, wouldn't we lose the short-circuit property? If so
it ma
dblaikie added a comment.
Fair question on overloaded operators... Taking the original code:
1: int main() {
2: if (
3: tr()
4: &&
5: tr()
6: )
7: func();
8: if (
9: fa()
10: &&
11: tr()
12: )
13: func();
14: }
& making tr/fa return a user defined type with a
aprantl added a comment.
The linetable produced by GCC appears to be the most accurate one (stopping at
the && for the short-circuit evaluation and then returning there for the actual
& and the branch). I would not have a problem with clang implementing it.
The downside of it is that it breaks t
aprantl added a subscriber: aprantl.
aprantl added a comment.
Reposting dblaikie's example hoping that phabricator doesn't mangle it this
time:
1: int main() {
2: if (
3: tr()
4: &&
5: tr()
6: )
7: func();
8: if (
9: fa()
10: &&
11: tr()
12: )
13: func();
14:
dblaikie added a subscriber: dblaikie.
dblaikie added a comment.
Apologies for the massively delayed review. I think this is probably good,
but here are some test cases to discuss (& I've cc'd Paul Robinson and
Adrian Prantl, both who work on debug info in LLVM as well, to get their
thoughts)
Giv