[PATCH] D25283: AvailabilityAttrs: Refactor context checking when diagnosing an availability violation
Erik Pilkington via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 13 11:17:03 PDT 2016
erik.pilkington added inline comments.
================
Comment at: lib/Sema/SemaExpr.cpp:179
- if (const DeclContext *DC = S.getCurObjCLexicalContext())
- ContextVersion = S.getVersionForDecl(cast<Decl>(DC));
-
----------------
manmanren wrote:
> 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 context.
https://reviews.llvm.org/D25283
More information about the cfe-commits
mailing list