case LookupResult::FoundOverloaded:
return 0;
- case LookupResult::Ambiguous: {
+ case LookupResult::Ambiguous:
// Recover from type-hiding ambiguities by hiding the type. We'll
// do the lookup again when looking for an object, and we can
// diagnose the error then. If we don't do this, then the error
// perform the name lookup again.
DiagnoseAmbiguousLookup(Result, DeclarationName(&II), NameLoc);
break;
- }
case LookupResult::Found:
IIDecl = Result.getFoundDecl();
QualType T;
if (TypeDecl *TD = dyn_cast<TypeDecl>(IIDecl)) {
- // Check whether we can use this type.
- (void)DiagnoseUseOfDecl(IIDecl, NameLoc);
-
// C++ [temp.local]p2:
// Within the scope of a class template specialization or
// partial specialization, when the injected-class-name is
T = getQualifiedNameType(*SS, T);
} else if (ObjCInterfaceDecl *IDecl = dyn_cast<ObjCInterfaceDecl>(IIDecl)) {
- // Check whether we can use this interface.
- (void)DiagnoseUseOfDecl(IIDecl, NameLoc);
-
T = Context.getObjCInterfaceType(IDecl);
} else
return 0;
return false;
if (D.getNumTypeObjects() == 0)
- return true;
+ return true; // ^{ ... }
if (D.getNumTypeObjects() == 1 &&
D.getTypeObject(0).Kind == DeclaratorChunk::Function)
- return true;
+ return true; // ^(int X, float Y) { ... }
return false;
}
case DeclSpec::TST_enum:
case DeclSpec::TST_union:
case DeclSpec::TST_struct: {
- Decl *D = static_cast<Decl *>(DS.getTypeRep());
+ TypeDecl *D = cast_or_null<TypeDecl>(static_cast<Decl *>(DS.getTypeRep()));
if (!D) {
// This can happen in C++ with ambiguous lookups.
Result = Context.IntTy;
break;
}
+ // If the type is deprecated or unavailable, diagnose it.
+ TheSema.DiagnoseUseOfDecl(D, DS.getTypeSpecTypeLoc());
+
assert(DS.getTypeSpecWidth() == 0 && DS.getTypeSpecComplex() == 0 &&
- DS.getTypeSpecSign() == 0 &&
- "Can't handle qualifiers on typedef names yet!");
+ DS.getTypeSpecSign() == 0 && "No qualifiers on tag names!");
+
// TypeQuals handled by caller.
- Result = Context.getTypeDeclType(cast<TypeDecl>(D));
+ Result = Context.getTypeDeclType(D);
// In C++, make an ElaboratedType.
if (TheSema.getLangOptions().CPlusPlus) {
}
// If this is a reference to an invalid typedef, propagate the invalidity.
- if (TypedefType *TDT = dyn_cast<TypedefType>(Result))
+ 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());
+ } else if (ObjCInterfaceType *OIT = dyn_cast<ObjCInterfaceType>(Result)) {
+ // If the type is deprecated or unavailable, diagnose it.
+ TheSema.DiagnoseUseOfDecl(OIT->getDecl(), DS.getTypeSpecTypeLoc());
+ } 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());
+ }
+
// TypeQuals handled by caller.
break;