Skip to content
  • Duncan Sands's avatar
    Rather than giving SmallPtrSetImpl a member field SmallArray which is magically · 7b90966d
    Duncan Sands authored
    replaced by a bigger array in SmallPtrSet (by overridding it), instead just use a
    pointer to the start of the storage, and have SmallPtrSet pass in the value to use.
    This has the disadvantage that SmallPtrSet becomes bigger by one pointer.  It has
    the advantage that it no longer uses tricky C++ rules, and is clearly correct while
    I'm not sure the previous version was.  This was inspired by g++-4.6 pointing out
    that SmallPtrSetImpl was writing off the end of SmallArray, which it was.  Since
    SmallArray is replaced with a bigger array in SmallPtrSet, the write was still to
    valid memory.  But it was writing off the end of the declared array type - sounds
    kind of dubious to me, like it sounded dubious to g++-4.6.  Maybe g++-4.6 is wrong
    and this construct is perfectly valid and correctly compiled by all compilers, but
    I think it is better to avoid the whole can of worms by avoiding this construct.
    
    llvm-svn: 107285
    7b90966d
Loading