[PATCH] D131469: [Clang] change default storing path of `-ftime-trace`

Whitney Tsang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 11 08:53:31 PDT 2022


Whitney added inline comments.


================
Comment at: clang/lib/Driver/Driver.cpp:4786
+        const std::string::size_type size = arg.size();
+        char *buffer = new char[size + 1];
+        memcpy(buffer, arg.c_str(), size + 1);
----------------
dongjunduo wrote:
> Whitney wrote:
> > Assert size not 0.
> The size of `arg` maynot be 0 because of its basic initialization in L:4690
> ```
> std::string arg = std::string("-ftime-trace=");
> ```
How about assert that it starts with `-ftime-trace=` and not ends with `=`.


================
Comment at: clang/tools/driver/cc1_main.cpp:260
+    SmallString<128> TracePath(Clang->getFrontendOpts().TimeTracePath);
+    if (TracePath.empty()) {
+      llvm::errs() << "-ftime-trace=<path> is empty!\n";
----------------
As it is unexpected, it should be an assert: 
`assert(!TracePath.empty() && "...");`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131469



More information about the cfe-commits mailing list