[PATCH] D70766: Consolidate global variables to a single place
Peter Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 27 06:08:44 PST 2019
peter.smith added a comment.
There are a couple of downsides to putting all the globals in one place. I think the LLD codebase is probably small enough for them to not be too serious:
- It couples pretty much every file to a single place. Touching this file means recompiling everything.
- It can make the code harder to reason about as any file can see all the globals, and can potentially modify them. This is a possible argument for not promoting statics to globals as the scope of a static is much easier to reason about.
I don't have a strong opinion about which is best. I can see the above patch making it easier to remember to initialize globals, and I think that there is already enough global state via config to make this only a small impact to understanding the code.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70766/new/
https://reviews.llvm.org/D70766
More information about the llvm-commits
mailing list