зеркало из https://github.com/microsoft/clang-1.git
Remember type source information for Objective C property declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105484 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
89f9d3a765
Коммит
83a230c83a
|
@ -1306,7 +1306,7 @@ public:
|
|||
enum PropertyControl { None, Required, Optional };
|
||||
private:
|
||||
SourceLocation AtLoc; // location of @property
|
||||
QualType DeclType;
|
||||
TypeSourceInfo *DeclType;
|
||||
unsigned PropertyAttributes : 8;
|
||||
|
||||
// @required/@optional
|
||||
|
@ -1320,7 +1320,7 @@ private:
|
|||
ObjCIvarDecl *PropertyIvarDecl; // Synthesize ivar for this property
|
||||
|
||||
ObjCPropertyDecl(DeclContext *DC, SourceLocation L, IdentifierInfo *Id,
|
||||
SourceLocation AtLocation, QualType T)
|
||||
SourceLocation AtLocation, TypeSourceInfo *T)
|
||||
: NamedDecl(ObjCProperty, DC, L, Id), AtLoc(AtLocation), DeclType(T),
|
||||
PropertyAttributes(OBJC_PR_noattr), PropertyImplementation(None),
|
||||
GetterName(Selector()),
|
||||
|
@ -1330,13 +1330,14 @@ public:
|
|||
static ObjCPropertyDecl *Create(ASTContext &C, DeclContext *DC,
|
||||
SourceLocation L,
|
||||
IdentifierInfo *Id, SourceLocation AtLocation,
|
||||
QualType T,
|
||||
TypeSourceInfo *T,
|
||||
PropertyControl propControl = None);
|
||||
SourceLocation getAtLoc() const { return AtLoc; }
|
||||
void setAtLoc(SourceLocation L) { AtLoc = L; }
|
||||
|
||||
QualType getType() const { return DeclType; }
|
||||
void setType(QualType T) { DeclType = T; }
|
||||
TypeSourceInfo *getTypeSourceInfo() const { return DeclType; }
|
||||
QualType getType() const { return DeclType->getType(); }
|
||||
void setType(TypeSourceInfo *T) { DeclType = T; }
|
||||
|
||||
PropertyAttributeKind getPropertyAttributes() const {
|
||||
return PropertyAttributeKind(PropertyAttributes);
|
||||
|
|
|
@ -2601,8 +2601,8 @@ Decl *ASTNodeImporter::VisitObjCPropertyDecl(ObjCPropertyDecl *D) {
|
|||
}
|
||||
|
||||
// Import the type.
|
||||
QualType T = Importer.Import(D->getType());
|
||||
if (T.isNull())
|
||||
TypeSourceInfo *T = Importer.Import(D->getTypeSourceInfo());
|
||||
if (!T)
|
||||
return 0;
|
||||
|
||||
// Create the new property.
|
||||
|
|
|
@ -887,7 +887,7 @@ ObjCPropertyDecl *ObjCPropertyDecl::Create(ASTContext &C, DeclContext *DC,
|
|||
SourceLocation L,
|
||||
IdentifierInfo *Id,
|
||||
SourceLocation AtLoc,
|
||||
QualType T,
|
||||
TypeSourceInfo *T,
|
||||
PropertyControl propControl) {
|
||||
return new (C) ObjCPropertyDecl(DC, L, Id, AtLoc, T);
|
||||
}
|
||||
|
|
|
@ -376,7 +376,7 @@ void PCHDeclReader::VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *CAD) {
|
|||
void PCHDeclReader::VisitObjCPropertyDecl(ObjCPropertyDecl *D) {
|
||||
VisitNamedDecl(D);
|
||||
D->setAtLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
||||
D->setType(Reader.GetType(Record[Idx++]));
|
||||
D->setType(Reader.GetTypeSourceInfo(Record, Idx));
|
||||
// FIXME: stable encoding
|
||||
D->setPropertyAttributes(
|
||||
(ObjCPropertyDecl::PropertyAttributeKind)Record[Idx++]);
|
||||
|
@ -1045,7 +1045,7 @@ Decl *PCHReader::ReadDeclRecord(uint64_t Offset, unsigned Index) {
|
|||
break;
|
||||
case pch::DECL_OBJC_PROPERTY:
|
||||
D = ObjCPropertyDecl::Create(*Context, 0, SourceLocation(), 0, SourceLocation(),
|
||||
QualType());
|
||||
0);
|
||||
break;
|
||||
case pch::DECL_OBJC_PROPERTY_IMPL:
|
||||
D = ObjCPropertyImplDecl::Create(*Context, 0, SourceLocation(),
|
||||
|
|
|
@ -359,7 +359,7 @@ void PCHDeclWriter::VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *D) {
|
|||
void PCHDeclWriter::VisitObjCPropertyDecl(ObjCPropertyDecl *D) {
|
||||
VisitNamedDecl(D);
|
||||
Writer.AddSourceLocation(D->getAtLoc(), Record);
|
||||
Writer.AddTypeRef(D->getType(), Record);
|
||||
Writer.AddTypeSourceInfo(D->getTypeSourceInfo(), Record);
|
||||
// FIXME: stable encoding
|
||||
Record.push_back((unsigned)D->getPropertyAttributes());
|
||||
// FIXME: stable encoding
|
||||
|
|
|
@ -1598,7 +1598,7 @@ public:
|
|||
const bool isReadWrite,
|
||||
const unsigned Attributes,
|
||||
bool *isOverridingProperty,
|
||||
QualType T,
|
||||
TypeSourceInfo *T,
|
||||
tok::ObjCKeywordKind MethodImplKind);
|
||||
|
||||
/// Called by ActOnProperty and HandlePropertyInClassExtension to
|
||||
|
@ -1611,7 +1611,8 @@ public:
|
|||
Selector SetterSel,
|
||||
const bool isAssign,
|
||||
const bool isReadWrite,
|
||||
const unsigned Attributes, QualType T,
|
||||
const unsigned Attributes,
|
||||
TypeSourceInfo *T,
|
||||
tok::ObjCKeywordKind MethodImplKind,
|
||||
DeclContext *lexicalDC = 0);
|
||||
|
||||
|
|
|
@ -41,7 +41,8 @@ Sema::DeclPtrTy Sema::ActOnProperty(Scope *S, SourceLocation AtLoc,
|
|||
!(Attributes & ObjCDeclSpec::DQ_PR_retain) &&
|
||||
!(Attributes & ObjCDeclSpec::DQ_PR_copy)));
|
||||
|
||||
QualType T = GetTypeForDeclarator(FD.D, S);
|
||||
TypeSourceInfo *TSI = 0;
|
||||
QualType T = GetTypeForDeclarator(FD.D, S, &TSI);
|
||||
if (T->isReferenceType()) {
|
||||
Diag(AtLoc, diag::error_reference_property);
|
||||
return DeclPtrTy();
|
||||
|
@ -56,13 +57,13 @@ Sema::DeclPtrTy Sema::ActOnProperty(Scope *S, SourceLocation AtLoc,
|
|||
FD, GetterSel, SetterSel,
|
||||
isAssign, isReadWrite,
|
||||
Attributes,
|
||||
isOverridingProperty, T,
|
||||
isOverridingProperty, TSI,
|
||||
MethodImplKind);
|
||||
|
||||
DeclPtrTy Res = DeclPtrTy::make(CreatePropertyDecl(S, ClassDecl, AtLoc, FD,
|
||||
GetterSel, SetterSel,
|
||||
isAssign, isReadWrite,
|
||||
Attributes, T, MethodImplKind));
|
||||
Attributes, TSI, MethodImplKind));
|
||||
// Validate the attributes on the @property.
|
||||
CheckObjCPropertyAttributes(Res, AtLoc, Attributes);
|
||||
return Res;
|
||||
|
@ -76,7 +77,7 @@ Sema::HandlePropertyInClassExtension(Scope *S, ObjCCategoryDecl *CDecl,
|
|||
const bool isReadWrite,
|
||||
const unsigned Attributes,
|
||||
bool *isOverridingProperty,
|
||||
QualType T,
|
||||
TypeSourceInfo *T,
|
||||
tok::ObjCKeywordKind MethodImplKind) {
|
||||
|
||||
// Diagnose if this property is already in continuation class.
|
||||
|
@ -190,11 +191,11 @@ ObjCPropertyDecl *Sema::CreatePropertyDecl(Scope *S,
|
|||
const bool isAssign,
|
||||
const bool isReadWrite,
|
||||
const unsigned Attributes,
|
||||
QualType T,
|
||||
TypeSourceInfo *TInfo,
|
||||
tok::ObjCKeywordKind MethodImplKind,
|
||||
DeclContext *lexicalDC){
|
||||
|
||||
IdentifierInfo *PropertyId = FD.D.getIdentifier();
|
||||
QualType T = TInfo->getType();
|
||||
|
||||
// Issue a warning if property is 'assign' as default and its object, which is
|
||||
// gc'able conforms to NSCopying protocol
|
||||
|
@ -215,7 +216,7 @@ ObjCPropertyDecl *Sema::CreatePropertyDecl(Scope *S,
|
|||
DeclContext *DC = cast<DeclContext>(CDecl);
|
||||
ObjCPropertyDecl *PDecl = ObjCPropertyDecl::Create(Context, DC,
|
||||
FD.D.getIdentifierLoc(),
|
||||
PropertyId, AtLoc, T);
|
||||
PropertyId, AtLoc, TInfo);
|
||||
|
||||
if (ObjCPropertyDecl *prevDecl =
|
||||
ObjCPropertyDecl::findPropertyDecl(DC, PropertyId)) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче