This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Get rid of ASTWorker::getCurrentFileInputs
ClosedPublic

Authored by kadircet on Apr 2 2020, 7:39 AM.

Details

Summary

FileInputs are only written by ASTWorker thread, therefore it is safe
to read them without the lock inside that thread. It can still be read by other
threads through ASTWorker::getCurrentCompileCommand though.

This patch also gets rid of the smart pointer wrapping FileInputs as there is
never mutliple owners.

Diff Detail

Event Timeline

kadircet created this revision.Apr 2 2020, 7:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 2 2020, 7:39 AM
sammccall accepted this revision.Apr 7 2020, 3:32 AM
sammccall added inline comments.
clang-tools-extra/clangd/TUScheduler.cpp
457–459

this GUARDED_BY comment is a bit misleading.
I'd be more explicit here as it's a bit unusual:
Writes and reads from unknown threads are locked.
Reads from the worker thread are not locked as it's the only writer thread.

This revision is now accepted and ready to land.Apr 7 2020, 3:32 AM
kadircet updated this revision to Diff 255632.Apr 7 2020, 4:09 AM
kadircet marked an inline comment as done.
  • Address comments
This revision was automatically updated to reflect the committed changes.