History log of /llvm-project/clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp (Results 26 – 50 of 59)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 39c4246e 28-Feb-2020 Nathan James <n.james93@hotmail.co.uk>

[clang-tidy] Added virtual isLanguageVersionSupported to ClangTidyCheck

Summary:
Motivated by [[ https://bugs.llvm.org/show_bug.cgi?id=45045 | Tune inspections to a specific C++ standard. ]]
Moves t

[clang-tidy] Added virtual isLanguageVersionSupported to ClangTidyCheck

Summary:
Motivated by [[ https://bugs.llvm.org/show_bug.cgi?id=45045 | Tune inspections to a specific C++ standard. ]]
Moves the isLanguageVersionSupported virtual function from `MakeSmartPtrCheck` to the base `ClangTidyCheck` class.
This will disable registering matchers or pp callbacks on unsupported language versions for a check.
Having it as a standalone function is cleaner than manually disabling the check in the register function and should hopefully
encourage check developers to actually restrict the check based on language version.
As an added bonus this could enable automatic detection of what language version a check runs on for the purpose of documentation generation

Reviewers: aaron.ballman, gribozavr2, Eugene.Zelenko, JonasToth, alexfh, hokein

Reviewed By: gribozavr2

Subscribers: xazax.hun, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75289

show more ...


# a156a0e2 30-Jan-2020 Nathan James <n.james93@hotmail.co.uk>

[ASTMatchers] Add hasPlacementArg and hasAnyPlacementArg traversal matcher for CXXNewExpr

Summary: Adds new traversal matchers called `hasPlacementArg` and `hasAnyPlacementArg` that matches on argum

[ASTMatchers] Add hasPlacementArg and hasAnyPlacementArg traversal matcher for CXXNewExpr

Summary: Adds new traversal matchers called `hasPlacementArg` and `hasAnyPlacementArg` that matches on arguments to `placement new` operators.

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: merge_guards_bot, mehdi_amini, hiraditya, steven_wu, dexonsmith, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D73562

show more ...


# b7ecf1c1 04-Jan-2020 Kazuaki Ishizaki <ishizaki@jp.ibm.com>

NFC: Fix trivial typos in comments


Revision tags: llvmorg-9.0.0, llvmorg-9.0.0-rc6, llvmorg-9.0.0-rc5, llvmorg-9.0.0-rc4, llvmorg-9.0.0-rc3
# 1c705d9c 14-Aug-2019 Jonas Devlieghere <jonas@devlieghere.com>

[clang-tools-extra] Migrate llvm::make_unique to std::make_unique

Now that we've moved to C++14, we no longer need the llvm::make_unique
implementation from STLExtras.h. This patch is a mechanical r

[clang-tools-extra] Migrate llvm::make_unique to std::make_unique

Now that we've moved to C++14, we no longer need the llvm::make_unique
implementation from STLExtras.h. This patch is a mechanical replacement
of (hopefully) all the llvm::make_unique instances across the monorepo.

Differential revision: https://reviews.llvm.org/D66259

llvm-svn: 368944

show more ...


Revision tags: llvmorg-9.0.0-rc2, llvmorg-9.0.0-rc1, llvmorg-10-init, llvmorg-8.0.1, llvmorg-8.0.1-rc4, llvmorg-8.0.1-rc3, llvmorg-8.0.1-rc2
# ceb0cc54 03-Jun-2019 Haojian Wu <hokein@google.com>

[clang-tidy] Fix make-unique check to work in C++17 mode.

Summary:
Previously, we intended to omit the check fix to the case when constructor has
any braced-init-list argument. But the HasListInitia

[clang-tidy] Fix make-unique check to work in C++17 mode.

Summary:
Previously, we intended to omit the check fix to the case when constructor has
any braced-init-list argument. But the HasListInitializedArgument was not
correct to handle all cases (Foo(Bar{1, 2}) will return false in C++14
mode).

This patch fixes it, corrects the tests, and makes the check to run at C++17 mode.

Reviewers: gribozavr

Subscribers: xazax.hun, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D62736

llvm-svn: 362361

show more ...


Revision tags: llvmorg-8.0.1-rc1
# 4c32d4fd 08-May-2019 Ilya Biryukov <ibiryukov@google.com>

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

Summary:
The case when initialize_list hides behind an implicit case was not
handled before.

Reviewers: aaron.ballman

Reviewed By: a

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

Summary:
The case when initialize_list hides behind an implicit case was not
handled before.

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: xazax.hun, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D61642

llvm-svn: 360231

show more ...


# 96d27350 06-May-2019 Richard Smith <richard-llvm@metafoo.co.uk>

Fix up after r360006.

llvm-svn: 360007


# b6c4db99 22-Mar-2019 Alexander Kornienko <alexfh@google.com>

[clang-tidy] Move all checks to the new registerPPCallbacks API

llvm-svn: 356796


Revision tags: llvmorg-8.0.0, llvmorg-8.0.0-rc5, llvmorg-8.0.0-rc4, llvmorg-8.0.0-rc3, llvmorg-7.1.0, llvmorg-7.1.0-rc1, llvmorg-8.0.0-rc2, llvmorg-8.0.0-rc1
# 2946cd70 19-Jan-2019 Chandler Carruth <chandlerc@gmail.com>

Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the ne

Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351636

show more ...


Revision tags: llvmorg-7.0.1, llvmorg-7.0.1-rc3
# 77c56fff 26-Nov-2018 Haojian Wu <hokein@google.com>

[clang-tidy] No warning for auto new expression in smart check

Summary: The fix for `auto` new expression is illegal.

Reviewers: aaron.ballman

Subscribers: xazax.hun, cfe-commits

Differential Rev

[clang-tidy] No warning for auto new expression in smart check

Summary: The fix for `auto` new expression is illegal.

Reviewers: aaron.ballman

Subscribers: xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D54832

llvm-svn: 347551

show more ...


# dbfa9c3e 26-Nov-2018 Haojian Wu <hokein@google.com>

[clang-tidy] Don't generate incorrect fixes for class with deleted copy constructor in smart_ptr check.

Summary:
The fix for aggregate initialization (`std::make_unique<Foo>(Foo {1, 2})` needs
to se

[clang-tidy] Don't generate incorrect fixes for class with deleted copy constructor in smart_ptr check.

Summary:
The fix for aggregate initialization (`std::make_unique<Foo>(Foo {1, 2})` needs
to see Foo copy constructor, otherwise we will have a compiler error. So we
only emit the check warning.

Reviewers: JonasToth, aaron.ballman

Subscribers: xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D54745

llvm-svn: 347537

show more ...


# c63d935b 20-Nov-2018 Haojian Wu <hokein@google.com>

[clang-tidy] Don't generate incorrect fixes for class constructed from list-initialized arguments

Summary:
Currently the smart_ptr check (modernize-make-unique) generates the
fixes that cannot compi

[clang-tidy] Don't generate incorrect fixes for class constructed from list-initialized arguments

Summary:
Currently the smart_ptr check (modernize-make-unique) generates the
fixes that cannot compile for cases like below -- because brace list can
not be deduced in `make_unique`.

```
struct Bar { int a, b; };
struct Foo { Foo(Bar); };
auto foo = std::unique_ptr<Foo>(new Foo({1, 2}));
```

Reviewers: aaron.ballman

Subscribers: xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D54704

llvm-svn: 347315

show more ...


Revision tags: llvmorg-7.0.1-rc2, llvmorg-7.0.1-rc1
# 547f89d6 18-Oct-2018 Haojian Wu <hokein@google.com>

[clang-tidy] Ignore a case where the fix of make_unique check introduces side effect.

Summary:
Previously, ptr.reset(new char[5]) will be replaced with `p =
make_unique<char[]>(5)`, the fix has side

[clang-tidy] Ignore a case where the fix of make_unique check introduces side effect.

Summary:
Previously, ptr.reset(new char[5]) will be replaced with `p =
make_unique<char[]>(5)`, the fix has side effect -- doing
default initialization, it may cause performace regression (we are
bitten by this rececntly)

The check should be conservative for these cases.

Reviewers: alexfh

Subscribers: xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D53377

llvm-svn: 344733

show more ...


# c968c988 09-Oct-2018 Alexander Kornienko <alexfh@google.com>

[clang-tidy] Fix handling of parens around new expressions in make_<smartptr> checks.

Summary:
Extra parentheses around a new expression result in incorrect code
after applying fixes.

Reviewers: ho

[clang-tidy] Fix handling of parens around new expressions in make_<smartptr> checks.

Summary:
Extra parentheses around a new expression result in incorrect code
after applying fixes.

Reviewers: hokein

Reviewed By: hokein

Subscribers: xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D52989

llvm-svn: 344058

show more ...


Revision tags: llvmorg-7.0.0, llvmorg-7.0.0-rc3, llvmorg-7.0.0-rc2
# c09197e0 09-Aug-2018 Stephen Kelly <steveire@gmail.com>

Port getLocEnd -> getEndLoc

Subscribers: nemanjai, ioeric, kbarton, cfe-commits

Differential Revision: https://reviews.llvm.org/D50355

llvm-svn: 339401


# 43465bf3 09-Aug-2018 Stephen Kelly <steveire@gmail.com>

Port getLocStart -> getBeginLoc

Reviewers: javed.absar

Subscribers: nemanjai, kbarton, ilya-biryukov, ioeric, jkorous, arphaman, jfb, cfe-commits

Differential Revision: https://reviews.llvm.org/D5

Port getLocStart -> getBeginLoc

Reviewers: javed.absar

Subscribers: nemanjai, kbarton, ilya-biryukov, ioeric, jkorous, arphaman, jfb, cfe-commits

Differential Revision: https://reviews.llvm.org/D50354

llvm-svn: 339400

show more ...


Revision tags: llvmorg-7.0.0-rc1, llvmorg-6.0.1, llvmorg-6.0.1-rc3, llvmorg-6.0.1-rc2, llvmorg-6.0.1-rc1, llvmorg-5.0.2, llvmorg-5.0.2-rc2
# 670c6315 21-Mar-2018 Alexander Kornienko <alexfh@google.com>

[clang-tidy][modernize-make-unique] Checks c++14 flag before using std::make_unique

Summary: For a c++11 code, the clang-tidy rule "modernize-make-unique" should return immediately, as std::make_uni

[clang-tidy][modernize-make-unique] Checks c++14 flag before using std::make_unique

Summary: For a c++11 code, the clang-tidy rule "modernize-make-unique" should return immediately, as std::make_unique is not supported.

Reviewers: hokein, aaron.ballman, ilya-biryukov, alexfh

Reviewed By: hokein, aaron.ballman, alexfh

Subscribers: Quuxplusone, xazax.hun, cfe-commits

Tags: #clang-tools-extra

Patch by Frederic Tingaud!

Differential Revision: https://reviews.llvm.org/D43766

llvm-svn: 328101

show more ...


Revision tags: llvmorg-5.0.2-rc1
# 0dc8fd74 06-Mar-2018 Haojian Wu <hokein@google.com>

[clang-tidy] Fix one corner case in make-unique check.

Summary:
Previously, we tried to cover all "std::initializer_list" implicit conversion
cases in the code, but there are some corner cases that

[clang-tidy] Fix one corner case in make-unique check.

Summary:
Previously, we tried to cover all "std::initializer_list" implicit conversion
cases in the code, but there are some corner cases that not covered (see
newly-added test in the patch).

Sipping all implicit AST nodes is a better way to filter out all these cases.

Reviewers: ilya-biryukov

Subscribers: klimek, xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D44137

llvm-svn: 326799

show more ...


Revision tags: llvmorg-6.0.0, llvmorg-6.0.0-rc3, llvmorg-6.0.0-rc2
# c159aa6a 23-Jan-2018 Haojian Wu <hokein@google.com>

[clang-tidy] Don't generate fixes for invalid new expr location in modernize-make-unique.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: klimek, xazax.hun, cfe-commits

Different

[clang-tidy] Don't generate fixes for invalid new expr location in modernize-make-unique.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: klimek, xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D42363

llvm-svn: 323191

show more ...


# 0e9a8a5f 18-Jan-2018 Haojian Wu <hokein@google.com>

[clang-tidy] Don't generate fix for argument constructed from std::initializer_list.

Summary:
A follow-up fix of rL311652.

The previous `vector` in our test is different with `std::vector`, so
The

[clang-tidy] Don't generate fix for argument constructed from std::initializer_list.

Summary:
A follow-up fix of rL311652.

The previous `vector` in our test is different with `std::vector`, so
The check still generates fixes for std::vector (`auto p =
std::unique_ptr<Foo>(new Foo({1,2,3}))`) in real world, the patch makes the
vector behavior in test align with std::vector (both AST nodes are the same now).

Reviewers: ilya-biryukov, alexfh

Reviewed By: ilya-biryukov

Subscribers: klimek, xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D41852

llvm-svn: 322822

show more ...


Revision tags: llvmorg-6.0.0-rc1, llvmorg-5.0.1, llvmorg-5.0.1-rc3, llvmorg-5.0.1-rc2, llvmorg-5.0.1-rc1, llvmorg-5.0.0, llvmorg-5.0.0-rc5, llvmorg-5.0.0-rc4, llvmorg-5.0.0-rc3
# 3f495944 24-Aug-2017 Haojian Wu <hokein@google.com>

[clang-tidy] A follow-up fix of braced-init-list constructors in make-unique check.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: JDevlieghere, xazax.hun, cfe-commits

Differential Revision:

[clang-tidy] A follow-up fix of braced-init-list constructors in make-unique check.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: JDevlieghere, xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D37066

llvm-svn: 311652

show more ...


# 80330ffc 17-Aug-2017 Haojian Wu <hokein@google.com>

[clang-tidy] Ignore statements inside a template instantiation.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: JDevlieghere, xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm

[clang-tidy] Ignore statements inside a template instantiation.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: JDevlieghere, xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D36822

llvm-svn: 311086

show more ...


# 4b956cb7 17-Aug-2017 Haojian Wu <hokein@google.com>

[clang-tidy] Don't generate fixes for initializer_list constructor in make_unique check.

Summary:
The current fix will break the compilation -- because braced list is not
deducible in std::make_uniq

[clang-tidy] Don't generate fixes for initializer_list constructor in make_unique check.

Summary:
The current fix will break the compilation -- because braced list is not
deducible in std::make_unique (with the use of forwarding) without
specifying the type explicitly.

We could support it in the future.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: JDevlieghere, xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D36786

llvm-svn: 311078

show more ...


Revision tags: llvmorg-5.0.0-rc2
# be5d4487 09-Aug-2017 Haojian Wu <hokein@google.com>

[clang-tidy] Fix another crash in make-unique check.

Summary:
The crash happens when calling `reset` method without any preceding
operation like "->" or ".", this could happen in a subclass of the
"

[clang-tidy] Fix another crash in make-unique check.

Summary:
The crash happens when calling `reset` method without any preceding
operation like "->" or ".", this could happen in a subclass of the
"std::unique_ptr".

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: JDevlieghere, xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D36452

llvm-svn: 310496

show more ...


# 115b7075 04-Aug-2017 Haojian Wu <hokein@google.com>

[clang-tidy] Ignore macros in make-unique check.

Summary:
The check doesn't fully support smart-ptr usages inside macros, which
may cause incorrect fixes, or even crashes, ignore them for now.

Revi

[clang-tidy] Ignore macros in make-unique check.

Summary:
The check doesn't fully support smart-ptr usages inside macros, which
may cause incorrect fixes, or even crashes, ignore them for now.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: JDevlieghere, xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D36264

llvm-svn: 310050

show more ...


123