[PATCH] D71199: [clang-tidy] New check cppcoreguidelines-prefer-member-initializer
Lukas Rechberger via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 24 05:17:31 PDT 2020
Rechi added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.cpp:184
+ bool AddComma = false;
+ if (!Ctor->getNumCtorInitializers() && FirstToCtorInits) {
+ SourceLocation BodyPos = Ctor->getBody()->getBeginLoc();
----------------
The following example generates invalid fixes, if modernize-use-default-member-init check isn't enabled, because `Ctor->getNumCtorInitializers()` returns 1.
```lang=cpp
class Example
{
public:
Example() { a = 0; };
int a;
std::string string;
};
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71199/new/
https://reviews.llvm.org/D71199
More information about the cfe-commits
mailing list