Is cl::opt really the issue here? As long as we’re using multiple processes and not threads, we should already have the facilities to parse command line options multiple times (see ResetAllOptionOccurrences etc).
The example @BStott mentioned is global state in WPD which does not use any of our standard facilities: llvm-project/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp at 8462cff40daf40e58d705f5d86d4e91ef6e6294c · llvm/llvm-project · GitHub This is a plain bug in the pass, and should be fixed. Passes should never use global state in this matter.
For this particular case, WholeProgramDevirtCutoff should probably be replaced with a DebugCounter, as the option exists only for debugging.