aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-04-13 15:14:38 +0000
committerDouglas Gregor <dgregor@apple.com>2009-04-13 15:14:38 +0000
commit841b53c5021152fa930e517d66e02e97ae47c34b (patch)
tree027265408f022584a5cde8b086d3989f66af6143 /lib/Sema/SemaDecl.cpp
parent4d41765accd438b6bf982801b4603290446206e0 (diff)
Make the selection of type declarations in Sema::getTypeName
deterministic when faced with an ambiguity. This eliminates the annoying test/SemaCXX/using-directive.cpp failure. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68952 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 7d27617891..018f74816a 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -85,8 +85,10 @@ Sema::TypeTy *Sema::getTypeName(IdentifierInfo &II, SourceLocation NameLoc,
for (LookupResult::iterator Res = Result.begin(), ResEnd = Result.end();
Res != ResEnd; ++Res) {
if (isa<TypeDecl>(*Res) || isa<ObjCInterfaceDecl>(*Res)) {
- IIDecl = *Res;
- break;
+ if (!IIDecl ||
+ (*Res)->getLocation().getRawEncoding() <
+ IIDecl->getLocation().getRawEncoding())
+ IIDecl = *Res;
}
}