This is an archive of the discontinued LLVM Phabricator instance.

AvailabilityAttrs: Delay partial availability diagnostics
ClosedPublic

Authored by erik.pilkington on Oct 5 2016, 10:04 AM.

Details

Summary

Note: this patch depends on: https://reviews.llvm.org/D25283

This patch delays handling of AR_NotYetIntroduced diagnostics, so that the following compiles with no warnings:

typedef int new_int __attribute__((availability(macos, introduced=100)));

new_int f() __attribute__((availability(macos, introduced=100)));

This is done by treating AR_NotYetIntroduced diagnostics as delayed, just like AR_Unavailable and AR_Deprecated. This means that we emit the diagnostic once we finished parsing f(), at which point we have the context to determine if we should diagnose new_int.

Thanks!

Diff Detail

Repository
rL LLVM

Event Timeline

erik.pilkington retitled this revision from to AvailabilityAttrs: Delay partial availability diagnostics.
erik.pilkington updated this object.
erik.pilkington added a reviewer: manmanren.
erik.pilkington added a subscriber: cfe-commits.
manmanren edited edge metadata.Oct 10 2016, 4:56 PM

Nice cleanup! Thanks for working on this,

Manman

include/clang/Sema/DelayedDiagnostic.h
232 ↗(On Diff #73662)

Can you update this comment now we have generalized this to handle all delayed availability checks?

erik.pilkington edited edge metadata.

This new patch renames DelayedDiagnostic::DeprecationData to DelayedDiagnostic::AvailabilityData, because now that it can hold information about deprecated, unavailable, and partial diagnostics.
Thanks,
Erik

manmanren accepted this revision.Oct 17 2016, 3:34 PM
manmanren edited edge metadata.

This is better than what I asked for :]

Manman

This revision is now accepted and ready to land.Oct 17 2016, 3:34 PM
This revision was automatically updated to reflect the committed changes.