[PATCH] D49890: Clang-Tidy Export Problem

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 27 07:53:58 PDT 2018


JonasToth added inline comments.


================
Comment at: ClangTidy.cpp:614
+  vfs::FileSystem &FileSystem = *Files->getVirtualFileSystem();
+  auto InitialWorkingDir = FileSystem.getCurrentWorkingDirectory();
+  if (!InitialWorkingDir)
----------------
TheAhmad wrote:
> Eugene.Zelenko wrote:
> > Type is not obvious, so please don't use auto.
> Hi, Eugene. Why line 352 uses auto?
He means line 615 (`InitialWorkingDir`). The type of the variable can not be deduced from reading the code.

The rule is, to write the type once. E.g. `llvm::make_unique<MyType>(args)` makes it clear, that the type is `MyType`, so you can use `auto` for the variable.
This is not the case for `InitialWorkingDir`.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D49890





More information about the cfe-commits mailing list