This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Simplify the code in XRefs
ClosedPublic

Authored by ilya-biryukov on Nov 14 2019, 1:42 AM.

Details

Summary

While here, also fix potential UB in MergeIndex.

Thanks Kadir for finding this!

Diff Detail

Event Timeline

ilya-biryukov created this revision.Nov 14 2019, 1:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 14 2019, 1:42 AM

Build result: pass - 60074 tests passed, 0 failed and 729 were skipped.
Log files: console-log.txt, CMakeCache.txt

hokein accepted this revision.Nov 14 2019, 3:02 AM

Thanks, the title is a bit confusing, the modified code is about the index, not XRefs.

clang-tools-extra/clangd/index/Merge.cpp
116

I assume the potential UB is this code?

This revision is now accepted and ready to land.Nov 14 2019, 3:02 AM
ilya-biryukov marked 2 inline comments as done.Nov 14 2019, 5:41 AM
ilya-biryukov added inline comments.
clang-tools-extra/clangd/index/Merge.cpp
116

Yes, exactly. I believe it's not UB after C++17 or C++20.
However, mutating More inside the assignment to More definitely makes the reader pause, we'd rather avoid it.

This revision was automatically updated to reflect the committed changes.
ilya-biryukov marked an inline comment as done.