Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I'm a little concerned by this, not sure if Expected and Optional play nicely with rvo. If the compiler can't optimise it's potentially a 256 byte memcpy in the return, granted that would still be cheaper than dynamic allocation. However it would most likely be faster if the functions took a reference to the SmallString (or more likely SmallVectorImpl<char>) and returned an llvm::Error or bool.
Sorry I don't really follow what we are gaining by changes from string to SmallString. Could you explain if I am missing something?
But I think it makes sense to get rid of Optionals in the Marshaller for {Local,Remote}IndexRoot, as there's no difference between None vs empty for them (I think).
clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp | ||
---|---|---|
61 | we seem to be explicitly creating a smallstring out of std::string. and all of the usages of remoteindexroot seems to be just using a stringref. why are we doing this exactly? to make sure the addition of trailing separator below doesn't do reallocation ? If so this only happens once per each remote-index, right? Is it really worth all the hassle? same for LocalIndexRoot. | |
378 | don't we end up creating a string here anyways? (same below) | |
clang-tools-extra/clangd/index/remote/marshalling/Marshalling.h | ||
98–99 | what's the difference between None and empty string here ? Can we just get rid of Optional? |
clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp | ||
---|---|---|
60 | nit: if(!is_separator(this->RemoteIndexRoot.back(), posix)) same below. |
clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp | ||
---|---|---|
62 | I know this already commited, but maybe we could use llvm::sys::path::is_separator instead of is_separator to be consistent with other function calls from llvm::sys::path namespace in this file. P.S. llvm::sys::path::is_separator checks a single char, but llvm::sys::path::get_separator returns string. Can not understand why. Could there be a multi-char separator in the future? |
clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp | ||
---|---|---|
62 | I think it'd be better to strip llvm::sys::path elsewhere and simply rely on ADL. Spelling llvm::sys::path:: twice does not really add much value and simply takes more space. I'll send a separate patch. |
clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp | ||
---|---|---|
62 | Because llvm::sys::path::get_separator returns a null terminated string.
I would expect the person doing such a change to also update is_separator. |
clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp | ||
---|---|---|
62 |
Why does not llvm::sys::path::get_separator() return a single char instead of a null-terminated string? |
clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp | ||
---|---|---|
62 |
Probably to make composition with + easier. But one would need to dig-up the git blame and see if there are any other reasons I suppose, or ask the authors as mine is merely a guess :D |
clang-tidy: error: 'Index.pb.h' file not found [clang-diagnostic-error]
not useful
clang-tidy: error: 'Index.pb.h' file not found [clang-diagnostic-error]
not useful