[llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/TraceValues.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Oct 17 11:23:01 PDT 2002
Changes in directory llvm/lib/Transforms/Instrumentation:
TraceValues.cpp updated: 1.49 -> 1.50
---
Log message:
* Apparently string::find doesn't work right on our sun boxes. Work around this.
---
Diffs of the changes:
Index: llvm/lib/Transforms/Instrumentation/TraceValues.cpp
diff -u llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.49 llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.50
--- llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.49 Sun Oct 13 14:39:15 2002
+++ llvm/lib/Transforms/Instrumentation/TraceValues.cpp Thu Oct 17 11:22:08 2002
@@ -212,10 +212,15 @@
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();
More information about the llvm-commits
mailing list