ROCm / ROCm-OpenCL-Driver

ROCm OpenCL Compiler Tool Driver
MIT License
24 stars 9 forks source link

[in-process] Setting options to its default values. #22

Closed emankov closed 7 years ago

emankov commented 7 years ago

LLVM/Clang options being set once stay the same from one compilation to another (if not being reset manually). In general it might lead and actually leads to wrong compilation results and even failures and crashes. The needed functionality is to set all the options to its default values on every Compilation call.

The best place is seen in Clang's CommandLine.h, where such functionallity is missing. For instance, virtual method llvm::cl::Option::setDefault() is worth implementing in order to be able to set all the options to its default values in user's code without actually knowing all these options:

for (auto SC : llvm::cl::getRegisteredSubcommands()) { for (auto &OM : SC->OptionsMap) { llvm::cl::Option *O = OM.second; // missing functionality in Clang's CommandLine.h O->setDefault(); } }

emankov commented 7 years ago

Supported by [#27].