[PATCH] D66555: [driver] add a new option `-gen-cdb-fragment-path` to emit a fragment of a compilation database for each compilation

Jan Korous via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 22 18:48:29 PDT 2019


jkorous added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:2067
+  const auto &Driver = C.getDriver();
+  auto CWD = Driver.getVFS().getCurrentWorkingDirectory();
+  if (!CWD) {
----------------
Do we still need this now?


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:2089
+  if (Err) {
+    Driver.Diag(diag::err_drv_compilationdatabase) << Err.message();
+    return;
----------------
Just to make sure - the error different on purpose here?


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:2092
+  }
+  CompilationDatabase =
+      std::make_unique<llvm::raw_fd_ostream>(FD, /*shouldClose=*/true);
----------------
I'm not familiar with intended lifecycle of `CompilationDatabase ` member. Just to make sure - we need neither to preserve the original value nor reset the stream after we're done here (as in - nobody is going to write anything after we're done here), right?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66555/new/

https://reviews.llvm.org/D66555





More information about the cfe-commits mailing list