Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

RIRF2: loop-convert doesn't recognize 0 <= N-1 loop for array of N elements #22193

Open Quuxplusone opened 9 years ago

Quuxplusone commented 9 years ago
Bugzilla Link PR22194
Status NEW
Importance P normal
Reported by Richard (legalize@xmission.com)
Reported on 2015-01-11 12:59:48 -0800
Last modified on 2015-09-28 07:28:23 -0700
Version unspecified
Hardware PC Linux
CC alexfh@google.com, djasper@google.com, edwin.vane@intel.com, klimek@google.com
Fixed by commit(s)
Attachments RIRF2.zip (73431 bytes, application/zip)
Blocks
Blocked by
See also
Created attachment 13664
test suite

See test case RIRF2 in ReplaceIterativeForWithRangeFor.cpp:

    static int fileDataImplicitSize[] = { 1, 0 };

    // #TEST#: RIRF2 Replace iterative for with range for
    for (int i = 0; i <= 1; ++i)
    {
        --fileDataImplicitSize[i];
    }

Expected result:

    // #TEST#: RIRF2 Replace iterative for with range for
    for (auto & elem : fileDataImplicitSize)
    {
        --elem;
    }
Quuxplusone commented 9 years ago

Attached RIRF2.zip (73431 bytes, application/zip): test suite

Quuxplusone commented 9 years ago

Test cases RIRF64, RIRF58, RIRF47, RIRF44, RIRF38, RIRF35, RIRF32, RIRF29, RIRF26, RIRF23, RIRF17, RIRF14, RIRF11 and RIRF5 also fails for the same reason.

Quuxplusone commented 9 years ago

clang-modernize 3.5 build from svn

Quuxplusone commented 9 years ago

Moving to clang-tidy, since the transform has been migrated to a clang-tidy check (http://clang.llvm.org/extra/clang-tidy/checks/modernize-loop-convert.html).