diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-02-18 22:29:55 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-02-18 22:29:55 +0000 |
commit | 813d8346529bf094eb2b249648906ba7fd226688 (patch) | |
tree | b9917a37b5e050662f3c952de8d182a594965b1e /lib/Basic/IdentifierTable.cpp | |
parent | 35eaa281af2ef2b5172746b35bac1509e17d513c (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125977 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/IdentifierTable.cpp')
-rw-r--r-- | lib/Basic/IdentifierTable.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Basic/IdentifierTable.cpp b/lib/Basic/IdentifierTable.cpp index 48a5f49914..ef11d658ed 100644 --- a/lib/Basic/IdentifierTable.cpp +++ b/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); |