New user self-registration is disabled due to spam. For an account please email bugs-admin@lists.llvm.org with your e-mail address and full name.

Bug 42646 - [REG 7 -> 9] Completion offers namespace items after Class::
Summary: [REG 7 -> 9] Completion offers namespace items after Class::
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: libclang (show other bugs)
Version: trunk
Hardware: PC Linux
: P enhancement
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks: release-9.0.0
  Show dependency tree
 
Reported: 2019-07-17 00:16 PDT by Nikolai Kosjar
Modified: 2019-07-22 11:12 PDT (History)
6 users (show)

See Also:
Fixed By Commit(s): r366448, r366457


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nikolai Kosjar 2019-07-17 00:16:55 PDT
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).
Comment 1 Nikolai Kosjar 2019-07-17 01:23:55 PDT
Bisected to https://reviews.llvm.org/D53191
Comment 2 ibiryukov 2019-07-17 01:27:55 PDT
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.
Comment 3 ibiryukov 2019-07-18 06:33:47 PDT
Fix is on review: https://reviews.llvm.org/D64918
I will ask to merge this into the release branch after it lands too.
Comment 4 Sam McCall 2019-07-18 08:14:59 PDT
Adding blocking for the release.

(And updated title, because trunk is not 8)
Comment 5 ibiryukov 2019-07-18 08:23:12 PDT
The fix landed in r366448.

Hans, could we cherry-pick it into the release branch?
Comment 6 ibiryukov 2019-07-18 09:25:05 PDT
Also landed r366457 to unbreak tests on windows buildbots.
(passing environment variables on Windows seems to require 'env')
Comment 7 Hans Wennborg 2019-07-22 11:12:48 PDT
(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.