[LLVMdev] Support/CommandLine.h exposed through Pass.h?
Chris Lattner
sabre at nondot.org
Tue Aug 24 10:39:50 PDT 2004
On Tue, 24 Aug 2004, Reid Spencer wrote:
> In writing llvmc, I need to link in the Bytecode reader in order to
> extract the "dependent libraries" from the bytecode files. And, bytecode
> reader needs vmcore. And, vmcore has a static cl::opt<bool> named
> "EnableTiming" for the -time-passes option. This conflicts at runtime
> with llvmc's -time-passes option (which it passes through to
> sub-tools).
Ok.
> So, my solution is to declare the EnableTiming global var in Pass.h,
> remove its "static" keyword in Pass.cpp and expose
> "Support/CommandLine.h" in Pass.h. This compiles and works fine in all
> tools, but its a bit gross to expose CommandLine.h via Pass.h.
>
> Anyone object?
Yes, I do. :) Check out how -debug is handled. In particular, the
CommandLine library supports the idea of "external storage", which will
allow you to just put a bool in the header, and have the command line
option set the bool. This is described in the CommandLine documentation
as well.
-Chris
--
http://llvm.org/
http://nondot.org/sabre/
More information about the llvm-dev
mailing list