This is an archive of the discontinued LLVM Phabricator instance.

[CodeComplete] Fill preferred type on binary expressions
ClosedPublic

Authored by ilya-biryukov on Dec 13 2018, 3:24 AM.

Diff Detail

Repository
rC Clang

Event Timeline

ilya-biryukov created this revision.Dec 13 2018, 3:24 AM
kadircet accepted this revision.Dec 13 2018, 5:53 AM

It seems like we have some assumptions about what people might be trying to do in most of the cases, but i think it is OK since this never performs worse than the older version.

lib/Parse/ParseExpr.cpp
395–396

maybe update the comment as well to reflect it is not only for assignments.

lib/Sema/SemaCodeComplete.cpp
4928

why not LHSType ?

4935

maybe also state the assumption for bitwise operators, or maybe just move to right after shift operators

unittests/Sema/CodeCompleteTest.cpp
295

s/time/type/ ?

This revision is now accepted and ready to land.Dec 13 2018, 5:53 AM
ilya-biryukov marked 4 inline comments as done.
  • Address review comments

Thanks for the review!

lib/Sema/SemaCodeComplete.cpp
4928

The shifts are non-symmetrical, so it didn't feel the link between lhs and rhs provided much value.
It's not true for other ops, e.g. |, where you would typically use the same operand type for both values.

It's not a very strong argument, though, happy to change this code later.

kadircet added inline comments.Dec 13 2018, 8:04 AM
lib/Sema/SemaCodeComplete.cpp
4928

yeah you are right, it makes more sense this way.

  • Update the test after changes
This revision was automatically updated to reflect the committed changes.