[PATCH] RFC: fail-fast iterators for DenseMap

Sanjoy Das sanjoy at playingwithpointers.com
Sun Mar 1 16:36:43 PST 2015


On Sun, Mar 1, 2015 at 4:17 PM, Chandler Carruth <chandlerc at gmail.com> wrote:
> The advantage of setting a template argument via a typedef based on NDEBUG is that it ensures these types *mangle* differently which will give a hard error at link time if you mix code.

I don't think I understand how we'd end up with a link error.  We'll
be passing around DenseMap<T>s anyway; and this following program
mangles 'DenseMap::f' to the same thing independently of whether A is
defined or not:

template<typename T>struct Base { T x; };

#ifdef A
typedef Base<int> D;
#else
typedef Base<char> D;
#endif

struct DenseMap : D {
  int y;
  int f();
};

int DenseMap::f() {
  return y;
}

> I also think you should put the word "debug" in the name to indicate that this cannot be used for epoch-based data structures.
>
> The word "host" doesn't seem to really add much for me at least.
>
> How about: DebugEpochBase and DebugEpochBase::HandleBase?

Will do. x2

>
>
> http://reviews.llvm.org/D7931
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>



More information about the llvm-commits mailing list