aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaType.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-11-04 02:18:39 +0000
committerJohn McCall <rjmccall@apple.com>2009-11-04 02:18:39 +0000
commit54abf7d4fa3123b8324c09d2a4dfb789fd818403 (patch)
treee0a899f37d5b05f29b984352e1d9f09b610e12f5 /lib/Sema/SemaType.cpp
parent05a2338f7ba1c8a0136e120502f80a38cf0e9fd3 (diff)
Change our basic strategy for avoiding deprecation warnings when the decl use
appears in a deprecated context. In the new strategy, we emit the warnings as usual unless we're currently parsing a declaration, where "declaration" is restricted to mean a decl group or a few special cases in Objective C. If we *are* parsing a declaration, we queue up the deprecation warnings until the declaration has been completely parsed, and then emit them only if the decl is not deprecated. We also standardize the bookkeeping for deprecation so as to avoid special cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85998 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r--lib/Sema/SemaType.cpp34
1 files changed, 1 insertions, 33 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 94b74fbcd1..0003b1b0c4 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -67,16 +67,6 @@ static bool isOmittedBlockReturnType(const Declarator &D) {
return false;
}
-/// isDeclaratorDeprecated - Return true if the declarator is deprecated.
-/// We do not want to warn about use of deprecated types (e.g. typedefs) when
-/// defining a declaration that is itself deprecated.
-static bool isDeclaratorDeprecated(const Declarator &D) {
- for (const AttributeList *AL = D.getAttributes(); AL; AL = AL->getNext())
- if (AL->getKind() == AttributeList::AT_deprecated)
- return true;
- return false;
-}
-
/// \brief Convert the specified declspec to the appropriate type
/// object.
/// \param D the declarator containing the declaration specifier.
@@ -247,8 +237,7 @@ static QualType ConvertDeclSpecToType(Declarator &TheDeclarator, Sema &TheSema){
}
// If the type is deprecated or unavailable, diagnose it.
- TheSema.DiagnoseUseOfDecl(D, DS.getTypeSpecTypeLoc(),
- isDeclaratorDeprecated(TheDeclarator));
+ TheSema.DiagnoseUseOfDecl(D, DS.getTypeSpecTypeLoc());
assert(DS.getTypeSpecWidth() == 0 && DS.getTypeSpecComplex() == 0 &&
DS.getTypeSpecSign() == 0 && "No qualifiers on tag names!");
@@ -303,27 +292,6 @@ static QualType ConvertDeclSpecToType(Declarator &TheDeclarator, Sema &TheSema){
}
}
- // If this is a reference to an invalid typedef, propagate the invalidity.
- if (TypedefType *TDT = dyn_cast<TypedefType>(Result)) {
- if (TDT->getDecl()->isInvalidDecl())
- TheDeclarator.setInvalidType(true);
-
- // If the type is deprecated or unavailable, diagnose it.
- TheSema.DiagnoseUseOfDecl(TDT->getDecl(), DS.getTypeSpecTypeLoc(),
- isDeclaratorDeprecated(TheDeclarator));
- } else if (ObjCInterfaceType *OIT = dyn_cast<ObjCInterfaceType>(Result)) {
- // If the type is deprecated or unavailable, diagnose it.
- TheSema.DiagnoseUseOfDecl(OIT->getDecl(), DS.getTypeSpecTypeLoc(),
- isDeclaratorDeprecated(TheDeclarator));
- } else if (ObjCObjectPointerType *DPT =
- dyn_cast<ObjCObjectPointerType>(Result)) {
- // If the type is deprecated or unavailable, diagnose it.
- if (ObjCInterfaceDecl *D = DPT->getInterfaceDecl())
- TheSema.DiagnoseUseOfDecl(D, DS.getTypeSpecTypeLoc(),
- isDeclaratorDeprecated(TheDeclarator));
- }
-
-
// TypeQuals handled by caller.
break;
}