From 712a351c42d5378ce02532802b51c5fb60e868af Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Mon, 13 Apr 2009 15:14:38 +0000 Subject: 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. llvm-svn: 68952 --- clang/lib/Sema/SemaDecl.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'clang/lib/Sema/SemaDecl.cpp') diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 7d276178916..018f74816a4 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/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(*Res) || isa(*Res)) { - IIDecl = *Res; - break; + if (!IIDecl || + (*Res)->getLocation().getRawEncoding() < + IIDecl->getLocation().getRawEncoding()) + IIDecl = *Res; } } -- cgit v1.2.3