Page MenuHomePhabricator

[Diagnostics] Diagnose -Wsizeof-array-div for array of pointers
ClosedPublic

Authored by xbolva00 on Sep 20 2020, 11:15 AM.

Diff Detail

Event Timeline

xbolva00 requested review of this revision.Sep 20 2020, 11:15 AM
xbolva00 created this revision.

Thanks!

clang/lib/Sema/SemaExpr.cpp
10055–10056

You can simplify this a bit: RHSTy = RHSTy.getNonReferenceType();

I think this should also be done before line 10027 so that sizeof(p) / sizeof(decltype(*p)) produces a warning too. Perhaps remove the reference on line 10023 (since the expression case can never have reference type anyway):

-    RHSTy = RUE->getArgumentType();
+    RHSTy = RUE->getArgumentType().getNonReferenceType();
xbolva00 updated this revision to Diff 293036.Sep 20 2020, 3:00 PM

Addressed review comments.
New test cases.

xbolva00 marked an inline comment as done.Sep 20 2020, 3:01 PM
xbolva00 added inline comments.
clang/lib/Sema/SemaExpr.cpp
10055–10056

Thanks, applied.

xbolva00 marked an inline comment as done.Fri, Sep 25, 6:08 AM
This comment was removed by xbolva00.

I implemented suggested change so I assume it is fine. I will commit it tomorrow if no futher comments.

This revision was not accepted when it landed; it landed in state Needs Review.Fri, Oct 9, 3:56 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptFri, Oct 9, 3:56 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript