erik.pilkington added inline comments.
Comment at: lib/Sema/SemaExpr.cpp:179
- if (const DeclContext *DC = S.getCurObjCLexicalContext())
- ContextVersion = S.getVersionForDecl(cast<Decl>(DC));
> I don't quite get why we can remove the above logic (i.e why we can avoid
> passing ContextVersion when diagnosing the availability). Is it because we
> move the logic to DoEmitAvailabilityWarning?
Yep. It doesn't make sense to check context here because we may delay the
diagnostic, in which case we have to check again in the new context (this what
isDecl(Deprecated|Unavailable) does). I think it makes more sense to do all the
checking in `DoEmitAvailabilityWarning`, because at that point the paths for
delayed and normal diagnostics meet again, and we always have the correct
cfe-commits mailing list