[PATCH] Defining a new API for debug options that doesn't rely on static global cl::opts.
beanz at apple.com
Fri Oct 10 11:32:41 PDT 2014
A few more comments for things I came across while updating the patches. Updated patches coming shortly.
Comment at: include/llvm/Support/Options.h:31
@@ +30,3 @@
+template <typename ValT, typename Base, ValT(Base::*Mem)>
+LLVMOptionKey OptionKey<ValT, Base, Mem>::ID = 0;
> Why initialize it at all?
If you don't initialize this you get a warning "has internal linkage but is not defined [-Wundefined-internal]"
Comment at: include/llvm/Support/Options.h:38
@@ +37,3 @@
+ DenseMap<LLVMOptionKey *, cl::Option *> Options;
> Should document that this owns the cl::Option objects pointed to but doesn't use std::unique_ptr or delete them but instead intentionally leaks them.
But it does delete them... See the destructor in Options.cpp.
More information about the llvm-commits