[PATCH] D49511: [Sema/Attribute] Check for noderef attribute
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 5 14:00:02 PST 2018
rsmith accepted this revision.
rsmith added a comment.
Thanks for your patience.
================
Comment at: clang/lib/Sema/SemaInit.cpp:7838-7854
+ if (const auto *FromPtrType = SourceType->getAs<PointerType>()) {
+ if (const auto *ToPtrType = Step->Type->getAs<PointerType>()) {
+ if (FromPtrType->getPointeeType()->hasAttr(attr::NoDeref) &&
+ !ToPtrType->getPointeeType()->hasAttr(attr::NoDeref)) {
+ S.Diag(CurInit.get()->getExprLoc(),
+ diag::warn_noderef_to_dereferenceable_pointer)
+ << CurInit.get()->getSourceRange();
----------------
`CheckSingleAssignmentConstraints` also warns in this case; is the explicit warning emission above necessary?
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D49511/new/
https://reviews.llvm.org/D49511
More information about the cfe-commits
mailing list