Skip to content

Commit

Permalink
[clang][CodeCompletion] Allow debuggers to code-complete reserved ide…
Browse files Browse the repository at this point in the history
…ntifiers (#84891)
  • Loading branch information
Michael137 committed Mar 12, 2024
1 parent 76f3a08 commit beb47e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions clang/lib/Sema/SemaCodeComplete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,10 @@ getRequiredQualification(ASTContext &Context, const DeclContext *CurContext,
// Filter out names reserved for the implementation if they come from a
// system header.
static bool shouldIgnoreDueToReservedName(const NamedDecl *ND, Sema &SemaRef) {
// Debuggers want access to all identifiers, including reserved ones.
if (SemaRef.getLangOpts().DebuggerSupport)
return false;

ReservedIdentifierStatus Status = ND->isReserved(SemaRef.getLangOpts());
// Ignore reserved names for compiler provided decls.
if (isReservedInAllContexts(Status) && ND->getLocation().isInvalid())
Expand Down
7 changes: 6 additions & 1 deletion clang/test/CodeCompletion/ordinary-name.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ typedef struct t _TYPEDEF;
void foo() {
int y;
// RUN: %clang_cc1 -isystem %S/Inputs -fsyntax-only -code-completion-at=%s:%(line-1):9 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1-NOT: __builtin_va_list
// CHECK-CC1-NOT: __INTEGER_TYPE
// CHECK-CC1: _Imaginary
// CHECK-CC1: _MyPrivateType
Expand All @@ -15,4 +16,8 @@ void foo() {
// CHECK-CC1: y

// PR8744
// RUN: %clang_cc1 -isystem %S/Inputs -fsyntax-only -code-completion-at=%s:%(line-17):11 %s
// RUN: %clang_cc1 -isystem %S/Inputs -fsyntax-only -code-completion-at=%s:%(line-18):11 %s

// 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
// CHECK-DBG: __builtin_va_list
// CHECK-DBG: __INTEGER_TYPE

0 comments on commit beb47e7

Please sign in to comment.