llvm-project/clang/lib/Sema
Douglas Gregor 20b2ebd785 Implement a new 'availability' attribute, that allows one to specify
which versions of an OS provide a certain facility. For example,

  void foo()
  __attribute__((availability(macosx,introduced=10.2,deprecated=10.4,obsoleted=10.6)));

says that the function "foo" was introduced in 10.2, deprecated in
10.4, and completely obsoleted in 10.6. This attribute ties in with
the deployment targets (e.g., -mmacosx-version-min=10.1 specifies that
we want to deploy back to Mac OS X 10.1). There are several concrete
behaviors that this attribute enables, as illustrated with the
function foo() above:

  - If we choose a deployment target >= Mac OS X 10.4, uses of "foo"
    will result in a deprecation warning, as if we had placed
    attribute((deprecated)) on it (but with a better diagnostic)
  - If we choose a deployment target >= Mac OS X 10.6, uses of "foo"
    will result in an "unavailable" warning (in C)/error (in C++), as
    if we had placed attribute((unavailable)) on it
  - If we choose a deployment target prior to 10.2, foo() is
    weak-imported (if it is a kind of entity that can be weak
    imported), as if we had placed the weak_import attribute on it.

Naturally, there can be multiple availability attributes on a
declaration, for different platforms; only the current platform
matters when checking availability attributes.

The only platforms this attribute currently works for are "ios" and
"macosx", since we already have -mxxxx-version-min flags for them and we
have experience there with macro tricks translating down to the
deprecated/unavailable/weak_import attributes. The end goal is to open
this up to other platforms, and even extension to other "platforms"
that are really libraries (say, through a #pragma clang
define_system), but that hasn't yet been designed and we may want to
shake out more issues with this narrower problem first.

Addresses <rdar://problem/6690412>.

As a drive-by bug-fix, if an entity is both deprecated and
unavailable, we only emit the "unavailable" diagnostic.

llvm-svn: 128127
2011-03-23 00:50:03 +00:00
..
AnalysisBasedWarnings.cpp Rename class 'CFGReachabilityAnalysis' to 'CFGReverseBlockReachabilityAnalysis'. 2011-03-19 01:00:33 +00:00
AttributeList.cpp Implement a new 'availability' attribute, that allows one to specify 2011-03-23 00:50:03 +00:00
CMakeLists.txt CMake: LLVM_NO_RTTI must be obsolete now! 2011-02-10 09:15:32 +00:00
CodeCompleteConsumer.cpp Implement a new 'availability' attribute, that allows one to specify 2011-03-23 00:50:03 +00:00
DeclSpec.cpp Use ElaboratedType also for C. 2011-03-16 20:16:18 +00:00
IdentifierResolver.cpp When we're inserting a synthesized label declaration for a 2011-03-16 16:39:03 +00:00
JumpDiagnostics.cpp Step #1/N of implementing support for __label__: split labels into 2011-02-17 07:39:24 +00:00
Makefile BUILD_ARCHIVE is the default for libraries, no need to set it. 2010-07-18 00:14:47 +00:00
Sema.cpp Fix my earlier commit to work with escaped newlines and leave breadcrumbs 2011-03-08 07:59:04 +00:00
SemaAccess.cpp Handle delayed access in local declarations. PR9229. 2011-02-15 22:51:53 +00:00
SemaAttr.cpp Move support for "#pragma STDC FP_CONTRACT" to Parser; add Sema actions 2011-02-14 01:42:35 +00:00
SemaCXXCast.cpp Fixes for some more expressions containing function templateids that 2011-03-12 01:48:56 +00:00
SemaCXXScopeSpec.cpp Teach Sema::ActOnCXXNestedNameSpecifier and Sema::CheckTemplateIdType 2011-03-04 21:37:14 +00:00
SemaChecking.cpp Remove warning for null characters in CFString literals. Clang handles them just fine, and GCC 4.2 doesn't warn here either. 2011-03-15 21:18:52 +00:00
SemaCodeComplete.cpp Implement the C++0x deduced 'auto' feature. 2011-02-20 03:19:35 +00:00
SemaDecl.cpp Warn about unused declaration-specifiers on tag declarations. 2011-03-22 23:00:04 +00:00
SemaDeclAttr.cpp Implement a new 'availability' attribute, that allows one to specify 2011-03-23 00:50:03 +00:00
SemaDeclCXX.cpp Fix Objective-C++ exceptions (GNU runtime). 2011-03-20 21:35:39 +00:00
SemaDeclObjC.cpp Implement a new 'availability' attribute, that allows one to specify 2011-03-23 00:50:03 +00:00
SemaExceptionSpec.cpp Downgrade err_mismatched_exception_spec to a ExtWarning in Microsoft mode. MSVC doesn't do any validation on exception specifications. 2011-03-19 23:05:18 +00:00
SemaExpr.cpp Implement a new 'availability' attribute, that allows one to specify 2011-03-23 00:50:03 +00:00
SemaExprCXX.cpp Implement a new 'availability' attribute, that allows one to specify 2011-03-23 00:50:03 +00:00
SemaExprObjC.cpp Property setter/getter must be looked up in property type's 2011-03-09 22:17:12 +00:00
SemaInit.cpp Implement delegating constructors partially. 2011-02-26 19:13:13 +00:00
SemaLookup.cpp Reinstate r127112, "Propagate new-style exception spec information to ExtProtoInfo.", this time with the missing header. 2011-03-06 10:52:04 +00:00
SemaObjCProperty.cpp Implement a new 'availability' attribute, that allows one to specify 2011-03-23 00:50:03 +00:00
SemaOverload.cpp Implement a new 'availability' attribute, that allows one to specify 2011-03-23 00:50:03 +00:00
SemaStmt.cpp Lookup selector in protocol list of qualified objc type 2011-03-09 20:18:06 +00:00
SemaTemplate.cpp Fixed inconsistency when adding TemplateParameterListsInfo. 2011-03-18 15:16:37 +00:00
SemaTemplateDeduction.cpp Fix PR9488: 'auto' type substitution can fail (for instance, if it creates a reference-to-void type). Don't crash if it does. 2011-03-17 16:11:59 +00:00
SemaTemplateInstantiate.cpp Fixed source range for all DeclaratorDecl's. 2011-03-08 08:55:46 +00:00
SemaTemplateInstantiateDecl.cpp Implement instantiation of noexcept spec and add a test case. 2011-03-14 18:51:50 +00:00
SemaTemplateVariadic.cpp remove some defensive code: LocalInstantiationScope::getInstantiationOf 2011-02-17 19:38:27 +00:00
SemaType.cpp Only objects are declared const by a constexpr specifier, per C++0x [dcl.constexpr]p9 2011-03-20 08:06:45 +00:00
TargetAttributesSema.cpp Triple::MinGW64 is deprecated and removed. We can use Triple::MinGW32 instead. 2011-02-17 08:51:38 +00:00
TargetAttributesSema.h Remove Sema.h's dependency on DeclCXX.h. 2010-08-25 07:42:41 +00:00
TreeTransform.h Forgotten part of previous commit. 2011-03-12 11:17:06 +00:00
TypeLocBuilder.h Remove crash recovery cleanups from TypeLocBuilder. They were a bit error prone, only hit in rare cases. 2011-03-22 01:15:21 +00:00