[clang] [clang-tools-extra] [clang-tidy] Do not crash when an empty directory is used in the comp… (PR #156873)

Victor Chernyakin via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 4 09:41:29 PDT 2025


================
@@ -574,22 +574,30 @@ int ClangTool::run(ToolAction *Action) {
       continue;
     }
     for (CompileCommand &CompileCommand : CompileCommandsForFile) {
+      // If the 'directory' field of the compilation database is empty, display
+      // an error and use the working directory instead.
+      std::string Directory = CompileCommand.Directory;
----------------
localspook wrote:

```suggestion
      StringRef Directory = CompileCommand.Directory;
```
?

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


More information about the cfe-commits mailing list