Skip to content

Commit bd9c58f

Browse files
committed
[clang][CodeCompletion] Allow debuggers to code-complete reserved identifiers (llvm#84891)
(cherry picked from commit beb47e7)
1 parent 4560980 commit bd9c58f

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

clang/lib/Sema/SemaCodeComplete.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,10 @@ ResultBuilder::ShadowMapEntry::end() const {
700700
// Filter out names reserved for the implementation if they come from a
701701
// system header.
702702
static bool shouldIgnoreDueToReservedName(const NamedDecl *ND, Sema &SemaRef) {
703+
// Debuggers want access to all identifiers, including reserved ones.
704+
if (SemaRef.getLangOpts().DebuggerSupport)
705+
return false;
706+
703707
ReservedIdentifierStatus Status = ND->isReserved(SemaRef.getLangOpts());
704708
// Ignore reserved names for compiler provided decls.
705709
if (isReservedInAllContexts(Status) && ND->getLocation().isInvalid())

clang/test/CodeCompletion/ordinary-name.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ typedef struct t _TYPEDEF;
55
void foo() {
66
int y;
77
// RUN: %clang_cc1 -isystem %S/Inputs -fsyntax-only -code-completion-at=%s:%(line-1):9 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
8+
// CHECK-CC1-NOT: __builtin_va_list
89
// CHECK-CC1-NOT: __INTEGER_TYPE
910
// CHECK-CC1: _Imaginary
1011
// CHECK-CC1: _MyPrivateType
@@ -15,4 +16,8 @@ void foo() {
1516
// CHECK-CC1: y
1617

1718
// PR8744
18-
// RUN: %clang_cc1 -isystem %S/Inputs -fsyntax-only -code-completion-at=%s:%(line-17):11 %s
19+
// RUN: %clang_cc1 -isystem %S/Inputs -fsyntax-only -code-completion-at=%s:%(line-18):11 %s
20+
21+
// RUN: %clang_cc1 -isystem %S/Inputs -fsyntax-only -fdebugger-support -code-completion-at=%s:%(line-15):9 %s -o - | FileCheck -check-prefix=CHECK-DBG %s
22+
// CHECK-DBG: __builtin_va_list
23+
// CHECK-DBG: __INTEGER_TYPE

0 commit comments

Comments
 (0)