summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Parse/ParseDeclCXX.cpp3
-rw-r--r--clang/lib/Sema/SemaDecl.cpp44
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp6
3 files changed, 33 insertions, 20 deletions
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp
index fe08fc5051e..d6b83f3fb2d 100644
--- a/clang/lib/Parse/ParseDeclCXX.cpp
+++ b/clang/lib/Parse/ParseDeclCXX.cpp
@@ -358,9 +358,8 @@ void Parser::ParseClassSpecifier(DeclSpec &DS,
NameLoc, Attr);
// Parse the optional base clause (C++ only).
- if (getLang().CPlusPlus && Tok.is(tok::colon)) {
+ if (getLang().CPlusPlus && Tok.is(tok::colon))
ParseBaseClause(TagOrTempDecl);
- }
// If there is a body, parse it and inform the actions module.
if (Tok.is(tok::l_brace))
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 5d02b66f369..2692cd99db4 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -43,30 +43,41 @@ using namespace clang;
/// and then return NULL.
Sema::TypeTy *Sema::getTypeName(IdentifierInfo &II, SourceLocation NameLoc,
Scope *S, const CXXScopeSpec *SS) {
- Decl *IIDecl = 0;
+ NamedDecl *IIDecl = 0;
LookupResult Result = LookupParsedName(S, SS, &II, LookupOrdinaryName,
false, false);
switch (Result.getKind()) {
- case LookupResult::NotFound:
- case LookupResult::FoundOverloaded:
- return 0;
+ case LookupResult::NotFound:
+ case LookupResult::FoundOverloaded:
+ return 0;
- case LookupResult::AmbiguousBaseSubobjectTypes:
- case LookupResult::AmbiguousBaseSubobjects:
- case LookupResult::AmbiguousReference:
- DiagnoseAmbiguousLookup(Result, DeclarationName(&II), NameLoc);
- return 0;
+ case LookupResult::AmbiguousBaseSubobjectTypes:
+ case LookupResult::AmbiguousBaseSubobjects:
+ case LookupResult::AmbiguousReference:
+ DiagnoseAmbiguousLookup(Result, DeclarationName(&II), NameLoc);
+ return 0;
- case LookupResult::Found:
- IIDecl = Result.getAsDecl();
- break;
+ case LookupResult::Found:
+ IIDecl = Result.getAsDecl();
+ break;
}
if (IIDecl) {
- if (TypeDecl *TD = dyn_cast<TypeDecl>(IIDecl))
+ if (TypeDecl *TD = dyn_cast<TypeDecl>(IIDecl)) {
+ // If this typename is deprecated, emit a warning.
+ DiagnoseUseOfDeprecatedDecl(IIDecl, NameLoc);
+
return Context.getTypeDeclType(TD).getAsOpaquePtr();
- else if (ObjCInterfaceDecl *IDecl = dyn_cast<ObjCInterfaceDecl>(IIDecl))
+ }
+
+ if (ObjCInterfaceDecl *IDecl = dyn_cast<ObjCInterfaceDecl>(IIDecl)) {
+ // If this typename is deprecated, emit a warning.
+ DiagnoseUseOfDeprecatedDecl(IIDecl, NameLoc);
+
return Context.getObjCInterfaceType(IDecl).getAsOpaquePtr();
+ }
+
+ // Otherwise, could be a variable, function etc.
}
return 0;
}
@@ -3091,7 +3102,10 @@ Sema::DeclTy *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagKind TK,
PrevDecl = 0;
}
- if (PrevDecl) {
+ if (PrevDecl) {
+ // If the previous declaration was deprecated, emit a warning.
+ DiagnoseUseOfDeprecatedDecl(PrevDecl, NameLoc);
+
if (TagDecl *PrevTagDecl = dyn_cast<TagDecl>(PrevDecl)) {
// If this is a use of a previous tag, or if the tag is already declared
// in the same scope (so that the definition/declaration completes or
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index b82c50a4b50..dee352b79b8 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -111,7 +111,7 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
// Diagnose classes that inherit from deprecated classes.
if (SuperClassDecl)
- DiagnoseUseOfDeprecatedDeclImpl(SuperClassDecl, SuperLoc);
+ DiagnoseUseOfDeprecatedDecl(SuperClassDecl, SuperLoc);
if (PrevDecl && SuperClassDecl == 0) {
// The previous declaration was not a class decl. Check if we have a
@@ -270,7 +270,7 @@ Sema::FindProtocolDeclaration(bool WarnOnDeclarations,
continue;
}
- DiagnoseUseOfDeprecatedDeclImpl(PDecl, ProtocolId[i].second);
+ DiagnoseUseOfDeprecatedDecl(PDecl, ProtocolId[i].second);
// If this is a forward declaration and we are supposed to warn in this
// case, do it.
@@ -493,7 +493,7 @@ ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc,
CDecl->setClassInterface(IDecl);
// If the interface is deprecated, warn about it.
- DiagnoseUseOfDeprecatedDeclImpl(IDecl, ClassLoc);
+ DiagnoseUseOfDeprecatedDecl(IDecl, ClassLoc);
/// Check for duplicate interface declaration for this category
ObjCCategoryDecl *CDeclChain;
OpenPOWER on IntegriCloud