[cfe-commits] [PATCH] Revised patch for generating diagnostics information for crashing clang
David Blaikie
dblaikie at gmail.com
Fri Aug 12 16:02:21 PDT 2011
> David,
> I ran into another case where such a loop was useful. However, using code
> similar to the above
> resulted in an infinite loop in this case. After the Args.erase(it) I
> believe it is necessary to update ie.
> Something like this:
> for (InputList::iterator it = Inputs.begin(), ie = Inputs.end(); it != ie;)
> {
> if (types::getPreprocessedType(it->first) == types::TY_INVALID) {
> it = Inputs.erase(it);
> ie = Inputs.end();
> } else
> ++it;
> }
Ah, of course - I'm used to the classic "it != foo.end()" loop
conditions where this problem doesn't exist. Sorry I missed this case
& thanks for bringing it up.
Honestly, given the other lengths that LLVM's code goes to for
performance, the erase/remove style solution I gave as a secondary
option would probably be more idiomatic of LLVM code in any case.
- David
More information about the cfe-commits
mailing list