This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Add a testcase for empty preamble.
ClosedPublic

Authored by hokein on Aug 13 2018, 3:21 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

hokein created this revision.Aug 13 2018, 3:21 AM
hokein edited the summary of this revision. (Show Details)Aug 13 2018, 3:24 AM

Maybe also add a test for find-definition that was broken before? (non-empty preamble -> empty preamble -> bad gotodef that goes to included file instead of the local variable)
To have a regression test against similar failures.

unittests/clangd/TUSchedulerTests.cpp
312 ↗(On Diff #160318)

Maybe call PrecompiledPreamble directly? it requires some setup, but tests the modified code without extra layers that TUScheduler adds.

Maybe also add a test for find-definition that was broken before? (non-empty preamble -> empty preamble -> bad gotodef that goes to included file instead of the local variable)
To have a regression test against similar failures.

I think this patch is in a good scope (for empty preamble). I'd leave it as it is. The failure of GoTodefinition test is caused by an inconsistent behavior of using lastBuiltPreamble/NewPreamble in TUScheduler, I will send out a separate patch fixing it (based on our discussion).

hokein edited the summary of this revision. (Show Details)Aug 14 2018, 2:28 AM

I think this patch is in a good scope (for empty preamble). I'd leave it as it is. The failure of GoTodefinition test is caused by an inconsistent behavior of using lastBuiltPreamble/NewPreamble in TUScheduler, I will send out a separate patch fixing it (based on our discussion).

LG, thanks!

+ a few more nits to the tests

unittests/clangd/TUSchedulerTests.cpp
333 ↗(On Diff #160318)

NIT: just use cantFail(std::move(Preamble)) to get the underlying result, no need for an extra ASSERT_TRUE here.

348 ↗(On Diff #160318)

NIT: also use cantFail?

hokein updated this revision to Diff 161000.Aug 16 2018, 4:39 AM
hokein marked 2 inline comments as done.

Address review comments.

ilya-biryukov accepted this revision.Aug 16 2018, 9:11 AM

LGTM, but note the comment: we don't need ASSERT_TRUE(bool(Preamble)).

unittests/clangd/TUSchedulerTests.cpp
333 ↗(On Diff #161000)

Remove ASSERT_TRUE(bool(Preamble))?
We assume everyone runs the tests run with assertions enable on every commit (and builtbots will catch the ones that don't), so cantFail will handle the error case for us.

This revision is now accepted and ready to land.Aug 16 2018, 9:11 AM
hokein updated this revision to Diff 161176.Aug 17 2018, 1:14 AM
hokein marked an inline comment as done.

Remove ASSERT_TRUE(bool(Preamble)).

This revision was automatically updated to reflect the committed changes.