diff options
| author | David Greene <greened@obbligato.org> | 2009-12-21 21:21:34 +0000 | 
|---|---|---|
| committer | David Greene <greened@obbligato.org> | 2009-12-21 21:21:34 +0000 | 
| commit | dbf7074296ada13aacc5008ccf5ed1ab0fb25323 (patch) | |
| tree | 6b20a6384455079fd404962ac860980879d7cb89 /llvm/utils | |
| parent | 131420c5d735ade02d29c7fa0e9487ea6bb64724 (diff) | |
| download | bcm5719-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.cpp | 4 | 
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); | 

