[PATCH] D46602: [clang-tidy] Store checks profiling info as YAML files

Aaron Ballman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 31 05:10:43 PDT 2018


aaron.ballman added inline comments.


================
Comment at: clang-tidy/ClangTidyProfiling.cpp:72
+  if (EC) {
+    llvm::errs() << "Error opening output file'" << Storage->StoreFilename
+                 << "': " << EC.message() << "\n";
----------------
Missing a whitespace before the quote for the file name.


================
Comment at: clang-tidy/tool/ClangTidyMain.cpp:334
 
+  auto processPrefix = [](const std::string &input) -> SmallString<256> {
+    if (input.empty())
----------------
The identifiers here don't match the coding convention (should be `ProcessPrefix` and `Input` by convention).


================
Comment at: clang-tidy/tool/ClangTidyMain.cpp:342-347
+    if (!llvm::sys::fs::exists(AbsolutePath)) {
+      // If the destination prefix does not exist, don't try to use real_path().
+      return AbsolutePath;
+    }
+    SmallString<256> dest;
+    if (std::error_code EC = llvm::sys::fs::real_path(AbsolutePath, dest)) {
----------------
This creates a TOCTOU bug; can you call `real_path()` without checking for existence and instead check the error code to decide whether to spit out an error or return `AbsolutePath`?


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D46602





More information about the llvm-commits mailing list