[llvm] r189495 - PR16995: DebugInfo: Don't overwrite existing member lists when adding template arguments
Eric Christopher
echristo at gmail.com
Wed Aug 28 13:06:24 PDT 2013
On Wed, Aug 28, 2013 at 10:28 AM, David Blaikie <dblaikie at gmail.com> wrote:
> Author: dblaikie
> Date: Wed Aug 28 12:28:16 2013
> New Revision: 189495
>
> URL: http://llvm.org/viewvc/llvm-project?rev=189495&view=rev
> Log:
> PR16995: DebugInfo: Don't overwrite existing member lists when adding template arguments
>
> With the added debug assertions this fix is covered by existing Clang
> tests. (& found some other issues, also fixed)
>
This actually seems to be checking that we don't have a NULL array
being passed in and the debug checks are that we have a
super/identical set of elements when we're going to replace?
I do wish we could have a test that fails when the code isn't there.
> - N->replaceOperandWith(10, Elements);
> + if (Elements) {
> +#ifndef NDEBUG
> + // Check that we're not dropping any elements on the floor here
Silly nit: Needs a '.'
> + if (const MDNode *El = cast_or_null<MDNode>(N->getOperand(10))) {
> + for (unsigned i = 0; i != El->getNumOperands(); ++i) {
> + if (i == 0 && isa<ConstantInt>(El->getOperand(i)))
> + continue;
> + const MDNode *E = cast<MDNode>(El->getOperand(i));
> + bool found = false;
> + for (unsigned j = 0; !found && j != Elements.getNumElements(); ++j) {
> + found = E == Elements.getElement(j);
> + }
> + assert(found && "Losing a member during member list replacement");
> + }
> + }
> +#endif
> + N->replaceOperandWith(10, Elements);
> + }
> if (TParams)
> N->replaceOperandWith(13, TParams);
Any reason we don't want the same check here? I haven't gone through
the path we're taking to get here from the bug to check.
Also, comments :)
-eric
More information about the llvm-commits
mailing list