[PATCH] D87187: [Driver] Perform Linux distribution detection just once
Reid Kleckner via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 23 11:11:23 PDT 2020
rnk added a comment.
I think we can go forward with the reviewers we have. I have one more concern. Are the other reviewers happy?
================
Comment at: clang/lib/Driver/Distro.cpp:206
+ const llvm::Triple &TargetOrHost) {
+ static Distro::DistroType Type = Distro::UninitializedDistro;
+
----------------
I guess I have one more concern: this code isn't thread safe. It's unlikely to every be called from multiple threads, but let's use the safe code pattern anyway. You can use lazy static local initialization like so:
static ... GetDistro(...) {
if (FS is Real FS && on Linux ...) {
static const Distro::DistroType hostDistro = computeRealDistro();
return hostDistro;
}
return computeDistroWithVFS();
}
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87187/new/
https://reviews.llvm.org/D87187
More information about the cfe-commits
mailing list