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 boolean member and provide 
op&& and op|| overloads that test the bool member in the obvious way.

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?)

GCC 4.8:
4, 2, 7
10, 8, 14

Clang ToT:
3, 5, 4, 3, 7
9, 11, 10, 9, 14

I think using the end of the condition is problematic/confusing. I'm not sure 
why this doesn't show up in the primitive value version, but it seems like it 
should (& we should end up stepping to the end of the condition (which would be 
the close paren of the function call, not the close paren of the 'if ()'))

Perhaps we should use the close paren of the 'if ()' but tehre's no source 
location for that readily available - I guess the way to get there is to 
navigate to the next token from the end of the condition expression... ?


http://reviews.llvm.org/D8822



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to