Skip to content

Commit beb47e7

Browse files
authored
[clang][CodeCompletion] Allow debuggers to code-complete reserved identifiers (llvm#84891)
1 parent 76f3a08 commit beb47e7

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
@@ -764,6 +764,10 @@ getRequiredQualification(ASTContext &Context, const DeclContext *CurContext,
764764
// Filter out names reserved for the implementation if they come from a
765765
// system header.
766766
static bool shouldIgnoreDueToReservedName(const NamedDecl *ND, Sema &SemaRef) {
767+
// Debuggers want access to all identifiers, including reserved ones.
768+
if (SemaRef.getLangOpts().DebuggerSupport)
769+
return false;
770+
767771
ReservedIdentifierStatus Status = ND->isReserved(SemaRef.getLangOpts());
768772
// Ignore reserved names for compiler provided decls.
769773
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)