summaryrefslogtreecommitdiff
path: root/utils/TableGen/Record.cpp
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2009-12-21 21:21:34 +0000
committerDavid Greene <greened@obbligato.org>2009-12-21 21:21:34 +0000
commitf660802f348e4e57ef9df8d30be74b894259badb (patch)
tree4ad5603c0f42c4d15e5b60b3c5a3464cf1842ab9 /utils/TableGen/Record.cpp
parent7b1eb8a4091ff4e76323ce2d4a42d5d14b5e3f50 (diff)
downloadllvm-f660802f348e4e57ef9df8d30be74b894259badb.tar.gz
llvm-f660802f348e4e57ef9df8d30be74b894259badb.tar.bz2
llvm-f660802f348e4e57ef9df8d30be74b894259badb.tar.xz
Fix a bug in !subst where TableGen would go and resubstitute text it had
just substituted. This could cause infinite looping in certain pathological cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91843 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/Record.cpp')
-rw-r--r--utils/TableGen/Record.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/utils/TableGen/Record.cpp b/utils/TableGen/Record.cpp
index 53f90146a7..542735e88b 100644
--- a/utils/TableGen/Record.cpp
+++ b/utils/TableGen/Record.cpp
@@ -945,11 +945,13 @@ Init *TernOpInit::Fold(Record *CurRec, MultiClass *CurMultiClass) {
std::string Val = RHSs->getValue();
std::string::size_type found;
+ std::string::size_type idx = 0;
do {
- found = Val.find(LHSs->getValue());
+ found = Val.find(LHSs->getValue(), idx);
if (found != std::string::npos) {
Val.replace(found, LHSs->getValue().size(), MHSs->getValue());
}
+ idx = found + MHSs->getValue().size();
} while (found != std::string::npos);
return new StringInit(Val);