[PATCH] D29445: LTO: add a code-model flag

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 2 06:19:30 PST 2017

jhenderson added subscribers: davidb, jhenderson.
jhenderson added a comment.

Looks like the diff is missing context. Also, is there any chance of any tests?

Comment at: tools/gold/gold-plugin.cpp:672
+static CodeModel::Model getCodeModel(std::string CodeModel) {
+  unsigned CM =
Is there anywhere we could put this function so that we could share it with ELF/Driver.cpp to prevent essentially duplicate code?

Comment at: tools/gold/gold-plugin.cpp:679
+     .Case("large", llvm::CodeModel::Large)
+     .Default(llvm::CodeModel::Default);
+  return static_cast<llvm::CodeModel::Model>(CM);
Should this function emit an error if CodeModel is not recognised? As far as I can see, this will silently accept incorrect switches, which could be harmful (e.g. a typo leads to passing in "meidum" or similar).



More information about the llvm-commits mailing list