Page MenuHomePhabricator

Make clangd CompletionModel not depend on directory layout.
ClosedPublic

Authored by hvdijk on May 4 2021, 1:12 PM.

Details

Summary

The current code accounts for two possible layouts, but there is at least a third supported layout: clang-tools-extra may also be checked out as clang/tools/extra with the releases, which was not yet handled. Rather than treating that as a special case, use the location of CompletionModel.cmake to handle all three cases. This should address the problems that prompted D96787 and the problems that prompted the proposed revert D100625.

Diff Detail

Event Timeline

hvdijk created this revision.May 4 2021, 1:12 PM
hvdijk requested review of this revision.May 4 2021, 1:12 PM
usaxena95 added inline comments.May 4 2021, 3:04 PM
clang-tools-extra/clangd/quality/CompletionModel.cmake
7

nit: Directly refer to code generator instead of storing quality dir.
set(CLANGD_COMPLETION_MODEL_COMPILER ${CMAKE_CURRENT_LIST_DIR}/CompletionModelCodegen.py)

hvdijk updated this revision to Diff 342881.May 4 2021, 3:15 PM
hvdijk marked an inline comment as done.May 4 2021, 3:18 PM
hvdijk added inline comments.
clang-tools-extra/clangd/quality/CompletionModel.cmake
7

Alright, done. Testing in progress just to be on the safe side. We could also get rid of model_compiler and use ${CLANGD_COMPLETION_MODEL_COMPILER} directly, but I felt that looked bad due to the conflicting variable naming styles and the long lines, so I left that.

usaxena95 accepted this revision.May 4 2021, 3:18 PM
usaxena95 added inline comments.
clang-tools-extra/clangd/quality/CompletionModel.cmake
9

We can remove this variable as well and use the above var at all places.

This revision is now accepted and ready to land.May 4 2021, 3:18 PM