[PATCH] D51314: Parse compile commands lazily in InterpolatingCompilationDatabase
JF Bastien via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 27 09:45:25 PDT 2018
jfb requested changes to this revision.
jfb added inline comments.
This revision now requires changes to proceed.
================
Comment at: lib/Tooling/InterpolatingCompilationDatabase.cpp:201
+
+ CommandTraits computeTraits() const {
+ CommandTraits Result;
----------------
It's not clear to me that this entire function is safe to call from multiple threads at the same time. Even if it's safe now, I'm willing to bet it won't always be that way. `getTraits` should therefore use a magic static or `call_once` and avoid the headache entirely.
================
Comment at: lib/Tooling/InterpolatingCompilationDatabase.cpp:258
+ /// Null before Traits were computed, non-null otherwise. All accesses to this
+ /// must be atomic.
+ mutable std::shared_ptr<CommandTraits> Traits;
----------------
The comment should say why accesses need to be atomic. Or better yet, this should only be usable "the right way".
Repository:
rC Clang
https://reviews.llvm.org/D51314
More information about the cfe-commits
mailing list