[PATCH] D39913: [ObjC] warn about availability attributes missing from a method's declaration when they're specified for a method's definition
Alex Lorenz via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 13 15:40:55 PST 2017
arphaman added inline comments.
================
Comment at: lib/Sema/SemaDeclAttr.cpp:2300
+ };
+
+ llvm::SmallPtrSet<const IdentifierInfo *, 4> MissingPlatformAttributes;
----------------
erik.pilkington wrote:
> I hate to rewrite your function, but have you considered just doing the second loop over the attrs inline instead of hidden in the lambda? I think it would make the function more simple to avoid all the lambdas and callbacks:
> ```
> for (auto *A : Implementation->specific_attrs<AvailabilityAttr>()) {
> for (auto *B : Original->specific_attrs<AvailabilityAttr>()) {
> if (A->getPlatform() != B->getPlatform()) continue;
> if (A->getIntroduced() != B->getIntroduced() || ...) {
> Diag();
> }
> }
> }
> ```
> You can do the deprecated check outside of the loop like:
> ```
> if (Impl->hasAttr<Dep>() && !Original->hasAttr<Dep>())
> ```
Nice, that's much better! Updated.
Repository:
rL LLVM
https://reviews.llvm.org/D39913
More information about the cfe-commits
mailing list