aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclObjC.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-11-24 03:54:41 +0000
committerChris Lattner <sabre@nondot.org>2008-11-24 03:54:41 +0000
commit8ec03f58c33c33a917f54bb7f2cd61b6d7ffe0ca (patch)
treeab82837deaf7ca40831de4b7467d2d3c1982c9ff /lib/Sema/SemaDeclObjC.cpp
parentbb49c3ee5d270485f4b273691fd14bc97403fa5d (diff)
Rename NamedDecl::getIdentifierName() to ::getNameAsCString() and make it
assert if the name is not an identifier. Update callers to do the right thing and avoid this method in unsafe cases. This also fixes an objc warning that was missing a space, and migrates a couple more to taking IdentifierInfo and QualTypes instead of std::strings. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59936 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r--lib/Sema/SemaDeclObjC.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 64fd6c515d..9141cb5b9e 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -242,7 +242,7 @@ Sema::FindProtocolDeclaration(bool WarnOnDeclarations,
void
Sema::DiagnosePropertyMismatch(ObjCPropertyDecl *Property,
ObjCPropertyDecl *SuperProperty,
- const char *inheritedName) {
+ const IdentifierInfo *inheritedName) {
ObjCPropertyDecl::PropertyAttributeKind CAttr =
Property->getPropertyAttributes();
ObjCPropertyDecl::PropertyAttributeKind SAttr =
@@ -250,31 +250,31 @@ Sema::DiagnosePropertyMismatch(ObjCPropertyDecl *Property,
if ((CAttr & ObjCPropertyDecl::OBJC_PR_readonly)
&& (SAttr & ObjCPropertyDecl::OBJC_PR_readwrite))
Diag(Property->getLocation(), diag::warn_readonly_property)
- << Property->getName() << inheritedName;
+ << Property->getDeclName() << inheritedName;
if ((CAttr & ObjCPropertyDecl::OBJC_PR_copy)
!= (SAttr & ObjCPropertyDecl::OBJC_PR_copy))
Diag(Property->getLocation(), diag::warn_property_attribute)
- << Property->getName() << "copy" << inheritedName;
+ << Property->getDeclName() << "copy" << inheritedName;
else if ((CAttr & ObjCPropertyDecl::OBJC_PR_retain)
!= (SAttr & ObjCPropertyDecl::OBJC_PR_retain))
Diag(Property->getLocation(), diag::warn_property_attribute)
- << Property->getName() << "retain" << inheritedName;
+ << Property->getDeclName() << "retain" << inheritedName;
if ((CAttr & ObjCPropertyDecl::OBJC_PR_nonatomic)
!= (SAttr & ObjCPropertyDecl::OBJC_PR_nonatomic))
Diag(Property->getLocation(), diag::warn_property_attribute)
- << Property->getName() << "atomic" << inheritedName;
+ << Property->getDeclName() << "atomic" << inheritedName;
if (Property->getSetterName() != SuperProperty->getSetterName())
Diag(Property->getLocation(), diag::warn_property_attribute)
- << Property->getName() << "setter" << inheritedName;
+ << Property->getDeclName() << "setter" << inheritedName;
if (Property->getGetterName() != SuperProperty->getGetterName())
Diag(Property->getLocation(), diag::warn_property_attribute)
- << Property->getName() << "getter" << inheritedName;
+ << Property->getDeclName() << "getter" << inheritedName;
if (Context.getCanonicalType(Property->getType()) !=
Context.getCanonicalType(SuperProperty->getType()))
Diag(Property->getLocation(), diag::warn_property_type)
- << Property->getType().getAsString() << inheritedName;
+ << Property->getType() << inheritedName;
}
@@ -297,7 +297,7 @@ Sema::ComparePropertiesInBaseAndSuper(ObjCInterfaceDecl *IDecl) {
ObjCPropertyDecl *PDecl = (*I);
if (SuperPDecl->getIdentifier() == PDecl->getIdentifier())
DiagnosePropertyMismatch(PDecl, SuperPDecl,
- SDecl->getIdentifierName());
+ SDecl->getIdentifier());
}
}
}
@@ -307,8 +307,7 @@ Sema::ComparePropertiesInBaseAndSuper(ObjCInterfaceDecl *IDecl) {
/// of properties for current class if it is not there already.
void
Sema::MergeOneProtocolPropertiesIntoClass(ObjCInterfaceDecl *IDecl,
- ObjCProtocolDecl *PDecl)
-{
+ ObjCProtocolDecl *PDecl) {
llvm::SmallVector<ObjCPropertyDecl*, 16> mergeProperties;
for (ObjCProtocolDecl::classprop_iterator P = PDecl->classprop_begin(),
E = PDecl->classprop_end(); P != E; ++P) {
@@ -324,7 +323,7 @@ Sema::MergeOneProtocolPropertiesIntoClass(ObjCInterfaceDecl *IDecl,
mergeProperties.push_back(Pr);
else
// Property protocol already exist in class. Diagnose any mismatch.
- DiagnosePropertyMismatch((*CP), Pr, PDecl->getIdentifierName());
+ DiagnosePropertyMismatch((*CP), Pr, PDecl->getIdentifier());
}
IDecl->mergeProperties(&mergeProperties[0], mergeProperties.size());
}