From: Reid Kleckner Date: Fri, 4 Aug 2017 21:52:25 +0000 (+0000) Subject: [libclang] Determinize order of platform availability attrs X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0bebb0619b3476e7e89eb1af48d6590edb1b4ce6;p=clang [libclang] Determinize order of platform availability attrs Previously this code was doing std::sort on IdentifierInfo pointers. Now it sorts alphabetically by platform name. This should de-flake clang/test/Index/availability.c, which was failing non-deterministically for me. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310138 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 1815fdf5bd..ca21b6c6f6 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -7303,7 +7303,8 @@ static void getCursorPlatformAvailabilityForDecl( std::sort(AvailabilityAttrs.begin(), AvailabilityAttrs.end(), [](AvailabilityAttr *LHS, AvailabilityAttr *RHS) { - return LHS->getPlatform() > RHS->getPlatform(); + return LHS->getPlatform()->getName() < + RHS->getPlatform()->getName(); }); ASTContext &Ctx = D->getASTContext(); auto It = std::unique(