This is an archive of the discontinued LLVM Phabricator instance.

[clangd][xpc] pass the LSP value using data instead of string
Needs ReviewPublic

Authored by arphaman on Jun 28 2019, 3:47 PM.
This revision needs review, but all reviewers have resigned.

Details

Reviewers
jkorous
Summary

Use XPC's data type instead of string to pass the LSP value from Clangd. This will make it easier to use from sourcekit-lsp (https://github.com/apple/sourcekit-lsp/pull/112), where I will be able to drop a conversion between Data and String.

Diff Detail

Event Timeline

arphaman created this revision.Jun 28 2019, 3:47 PM
arphaman retitled this revision from [clangd][xpc] pass it LSP value using data instead of string to [clangd][xpc] pass the LSP value using data instead of string.Jun 28 2019, 3:47 PM
arphaman updated this revision to Diff 207164.Jun 28 2019, 3:56 PM

Added missing xpc_release in the test.

I'd add a test with non-empty non-LSP dictionary to specifically test that we're ignoring the content. I like const-correctness but that's up to you. Otherwise LGTM.

clang-tools-extra/clangd/unittests/xpc/ConversionTests.cpp
34

We should also test something like

const char* key = "NotAnLSP";
const char* value = "Foo";
xpc_object_t EmptyDict = xpc_dictionary_create(&key, &value, 1);
clang-tools-extra/clangd/xpc/Conversion.cpp
22

Nit - const std::string?

29

Nit -const size_t and const char * const?

jkorous resigned from this revision.Jan 21 2022, 3:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 21 2022, 3:54 PM