diff options
author | Chad Rosier <mcrosier@apple.com> | 2013-02-13 18:38:58 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2013-02-13 18:38:58 +0000 |
commit | abde6755f93cbfa7ad06c71f7e535b0b36f6f532 (patch) | |
tree | cd482a1e880fb52702c7af5e5ebf55cad85b2240 | |
parent | 5d0ce79e26f40141f35cc0002dc5cc6060382359 (diff) |
[ms-inline-asm] Use an array_pod_sort, rather than a std:sort.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175063 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/MC/MCParser/AsmParser.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index 0644ea341a..2cce8b0e43 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -13,6 +13,7 @@ #include "llvm/ADT/APFloat.h" #include "llvm/ADT/SmallString.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/Twine.h" #include "llvm/MC/MCAsmInfo.h" @@ -4029,8 +4030,14 @@ bool AsmParser::ParseDirectiveMSAlign(SMLoc IDLoc, ParseStatementInfo &Info) { return false; } -bool AsmStringSort (AsmRewrite A, AsmRewrite B) { - return A.Loc.getPointer() < B.Loc.getPointer(); +static int RewritesSort (const void *A, const void *B) { + const AsmRewrite *AsmRewriteA = static_cast<const AsmRewrite*>(A); + const AsmRewrite *AsmRewriteB = static_cast<const AsmRewrite*>(B); + if (AsmRewriteA->Loc.getPointer() < AsmRewriteB->Loc.getPointer()) + return -1; + if (AsmRewriteB->Loc.getPointer() < AsmRewriteA->Loc.getPointer()) + return 1; + return 0; } bool AsmParser::ParseMSInlineAsm(void *AsmLoc, std::string &AsmString, @@ -4157,7 +4164,7 @@ bool AsmParser::ParseMSInlineAsm(void *AsmLoc, std::string &AsmString, AsmRewriteKind PrevKind = AOK_Imm; raw_string_ostream OS(AsmStringIR); const char *Start = SrcMgr.getMemoryBuffer(0)->getBufferStart(); - std::sort (AsmStrRewrites.begin(), AsmStrRewrites.end(), AsmStringSort); + array_pod_sort (AsmStrRewrites.begin(), AsmStrRewrites.end(), RewritesSort); for (SmallVectorImpl<struct AsmRewrite>::iterator I = AsmStrRewrites.begin(), E = AsmStrRewrites.end(); I != E; ++I) { const char *Loc = (*I).Loc.getPointer(); |