This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Avoid crashes in override completions
ClosedPublic

Authored by ilya-biryukov on Sep 3 2018, 8:01 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

ilya-biryukov created this revision.Sep 3 2018, 8:01 AM
ilya-biryukov added inline comments.Sep 3 2018, 8:03 AM
unittests/clangd/CodeCompleteTests.cpp
1770 ↗(On Diff #163721)

Was wondering if testing for crashes LG this way, or adding more assertions might make sense too

ioeric accepted this revision.Sep 3 2018, 8:03 AM
This revision is now accepted and ready to land.Sep 3 2018, 8:03 AM
ioeric added inline comments.Sep 3 2018, 8:13 AM
unittests/clangd/CodeCompleteTests.cpp
1770 ↗(On Diff #163721)

Hmm, I think this is okay, but I'd probably do some sanity check on the results, just to make it look less odd ;)

ilya-biryukov added inline comments.Sep 3 2018, 8:21 AM
unittests/clangd/CodeCompleteTests.cpp
1770 ↗(On Diff #163721)

Exactly my feelings: this looks odd.
However, couldn't come up with a decent sanity check at this point.
The reason is: we don't store enough information to tell override completion from non-override ones.

It means I can assert something like Not(Contains(Labelled("~Base() override"))), but lots of broken outputs can still make the test pass, e.g.:

  • void ~Base() override
  • ~Derived() override
  • ...

Will probably keep as this and think how to factor out overriden completions from the results better...

This revision was automatically updated to reflect the committed changes.