[PATCH] D17335: [clang-tidy] Fix a crash issue when clang-tidy runs with compilation database.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 22 01:54:43 PST 2016


hokein marked 4 inline comments as done.

================
Comment at: clang-tidy/ClangTidyDiagnosticConsumer.cpp:120
@@ +119,3 @@
+                               bool IsWarningAsError,
+                               const std::string &BuildDirectory)
+    : BuildDirectory(std::move(BuildDirectory)), CheckName(CheckName),
----------------
We might not use `StringRef` here since 
`SourceManager.getFileManager().getVirtualFileSystem().getCurrentWorkingDirectory()` returns `std::string`.

================
Comment at: clang-tidy/ClangTidyDiagnosticConsumer.h:66
@@ +65,3 @@
+  // It's an absolute path which is `directory` field of the source file in
+  // compilation database. If users don't specify compilation database
+  // directory, it is the current directory where clang-tidy runs.
----------------
However, I see the `compile_commands.json` is hardcoded in source. http://clang.llvm.org/doxygen/JSONCompilationDatabase_8cpp_source.html#l00111


http://reviews.llvm.org/D17335





More information about the cfe-commits mailing list