[clang-tools-extra] [clang-tidy][NFC] Fix `bugprone-unchecked-optional-access` warnings in codebase (PR #170004)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 24 05:11:18 PST 2026


================
@@ -43,21 +43,22 @@ void ClangTidyProfiling::printUserFriendlyTable(llvm::raw_ostream &OS,
 }
 
 void ClangTidyProfiling::printAsJSON(llvm::raw_ostream &OS,
-                                     llvm::TimerGroup &TG) {
+                                     llvm::TimerGroup &TG,
+                                     const StorageParams &Storage) {
   OS << "{\n";
-  OS << R"("file": ")" << Storage->SourceFilename << "\",\n";
-  OS << R"("timestamp": ")" << Storage->Timestamp << "\",\n";
+  OS << R"("file": ")" << Storage.SourceFilename << "\",\n";
+  OS << R"("timestamp": ")" << Storage.Timestamp << "\",\n";
   OS << "\"profile\": {\n";
   TG.printJSONValues(OS, "");
   OS << "\n}\n";
   OS << "}\n";
   OS.flush();
 }
 
-void ClangTidyProfiling::storeProfileData(llvm::TimerGroup &TG) {
-  assert(Storage && "We should have a filename.");
-
-  llvm::SmallString<256> OutputDirectory(Storage->StoreFilename);
+void ClangTidyProfiling::storeProfileData(llvm::TimerGroup &TG,
+                                          const StorageParams &Storage) {
+  assert(this->Storage && "We should have a filename.");
----------------
vbvictor wrote:

If we asserted here, then we can just use `Storage` that comes from `this` without any more modifications?

https://github.com/llvm/llvm-project/pull/170004


More information about the cfe-commits mailing list