diff options
author | Chad Rosier <mcrosier@apple.com> | 2013-02-13 01:03:13 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2013-02-13 01:03:13 +0000 |
commit | b1953981926991bb1373c915952368c653138e71 (patch) | |
tree | ad6945a1a289d43e74248b528dd03d09200b8f2a | |
parent | e68542e67e5c0f8d4bbdae0dde6ccd24525a18e3 (diff) |
[ms-inline-asm] Make sure the AsmRewrite list is sorted in lexical order.
rdar://13202662
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175021 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/MC/MCParser/AsmParser.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index 7aa381242c..0644ea341a 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -4029,6 +4029,10 @@ bool AsmParser::ParseDirectiveMSAlign(SMLoc IDLoc, ParseStatementInfo &Info) { return false; } +bool AsmStringSort (AsmRewrite A, AsmRewrite B) { + return A.Loc.getPointer() < B.Loc.getPointer(); +} + bool AsmParser::ParseMSInlineAsm(void *AsmLoc, std::string &AsmString, unsigned &NumOutputs, unsigned &NumInputs, SmallVectorImpl<std::pair<void *, bool> > &OpDecls, @@ -4153,6 +4157,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); for (SmallVectorImpl<struct AsmRewrite>::iterator I = AsmStrRewrites.begin(), E = AsmStrRewrites.end(); I != E; ++I) { const char *Loc = (*I).Loc.getPointer(); |