[llvm] r175021 - [ms-inline-asm] Make sure the AsmRewrite list is sorted in lexical order.

Chad Rosier mcrosier at apple.com
Tue Feb 12 17:03:14 PST 2013


Author: mcrosier
Date: Tue Feb 12 19:03:13 2013
New Revision: 175021

URL: http://llvm.org/viewvc/llvm-project?rev=175021&view=rev
Log:
[ms-inline-asm] Make sure the AsmRewrite list is sorted in lexical order.
rdar://13202662

Modified:
    llvm/trunk/lib/MC/MCParser/AsmParser.cpp

Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=175021&r1=175020&r2=175021&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Tue Feb 12 19:03:13 2013
@@ -4029,6 +4029,10 @@ bool AsmParser::ParseDirectiveMSAlign(SM
   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 *A
   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();





More information about the llvm-commits mailing list