[PATCH] D154257: [clang] Fix leak in LoadFromCommandLineWorkingDirectory unit test

Hamish Knight via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 30 14:19:50 PDT 2023


hamishknight marked an inline comment as done.
hamishknight added inline comments.


================
Comment at: clang/tools/libclang/CIndex.cpp:3965
       unsaved_files);
-  std::unique_ptr<ASTUnit> Unit(ASTUnit::LoadFromCommandLine(
+  auto Unit = ASTUnit::LoadFromCommandLine(
       Args->data(), Args->data() + Args->size(),
----------------
benlangmuir wrote:
> Nit: the style guidance for `auto` in llvm is "type is already obvious from the context".  Since I don't think that's obvious here (in particular, this code would have compiled with the raw pointer return type), and the type name will not be verbose, I think we should keep `std::unique_ptr<ASTUnit>`.  Same for the other calls below.
Fair enough, updated


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154257/new/

https://reviews.llvm.org/D154257



More information about the cfe-commits mailing list