[PATCH] D39834: [clangd] -foptimization-record-file= should imply -fsave-optimization-record

Dmitry Venikov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 9 23:40:47 PST 2017


Quolyk updated this revision to Diff 122395.
Quolyk retitled this revision from "[clangd][WIP] -foptimization-record-file= should imply -fsave-optimization-record" to "[clangd] -foptimization-record-file= should imply -fsave-optimization-record".
Quolyk added a comment.

Added 1 test, I guess it's sufficient


https://reviews.llvm.org/D39834

Files:
  lib/Driver/ToolChains/Clang.cpp
  test/Driver/opt-record.c


Index: test/Driver/opt-record.c
===================================================================
--- test/Driver/opt-record.c
+++ test/Driver/opt-record.c
@@ -9,6 +9,7 @@
 // RUN: %clang -### -S -fsave-optimization-record -x cuda -nocudainc -nocudalib %s 2>&1 | FileCheck %s -check-prefix=CHECK-NO-O -check-prefix=CHECK-CUDA-DEV
 // RUN: %clang -### -fsave-optimization-record -x cuda -nocudainc -nocudalib %s 2>&1 | FileCheck %s -check-prefix=CHECK-NO-O -check-prefix=CHECK-CUDA-DEV
 // RUN: %clang -### -S -o FOO -fsave-optimization-record -foptimization-record-file=BAR.txt %s 2>&1 | FileCheck %s -check-prefix=CHECK-EQ
+// RUN: %clang -### -S -o FOO -foptimization-record-file=BAR.txt %s 2>&1 | FileCheck %s -check-prefix=CHECK-EQ
 
 // CHECK: "-cc1"
 // CHECK: "-opt-record-file" "FOO.opt.yaml"
Index: lib/Driver/ToolChains/Clang.cpp
===================================================================
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -4376,6 +4376,11 @@
       llvm::sys::path::replace_extension(F, "opt.yaml");
       CmdArgs.push_back(Args.MakeArgString(F));
     }
+  } else {
+    if (const Arg *A = Args.getLastArg(options::OPT_foptimization_record_file_EQ)) {
+      CmdArgs.push_back("-opt-record-file");
+      CmdArgs.push_back(A->getValue());
+    }
   }
 
   bool RewriteImports = Args.hasFlag(options::OPT_frewrite_imports,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39834.122395.patch
Type: text/x-patch
Size: 1387 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171110/8cba1198/attachment.bin>


More information about the cfe-commits mailing list