summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/IdentifierTable.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-02-18 22:29:55 +0000
committerDouglas Gregor <dgregor@apple.com>2011-02-18 22:29:55 +0000
commitaf2a6ae429e14c52c3712967bd859b715076445b (patch)
treeecd1dc5097f05f96ab87054323d8861eed60e07d /clang/lib/Basic/IdentifierTable.cpp
parent7ba92d716ad48222067df38c7bb1ed59704cfb65 (diff)
downloadbcm5719-llvm-af2a6ae429e14c52c3712967bd859b715076445b.tar.gz
bcm5719-llvm-af2a6ae429e14c52c3712967bd859b715076445b.zip
Selector::getIdentifierInfoForSlot() can return NULL values, a fact
that was ignored in a few places (most notably, code completion). Introduce Selector::getNameForSlot() for the common case where we only care about the name. Audit all uses of getIdentifierInfoForSlot(), switching many over to getNameForSlot(), fixing a few crashers. Fixed <rdar://problem/8939352>, a code-completion crasher. llvm-svn: 125977
Diffstat (limited to 'clang/lib/Basic/IdentifierTable.cpp')
-rw-r--r--clang/lib/Basic/IdentifierTable.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Basic/IdentifierTable.cpp b/clang/lib/Basic/IdentifierTable.cpp
index 48a5f49914b..ef11d658ed9 100644
--- a/clang/lib/Basic/IdentifierTable.cpp
+++ b/clang/lib/Basic/IdentifierTable.cpp
@@ -326,6 +326,11 @@ IdentifierInfo *Selector::getIdentifierInfoForSlot(unsigned argIndex) const {
return SI->getIdentifierInfoForSlot(argIndex);
}
+llvm::StringRef Selector::getNameForSlot(unsigned int argIndex) const {
+ IdentifierInfo *II = getIdentifierInfoForSlot(argIndex);
+ return II? II->getName() : llvm::StringRef();
+}
+
std::string MultiKeywordSelector::getName() const {
llvm::SmallString<256> Str;
llvm::raw_svector_ostream OS(Str);
OpenPOWER on IntegriCloud