This is an archive of the discontinued LLVM Phabricator instance.

[CodeComplete] Do not complete self-initializations
ClosedPublic

Authored by ilya-biryukov on Nov 6 2018, 8:09 AM.

Details

Summary

Removes references to initialized variable from the following completions:

int x = ^;

Handles only the trivial cases where the variable name is completed
immediately at the start of initializer or assignment, more complicated
cases aren't covered, e.g. these completions still contain 'x':

// More complicated expressions.
int x = foo(^);
int x = 10 + ^;
// Other kinds of initialization.
int x{^};
int x(^);
// Constructor initializers.
struct Foo {
  Foo() : x(^) {}
  int x;
};

We should address those in the future, but they are outside of the scope of
this initial change.

Diff Detail

Event Timeline

ilya-biryukov created this revision.Nov 6 2018, 8:09 AM
  • Remove std::move, the target is const ref, so it does nothing (thanks, clang-tidy!)
This revision is now accepted and ready to land.Nov 6 2018, 9:31 AM
This revision was automatically updated to reflect the committed changes.