This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Fix background index not triggering on windows due to case mismatch.
ClosedPublic

Authored by sammccall on Jul 26 2019, 1:02 AM.

Details

Summary

This isn't a general fix to all paths where we assume case-sensitivity, it's
a minimally-invasive fix targeting the llvm 9 branch.

I don't have a good automated test for this :-\ I have manually verified that it fixes the issue on my windows machine.

The plan would be to cherrypick this to llvm 9, then later back this out and replace it with a real (testable) fix.

Diff Detail

Repository
rL LLVM

Event Timeline

sammccall created this revision.Jul 26 2019, 1:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 26 2019, 1:02 AM
sammccall edited the summary of this revision. (Show Details)Jul 26 2019, 1:24 AM
sammccall added reviewers: hokein, kadircet.
sammccall planned changes to this revision.Jul 26 2019, 3:41 AM
sammccall marked an inline comment as done.

Sorry, this has a hideous bug that rebroadcasts CDBs over and over. Working on a fix...

clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
195 ↗(On Diff #211887)

this line is incorrect because the key should be lowercase

sammccall updated this revision to Diff 211921.Jul 26 2019, 5:51 AM

Fix bug where CDB wasn't being marked as broadcast due to case differences.
Having getCDBLocked() return CachedCDB seems much cleaner to me.

hokein accepted this revision.Jul 26 2019, 6:30 AM
hokein added inline comments.
clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
168 ↗(On Diff #211921)

nit: set default nullptr.

210 ↗(On Diff #211921)

should we use the pathEqual here too?

This revision is now accepted and ready to land.Jul 26 2019, 6:30 AM
sammccall marked 4 inline comments as done.Jul 26 2019, 6:48 AM
sammccall added inline comments.
clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
168 ↗(On Diff #211921)

Done, and also checked for it.

210 ↗(On Diff #211921)

no, if we have a CompileCommandsDir then we'll only search in that exact directory name, and so the result should match exactly

This revision was automatically updated to reflect the committed changes.
sammccall marked 2 inline comments as done.
Herald added a project: Restricted Project. · View Herald TranscriptJul 26 2019, 7:12 AM