[PATCH] D87187: [Driver] Perform Linux distribution detection just once

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 24 10:43:25 PDT 2020


rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

`llvm::call_once` is fine, but IMO the static local version is preferable: it's built in to the language, no headers to include.



================
Comment at: clang/lib/Driver/Distro.cpp:224
+  if (onRealFS) {
+    static Distro::DistroType LinuxDistro = Distro::UninitializedDistro;
+    static llvm::once_flag DistroDetectFlag;
----------------
I think this would work and be simpler than call_once:
  static Distro::DistroType LinuxDistro = DetectDistro(llvm::vfs::getRealFileSystem());

I could be wrong.


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