summaryrefslogtreecommitdiffstats
path: root/llvm/utils
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
commitdbf7074296ada13aacc5008ccf5ed1ab0fb25323 (patch)
tree6b20a6384455079fd404962ac860980879d7cb89 /llvm/utils
parent131420c5d735ade02d29c7fa0e9487ea6bb64724 (diff)
downloadbcm5719-llvm-dbf7074296ada13aacc5008ccf5ed1ab0fb25323.tar.gz
bcm5719-llvm-dbf7074296ada13aacc5008ccf5ed1ab0fb25323.zip
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. llvm-svn: 91843
Diffstat (limited to 'llvm/utils')
-rw-r--r--llvm/utils/TableGen/Record.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/utils/TableGen/Record.cpp b/llvm/utils/TableGen/Record.cpp
index 53f90146a75..542735e88b4 100644
--- a/llvm/utils/TableGen/Record.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud