This is a regression from clang-7 to clang-8/trunk. ### Test with clang 8/trunk ~ % F=/tmp/reproducer.cpp ~ % cat -n $F 1 namespace std {}; 2 class Class { static void foo(); }; 3 Class:: 4 ~ % CINDEXTEST_EDITING=1 /d2/llvm/trunk/vanilla/builds/DebugShared/bin/c-index-test -code-completion-at=$F:3:8 $F | grep std Namespace:{TypedText std}{Text ::} (75) ### Test with clang-7 ~ % CINDEXTEST_EDITING=1 /usr/bin/c-index-test-7 -code-completion-at=$F:3:8 $F | grep std zsh: done CINDEXTEST_EDITING=1 /usr/bin/c-index-test-7 -code-completion-at=$F:3:8 $F | zsh: exit 1 grep --color=auto std Works as expected without "CINDEXTEST_EDITING=1". However, for an IDE the effect of CINDEXTEST_EDITING=1 is crucial (preamble generation + caching completions).
Bisected to https://reviews.llvm.org/D53191
It could be the caching of top-level completion items in the ASTUnit. It should probably take the new context kinds into account somehow. I came to that conclusion because clangd does not seem to be affected, so it is probably ASTUnit-specific.
Fix is on review: https://reviews.llvm.org/D64918 I will ask to merge this into the release branch after it lands too.
Adding blocking for the release. (And updated title, because trunk is not 8)
The fix landed in r366448. Hans, could we cherry-pick it into the release branch?
Also landed r366457 to unbreak tests on windows buildbots. (passing environment variables on Windows seems to require 'env')
(In reply to ibiryukov from comment #6) > Also landed r366457 to unbreak tests on windows buildbots. > (passing environment variables on Windows seems to require 'env') Merged both changes to clang 9 in r366717.