r177158 - Remove a pointless assertion.

Richard Smith richard at metafoo.co.uk
Fri Mar 15 11:00:29 PDT 2013


FYI

On Fri, Mar 15, 2013 at 8:02 AM, Nico Weber <nicolasweber at gmx.de> wrote:

> Author: nico
> Date: Fri Mar 15 10:02:37 2013
> New Revision: 177158
>
> URL: http://llvm.org/viewvc/llvm-project?rev=177158&view=rev
> Log:
> Remove a pointless assertion.
>
> FindNodeOrInsertPos() is called 10 lines earlier already, and the function
> early-returns there if the result is != 0. InsertPos isn't recomputed after
> that check, so this assert is always trivially true. (And it has nothing to
> do with if T is canonical or not.)
>
>
> Modified:
>     cfe/trunk/lib/AST/ASTContext.cpp
>
> Modified: cfe/trunk/lib/AST/ASTContext.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=177158&r1=177157&r2=177158&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/AST/ASTContext.cpp (original)
> +++ cfe/trunk/lib/AST/ASTContext.cpp Fri Mar 15 10:02:37 2013
> @@ -2026,13 +2026,9 @@ QualType ASTContext::getPointerType(Qual
>    // If the pointee type isn't canonical, this won't be a canonical type
> either,
>    // so fill in the canonical type field.
>    QualType Canonical;
> -  if (!T.isCanonical()) {
> +  if (!T.isCanonical())
>      Canonical = getPointerType(getCanonicalType(T));
>
> -    // Get the new insert position for the node we care about.
> -    PointerType *NewIP = PointerTypes.FindNodeOrInsertPos(ID, InsertPos);
>

This was updating InsertPos, which may have been invalidated by the call to
getPointerType.


> -    assert(NewIP == 0 && "Shouldn't be in the map!"); (void)NewIP;
>

... and this was checking that the call to getPointerType didn't fill in
that slot in the map, through a bad ID computation or confusion over
whether T is canonical.


> -  }
>    PointerType *New = new (*this, TypeAlignment) PointerType(T, Canonical);
>    Types.push_back(New);
>    PointerTypes.InsertNode(New, InsertPos);
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130315/1e113614/attachment.html>


More information about the cfe-commits mailing list