aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-11 20:14:49 +0000
committerChris Lattner <sabre@nondot.org>2009-04-11 20:14:49 +0000
commitd1e0f5a8ec5d5d5770e18b1d1db0bd7b849dc713 (patch)
tree1732048c5df5191b3d60443f827f210e8471601f
parent3aff919532fd807ed678b9cfa4b7eca7b04adcf9 (diff)
improve location info for property stuff. In a property like this:
@property int x; associate the location of X with the property decl, not the location of the @. Also, pass this info along to the synthesized ParmVarDecls so that redefinition and other diagnostics can use it. This eliminates a fixme. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68880 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaDeclObjC.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 6048901e7a..90a6bee819 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -780,10 +780,7 @@ void Sema::WarnConflictingTypedMethods(ObjCMethodDecl *ImpMethodDecl,
Diag((*IM)->getLocation(), diag::warn_conflicting_param_types)
<< ImpMethodDecl->getDeclName() << (*IF)->getType()
<< (*IM)->getType();
- SourceLocation Loc = (*IF)->getLocation();
- // FIXME
- if (Loc == SourceLocation()) Loc = IntfMethodDecl->getLocation();
- Diag(Loc, diag::note_previous_definition);
+ Diag((*IF)->getLocation(), diag::note_previous_definition);
}
}
@@ -1212,7 +1209,7 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property,
// Invent the arguments for the setter. We don't bother making a
// nice name for the argument.
ParmVarDecl *Argument = ParmVarDecl::Create(Context, SetterMethod,
- SourceLocation(),
+ property->getLocation(),
property->getIdentifier(),
property->getType(),
VarDecl::None,
@@ -1649,7 +1646,7 @@ Sema::DeclPtrTy Sema::ActOnProperty(Scope *S, SourceLocation AtLoc,
true, false, true,
ObjCMethodDecl::Required);
ParmVarDecl *Argument = ParmVarDecl::Create(Context, SetterDecl,
- SourceLocation(),
+ FD.D.getIdentifierLoc(),
PropertyId,
T, VarDecl::None, 0);
SetterDecl->setMethodParams(&Argument, 1, Context);
@@ -1671,16 +1668,18 @@ Sema::DeclPtrTy Sema::ActOnProperty(Scope *S, SourceLocation AtLoc,
}
}
- Type *t = T.getTypePtr();
- if (t->isArrayType() || t->isFunctionType())
- Diag(AtLoc, diag::err_property_type) << T;
-
DeclContext *DC = dyn_cast<DeclContext>(ClassDecl);
assert(DC && "ClassDecl is not a DeclContext");
- ObjCPropertyDecl *PDecl = ObjCPropertyDecl::Create(Context, DC, AtLoc,
+ ObjCPropertyDecl *PDecl = ObjCPropertyDecl::Create(Context, DC,
+ FD.D.getIdentifierLoc(),
FD.D.getIdentifier(), T);
DC->addDecl(Context, PDecl);
+ if (T->isArrayType() || T->isFunctionType()) {
+ Diag(AtLoc, diag::err_property_type) << T;
+ PDecl->setInvalidDecl();
+ }
+
ProcessDeclAttributes(PDecl, FD.D);
// Regardless of setter/getter attribute, we save the default getter/setter