Handle null IdentifierInfo* in Selector::getAsString().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66307 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Basic/IdentifierTable.cpp b/lib/Basic/IdentifierTable.cpp
index bd4facd..4e2e700 100644
--- a/lib/Basic/IdentifierTable.cpp
+++ b/lib/Basic/IdentifierTable.cpp
@@ -349,11 +349,13 @@
}
std::string Selector::getAsString() const {
- if (IdentifierInfo *II = getAsIdentifierInfo()) {
- if (getNumArgs() == 0)
- return II->getName();
+ if (InfoPtr & ArgFlags) {
+ IdentifierInfo *II = getAsIdentifierInfo();
- std::string Res = II->getName();
+ if (getNumArgs() == 0)
+ return II ? II->getName() : "";
+
+ std::string Res = II ? II->getName() : "";
Res += ":";
return Res;
}