[llvm] r189495 - PR16995: DebugInfo: Don't overwrite existing member lists when adding template arguments

Michael Gottesman mgottesman at apple.com
Wed Aug 28 13:35:43 PDT 2013


Hey Dave.

I think this broke a buildbot:

http://lab.llvm.org:8013/builders/phase2%20-%20living/builds/5217

It might be the corresponding clang commit to this one (r189494). Can you fix/revert.

Michael

On 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)
> 
> Modified:
>    llvm/trunk/lib/IR/DebugInfo.cpp
> 
> Modified: llvm/trunk/lib/IR/DebugInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=189495&r1=189494&r2=189495&view=diff
> ==============================================================================
> --- llvm/trunk/lib/IR/DebugInfo.cpp (original)
> +++ llvm/trunk/lib/IR/DebugInfo.cpp Wed Aug 28 12:28:16 2013
> @@ -655,7 +655,24 @@ void DICompositeType::setTypeArray(DIArr
>          "If you're setting the template parameters this should include a slot "
>          "for that!");
>   TrackingVH<MDNode> N(*this);
> -  N->replaceOperandWith(10, Elements);
> +  if (Elements) {
> +#ifndef NDEBUG
> +    // Check that we're not dropping any elements on the floor here
> +    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);
>   DbgNode = N;
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list