[PATCH] D61642: [clang-tidy] Do not show incorrect fix in modernize-make-unique

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 7 10:21:53 PDT 2019


ilya-biryukov added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp:302
       if (const auto *ImplicitCE =
               dyn_cast<CXXConstructExpr>(Arg->IgnoreImplicit())) {
         if (ImplicitCE->isStdInitListInitialization())
----------------
aaron.ballman wrote:
> We can now remove the `IgnoreImplicit()` call here, can't we?
Right. Thanks for spotting that!


================
Comment at: clang-tools-extra/test/clang-tidy/modernize-make-unique.cpp:278
+  std::unique_ptr<APair> PAggrTemp = std::unique_ptr<APair>(new APair({T, 1}));
+  // CHECK-MESSAGES: :[[@LINE-1]]:38: warning: use std::make_unique instead
+  PAggrTemp.reset(new APair({T, 1}));
----------------
aaron.ballman wrote:
> ilya-biryukov wrote:
> > I'm wondering how to properly check that no fixes were produced here. 
> > Do we have a common way to express this?
> > Would `CHECK-FIXES-NOT: ...` mentioning the line numbers somehow work?
> I believe we typically use `CHECK-FIXES: <the original code blurb>` to ensure that the fix does not change any code.
That worked. Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61642





More information about the cfe-commits mailing list