[cfe-commits] r68880 - /cfe/trunk/lib/Sema/SemaDeclObjC.cpp
Chris Lattner
sabre at nondot.org
Sat Apr 11 13:14:49 PDT 2009
Author: lattner
Date: Sat Apr 11 15:14:49 2009
New Revision: 68880
URL: http://llvm.org/viewvc/llvm-project?rev=68880&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=68880&r1=68879&r2=68880&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Sat Apr 11 15:14:49 2009
@@ -780,10 +780,7 @@
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 @@
// 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 @@
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 @@
}
}
- 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
More information about the cfe-commits
mailing list