aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaObjCProperty.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-09-27 23:39:40 +0000
committerTed Kremenek <kremenek@apple.com>2011-09-27 23:39:40 +0000
commitd2ee809f9e7c2c7a83b8918efa11e98863463f78 (patch)
tree0fd53a1f47b07202303a82a463cfe79c277cf967 /lib/Sema/SemaObjCProperty.cpp
parent8987b2385d9ba63ada66e1344ace79b04d5cb5c3 (diff)
Include prefix with default synthesized ivars.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140657 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaObjCProperty.cpp')
-rw-r--r--lib/Sema/SemaObjCProperty.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp
index 56aa4480fb..34c7020765 100644
--- a/lib/Sema/SemaObjCProperty.cpp
+++ b/lib/Sema/SemaObjCProperty.cpp
@@ -1249,10 +1249,20 @@ ObjCPropertyDecl *Sema::LookupPropertyDecl(const ObjCContainerDecl *CDecl,
return 0;
}
+static IdentifierInfo * getDefaultSynthIvarName(ObjCPropertyDecl *Prop,
+ ASTContext &Ctx) {
+ llvm::SmallString<128> ivarName;
+ {
+ llvm::raw_svector_ostream os(ivarName);
+ os << '_' << Prop->getIdentifier()->getName();
+ }
+ return &Ctx.Idents.get(ivarName.str());
+}
+
/// DefaultSynthesizeProperties - This routine default synthesizes all
/// properties which must be synthesized in class's @implementation.
-void Sema::DefaultSynthesizeProperties (Scope *S, ObjCImplDecl* IMPDecl,
- ObjCInterfaceDecl *IDecl) {
+void Sema::DefaultSynthesizeProperties(Scope *S, ObjCImplDecl* IMPDecl,
+ ObjCInterfaceDecl *IDecl) {
llvm::DenseMap<IdentifierInfo *, ObjCPropertyDecl*> PropMap;
CollectClassPropertyImplementations(IDecl, PropMap);
@@ -1289,7 +1299,8 @@ void Sema::DefaultSynthesizeProperties (Scope *S, ObjCImplDecl* IMPDecl,
// to help users.
ActOnPropertyImplDecl(S, SourceLocation(), SourceLocation(),
true,
- Prop->getIdentifier(), Prop->getIdentifier(),
+ /* property = */ Prop->getIdentifier(),
+ /* ivar = */ getDefaultSynthIvarName(Prop, Context),
SourceLocation());
}
}