Page MenuHomePhabricator

DNS320 (Fabian Thurnheer)
User

Projects

User does not belong to any projects.

User Details

User Since
Apr 7 2021, 7:04 AM (5 w, 2 d)

Recent Activity

Fri, Apr 30

DNS320 updated the diff for D100092: [clang-tidy] cppcoreguidelines-declare-loop-variable-in-the-initializer: a new check.

Removed a link to the ES.26 C++ Core Guideline in the documentation part.

Fri, Apr 30, 8:50 AM · Restricted Project
DNS320 added a comment to D100092: [clang-tidy] cppcoreguidelines-declare-loop-variable-in-the-initializer: a new check.

I implemented something like this recently too. The code I was trying to refactor was something like

auto ii = 0;
for (ii = 0; ii < thing.size(); ++ii)
{
    // code
}
// code
for (ii = 0; ii < thing.size(); ++ii)
{
    // code
}
// code
for (ii = 0; ii < thing.size(); ++ii)
{
    // code
}

ie, the variable was used repeatedly, but always initialized in the loop.

I also had code like

auto ii = 0;
for (ii = 0; ii < thing.size(); ++ii)
{
    // code
}
// code
ii = getNumber();
doSomething(ii);

ie, the next statement referring to ii outside the loop was an assignment, so I could just change it to

for (auto ii = 0; ii < thing.size(); ++ii)
{
    // code
}
// code
auto ii = getNumber();
doSomething(ii);

You don't necessarily have to handle these cases in the initial version of this check, but you could consider them in the future.

Fri, Apr 30, 7:13 AM · Restricted Project
DNS320 updated the diff for D100092: [clang-tidy] cppcoreguidelines-declare-loop-variable-in-the-initializer: a new check.

Renamed the IsInsideMatchedForStmt() function according to a comment from the build system.
Changed a data type to "auto" according to a comment from Eugene.Zelenko.

Fri, Apr 30, 12:03 AM · Restricted Project

Thu, Apr 29

DNS320 added inline comments to D100092: [clang-tidy] cppcoreguidelines-declare-loop-variable-in-the-initializer: a new check.
Thu, Apr 29, 6:57 AM · Restricted Project
DNS320 updated the diff for D100092: [clang-tidy] cppcoreguidelines-declare-loop-variable-in-the-initializer: a new check.

I updated the check according to the last review.
The check should now fully implement the defined enforcement chapter from the ES.74 C++ Core Guideline.

Thu, Apr 29, 6:55 AM · Restricted Project

Apr 9 2021

DNS320 added a comment to D100092: [clang-tidy] cppcoreguidelines-declare-loop-variable-in-the-initializer: a new check.

Thank you for your reviews.
I will work on your comments and write back soon.

Apr 9 2021, 9:35 AM · Restricted Project

Apr 8 2021

DNS320 requested review of D100092: [clang-tidy] cppcoreguidelines-declare-loop-variable-in-the-initializer: a new check.
Apr 8 2021, 1:03 AM · Restricted Project