aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/Basic/IdentifierTable.h15
-rw-r--r--lib/Basic/IdentifierTable.cpp3
-rw-r--r--lib/Sema/SemaDeclObjC.cpp4
3 files changed, 12 insertions, 10 deletions
diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h
index 32818a9137..2584136ec4 100644
--- a/include/clang/Basic/IdentifierTable.h
+++ b/include/clang/Basic/IdentifierTable.h
@@ -353,13 +353,6 @@ class Selector {
assert((InfoPtr & ArgFlags) == 0 &&"Insufficiently aligned IdentifierInfo");
}
Selector(uintptr_t V) : InfoPtr(V) {}
-public:
- friend class SelectorTable; // only the SelectorTable can create these
- friend class DeclarationName; // and the AST's DeclarationName.
-
- /// The default ctor should only be used when creating data structures that
- /// will contain selectors.
- Selector() : InfoPtr(0) {}
IdentifierInfo *getAsIdentifierInfo() const {
if (getIdentifierInfoFlag())
@@ -369,6 +362,14 @@ public:
unsigned getIdentifierInfoFlag() const {
return InfoPtr & ArgFlags;
}
+public:
+ friend class SelectorTable; // only the SelectorTable can create these
+ friend class DeclarationName; // and the AST's DeclarationName.
+
+ /// The default ctor should only be used when creating data structures that
+ /// will contain selectors.
+ Selector() : InfoPtr(0) {}
+
/// operator==/!= - Indicate whether the specified selectors are identical.
bool operator==(Selector RHS) const {
return InfoPtr == RHS.InfoPtr;
diff --git a/lib/Basic/IdentifierTable.cpp b/lib/Basic/IdentifierTable.cpp
index 4e2e7005e3..f4acbec019 100644
--- a/lib/Basic/IdentifierTable.cpp
+++ b/lib/Basic/IdentifierTable.cpp
@@ -352,8 +352,9 @@ std::string Selector::getAsString() const {
if (InfoPtr & ArgFlags) {
IdentifierInfo *II = getAsIdentifierInfo();
+ // If the number of arguments is 0 then II is guaranteed to not be null.
if (getNumArgs() == 0)
- return II ? II->getName() : "";
+ return II->getName();
std::string Res = II ? II->getName() : "";
Res += ":";
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 476b6afea5..f91feb423f 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -1139,7 +1139,7 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property,
Diag(property->getLocation(),
diag::err_accessor_property_type_mismatch)
<< property->getDeclName()
- << GetterMethod->getSelector().getAsIdentifierInfo();
+ << GetterMethod->getSelector().getAsString();
Diag(GetterMethod->getLocation(), diag::note_declared_at);
}
@@ -1152,7 +1152,7 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property,
Diag(property->getLocation(),
diag::err_accessor_property_type_mismatch)
<< property->getDeclName()
- << SetterMethod->getSelector().getAsIdentifierInfo();
+ << SetterMethod->getSelector().getAsString();
Diag(SetterMethod->getLocation(), diag::note_declared_at);
}
}