[PATCH] D57064: [Sema] Improve a -Warray-bounds diagnostic
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 23 05:54:02 PST 2019
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.
LGTM with a testing request and some small nits.
================
Comment at: clang/include/clang/AST/ASTContext.h:2092
+ Optional<CharUnits> getTypeSizeInCharsIfKnown(QualType Ty) const {
+ if (Ty->isIncompleteType() || Ty->isDependentType())
+ return None;
----------------
Can you add a dependent type test as well?
================
Comment at: clang/test/Sema/static-array.c:25
+ cat((int *)d); // expected-warning {{array argument is too small; is of size 4, callee requires at least 12}}
+ cat(d); // expected-warning {{array argument is too small; is of size 4, callee requires at least 12}} expected-warning{{incompatible pointer types}}
+
----------------
Add an extra space after `expected-warning` and the `{` for the second warning.
================
Comment at: clang/test/Sema/static-array.c:29
+ cat((int *)e);
+ cat(e); // expected-warning{{incompatible pointer types}}
}
----------------
Same here.
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57064/new/
https://reviews.llvm.org/D57064
More information about the cfe-commits
mailing list