[PATCH] D44231: Check for sizeof that call functions
Paul Fultz II via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 7 15:12:21 PST 2018
pfultz2 updated this revision to Diff 137496.
https://reviews.llvm.org/D44231
Files:
clangd/CodeComplete.cpp
test/clangd/protocol.test
unittests/clangd/CodeCompleteTests.cpp
Index: unittests/clangd/CodeCompleteTests.cpp
===================================================================
--- unittests/clangd/CodeCompleteTests.cpp
+++ unittests/clangd/CodeCompleteTests.cpp
@@ -595,6 +595,18 @@
EXPECT_TRUE(Results.items.empty());
}
+TEST(CodeCompleteTest, NoColonColonAtTheEnd) {
+ auto Results = completions(R"cpp(
+ namespace clang { }
+ void f() {
+ clan^
+ }
+ )cpp");
+
+ EXPECT_THAT(Results.items, Contains(Labeled("clang")));
+ EXPECT_THAT(Results.items, Not(Contains(Labeled("clang::"))));
+}
+
SignatureHelp signatures(StringRef Text) {
MockFSProvider FS;
MockCompilationDatabase CDB;
Index: test/clangd/protocol.test
===================================================================
--- test/clangd/protocol.test
+++ test/clangd/protocol.test
@@ -38,7 +38,7 @@
# CHECK-NEXT: "insertText": "fake",
# CHECK-NEXT: "insertTextFormat": 1,
# CHECK-NEXT: "kind": 7,
-# CHECK-NEXT: "label": "fake::",
+# CHECK-NEXT: "label": "fake",
# CHECK-NEXT: "sortText": "{{.*}}"
# CHECK: ]
# CHECK-NEXT: }
@@ -67,7 +67,7 @@
# CHECK-NEXT: "insertText": "fake",
# CHECK-NEXT: "insertTextFormat": 1,
# CHECK-NEXT: "kind": 7,
-# CHECK-NEXT: "label": "fake::",
+# CHECK-NEXT: "label": "fake",
# CHECK-NEXT: "sortText": "{{.*}}"
# CHECK: ]
# CHECK-NEXT: }
@@ -96,7 +96,7 @@
# CHECK-NEXT: "insertText": "fake",
# CHECK-NEXT: "insertTextFormat": 1,
# CHECK-NEXT: "kind": 7,
-# CHECK-NEXT: "label": "fake::",
+# CHECK-NEXT: "label": "fake",
# CHECK-NEXT: "sortText": "{{.*}}"
# CHECK: ]
# CHECK-NEXT: }
Index: clangd/CodeComplete.cpp
===================================================================
--- clangd/CodeComplete.cpp
+++ clangd/CodeComplete.cpp
@@ -470,6 +470,8 @@
// (s.^ completes ~string, but s.~st^ is an error).
if (dyn_cast_or_null<CXXDestructorDecl>(Result.Declaration))
continue;
+ // We choose to never append '::' to completion results in clangd.
+ Result.StartsNestedNameSpecifier = false;
Results.push_back(Result);
}
ResultsCallback();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44231.137496.patch
Type: text/x-patch
Size: 2249 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180307/2000d0bf/attachment-0001.bin>
More information about the cfe-commits
mailing list