Skip to content

Commit

Permalink
[ms-inline-asm] Make sure the AsmRewrite list is sorted in lexical or…
Browse files Browse the repository at this point in the history
…der.

rdar://13202662


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175021 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Chad Rosier committed Feb 13, 2013
1 parent e68542e commit b195398
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/MC/MCParser/AsmParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit b195398

Please sign in to comment.