summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclarationName.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/AST/DeclarationName.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/AST/DeclarationName.cpp')
-rw-r--r--clang/lib/AST/DeclarationName.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/clang/lib/AST/DeclarationName.cpp b/clang/lib/AST/DeclarationName.cpp
index ac3989bbb8e..cef54e97c93 100644
--- a/clang/lib/AST/DeclarationName.cpp
+++ b/clang/lib/AST/DeclarationName.cpp
@@ -94,10 +94,8 @@ int DeclarationName::compare(DeclarationName LHS, DeclarationName RHS) {
Selector RHSSelector = RHS.getObjCSelector();
unsigned LN = LHSSelector.getNumArgs(), RN = RHSSelector.getNumArgs();
for (unsigned I = 0, N = std::min(LN, RN); I != N; ++I) {
- IdentifierInfo *LHSId = LHSSelector.getIdentifierInfoForSlot(I);
- IdentifierInfo *RHSId = RHSSelector.getIdentifierInfoForSlot(I);
-
- switch (LHSId->getName().compare(RHSId->getName())) {
+ switch (LHSSelector.getNameForSlot(I).compare(
+ RHSSelector.getNameForSlot(I))) {
case -1: return true;
case 1: return false;
default: break;
OpenPOWER on IntegriCloud