Skip to content

Commit 5571918

Browse files
authored
Merge pull request #8383 from Michael137/bugfix/lldb-code-complete-reserved-to-20230725
2 parents 20f9b31 + f8f1082 commit 5571918

File tree

6 files changed

+29
-1
lines changed

6 files changed

+29
-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
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
CXX_SOURCES := main.cpp other.cpp
2+
CXXFLAGS += -isystem $(SRCDIR)/sys
23

34
include Makefile.rules

lldb/test/API/commands/expression/completion/TestExprCompletion.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,11 @@ def test_expr_completion(self):
246246
"expr some_expr.Self(). FooNoArgs", "expr some_expr.Self(). FooNoArgsBar()"
247247
)
248248

249+
self.complete_from_to("expr myVec.__f", "expr myVec.__func()")
250+
self.complete_from_to("expr myVec._F", "expr myVec._Func()")
251+
self.complete_from_to("expr myVec.__m", "expr myVec.__mem")
252+
self.complete_from_to("expr myVec._M", "expr myVec._Mem")
253+
249254
def test_expr_completion_with_descriptions(self):
250255
self.build()
251256
self.main_source = "main.cpp"

lldb/test/API/commands/expression/completion/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include <reserved.h>
2+
13
namespace LongNamespaceName { class NestedClass { long m; }; }
24

35
// Defined in other.cpp, we only have a forward declaration here.
@@ -31,5 +33,8 @@ int main()
3133
some_expr.FooNumbersBar1();
3234
Expr::StaticMemberMethodBar();
3335
ForwardDecl *fwd_decl_ptr = &fwd_decl;
36+
MyVec myVec;
37+
myVec.__func();
38+
myVec._Func();
3439
return 0; // Break here
3540
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class MyVec {
2+
int __mem;
3+
int _Mem;
4+
5+
public:
6+
void __func() {}
7+
void _Func() {}
8+
};

0 commit comments

Comments
 (0)