[PATCH] D34055: Be more strict when checking the -flto option value

Yuka Takahashi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 9 10:27:36 PDT 2017


yamaguchi updated this revision to Diff 102051.
yamaguchi added a comment.

I think we don't need additional testcase, because this is non-functional change. Driver.cpp will emit error if value was not "thin" nor "full". This testcase is at clang/test/CodeGen/thinlto-backend-option.ll.


https://reviews.llvm.org/D34055

Files:
  clang/lib/Frontend/CompilerInvocation.cpp


Index: clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -649,8 +649,9 @@
   Opts.NoUseJumpTables = Args.hasArg(OPT_fno_jump_tables);
 
   Opts.PrepareForLTO = Args.hasArg(OPT_flto, OPT_flto_EQ);
-  const Arg *A = Args.getLastArg(OPT_flto, OPT_flto_EQ);
-  Opts.EmitSummaryIndex = A && A->containsValue("thin");
+  Opts.EmitSummaryIndex =
+      Args.hasArg(OPT_flto_EQ) &&
+      StringRef(Args.getLastArgValue(OPT_flto_EQ)) == "thin";
   Opts.LTOUnit = Args.hasFlag(OPT_flto_unit, OPT_fno_lto_unit, false);
   if (Arg *A = Args.getLastArg(OPT_fthinlto_index_EQ)) {
     if (IK.getLanguage() != InputKind::LLVM_IR)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34055.102051.patch
Type: text/x-patch
Size: 771 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170609/1cdb5cd1/attachment-0001.bin>


More information about the cfe-commits mailing list