[PATCH] D105461: [Support] CommandLine.cpp - Fix thread race condition in addOption
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 8 10:28:13 PDT 2021
MaskRay added a comment.
Adding/deleting options is typically done in a separate initialization stage, and just once.
It is easier to ensure a single thread by application but pretty hard by the library.
https://lists.llvm.org/pipermail/llvm-dev/2018-October/127039.html ([RFC] Enable thread specific cl::opt values for multi-threaded support) is a related previous thread.
The patch D53424 <https://reviews.llvm.org/D53424> was abandoned. Folks had concerns like these:
> @mehdi_amini : The consensus at the time was that the cl::opt were only here for debugging / overriding default, but should not be the way any user of "LLVM as a library" set the options.
> zturner: I can't deny that it solves a practical problem, but I'm mildly concerned that this is making a bad problem even worse.
cl::opt (and its friends like cl::list) does have some problems, but we need to figure out the needs and look at the big picture.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105461/new/
https://reviews.llvm.org/D105461
More information about the llvm-commits
mailing list