[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 08:24:36 PDT 2019


ilya-biryukov marked an inline comment as done.
ilya-biryukov added a comment.

BTW, for a common use-case we can do the same trick that's being done for aggregate init:

  new X({1,2,3}, 123, {a});

into

  make_unique<X>(X({1,2,3}, 123, {a}));

I can try fixing this, but would want to land this first to fix the issue at hand.



================
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}));
----------------
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?


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