[LLVMdev] [RFC] Removing static initializers for command line options

Rafael Espíndola rafael.espindola at gmail.com
Wed Aug 20 09:59:10 PDT 2014


>> Another option (not my preference) would be to use globals just as keys:
>>
>> typedef <something> LLVMOptionKey;
>> ...
>> static LLVMOptionKey ScalarizeLoadStoreKey; //global
> You could do this if the key is the name of the option, but that detaches the name from the rest of the calls which may be quite far apart in the code.  Otherwise so long as the key type doesn’t have a static constructor, this is fine with me.

The Key global is only used for its unique address, so LLVMOptionKey
could be just "void *" for example.

Cheers,
Rafael




More information about the llvm-dev mailing list