[PATCH] D49890: Clang-Tidy Export Problem

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 27 04:54:27 PDT 2018


JonasToth added inline comments.


================
Comment at: ClangTidy.cpp:612
+
+  FileManager *Files = new FileManager(FileSystemOptions());
+  vfs::FileSystem &FileSystem = *Files->getVirtualFileSystem();
----------------
Eugene.Zelenko wrote:
> You could use auto here, because type is in new statement.
Where will the `delete` happen for the FileManager? I think a `unique_ptr` would be a good idea, not?

you can use `llvm::make_unique<>()` to reduce the verbosity of C++11.


================
Comment at: ClangTidy.cpp:624
+
+    SmallString<128> ErrorAbsoluteFilePath = (StringRef)Error.Message.FilePath;
+    Files->makeAbsolutePath(ErrorAbsoluteFilePath);
----------------
Please use a named cast for your intended purpose.


================
Comment at: ClangTidy.cpp:630
+      AbsoluteError.Fix.clear();
+      SingleErrors.insert(std::pair<StringRef, ClangTidyError>(
+          ErrorAbsoluteFilePath, AbsoluteError));
----------------
You could maybe use `std::make_pair` here.


================
Comment at: ClangTidy.cpp:657
+
+    AbsoluteError.Fix.insert(std::pair<StringRef, Replacements>(File, Repls));
+
----------------
`make_pair` too.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D49890





More information about the cfe-commits mailing list