* Apparently string::find doesn't work right on our sun boxes. Work around this.

llvm-svn: 4219
This commit is contained in:
Chris Lattner 2002-10-17 16:22:08 +00:00
parent 981c92a9e2
commit 26783a5be5
1 changed files with 9 additions and 4 deletions

View File

@ -212,10 +212,15 @@ static void InsertPrintInst(Value *V, BasicBlock *BB, Instruction *InsertBefore,
string Message,
Function *Printf, Function* HashPtrToSeqNum) {
// Escape Message by replacing all % characters with %% chars.
unsigned Offset = 0;
while ((Offset = Message.find('%', Offset)) != string::npos) {
Message.replace(Offset, 1, "%%");
Offset += 2; // Skip over the new %'s
string Tmp;
std::swap(Tmp, Message);
string::iterator I = std::find(Tmp.begin(), Tmp.end(), '%');
while (I != Tmp.end()) {
Message.append(Tmp.begin(), I);
Message += "%%";
++I; // Make sure to erase the % as well...
Tmp.erase(Tmp.begin(), I);
I = std::find(Tmp.begin(), Tmp.end(), '%');
}
Module *Mod = BB->getParent()->getParent();