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

Reid "Away June-Sep" Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 17 10:46:34 PDT 2020


rnk added inline comments.


================
Comment at: clang/lib/Driver/Distro.cpp:205
+                                    const llvm::Triple &TargetOrHost) {
+  static Distro::DistroType Type = Distro::UninitializedDistro;
+
----------------
aganea wrote:
> I'm not sure if this is safe. @rnk Do we expect to call `GetDistro` with a different `VFS` or a different `Triple` when compiling with Clang? For GPU targets? Shouldn't we do this higher up, on the call site?
I think there is a plausible use case for a compile server that does two compiles with different VFSs where you would get different distro detection results. I think this should be a field on the `Driver` object instead of a global variable.

I know LLD uses lots of globals, but that's not part of the clang design philosophy.


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