[PATCH] D23766: DebugInfo: use strongly typed enum for debug info flags

Victor via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 3 14:53:52 PDT 2016


vleschuk added a comment.

The conversation doesn't seem to appear here. So I repost (with few more details):

In https://reviews.llvm.org/D23766#532652, @vleschuk wrote:

> Removed few deprecated tests which don't make sense with new type for flags.




@dblaikie wrote:

> Removed few deprecated tests which don't make sense with new type for flags.


The removed tests trigger assert() in BitmaskEnum. So these tests look invalid for me now.

  /// Check that Val is in range for E, and return Val cast to E's underlying     
  /// type.                                                                       
  template <typename E> typename std::underlying_type<E>::type Underlying(E Val) {
    auto U = static_cast<typename std::underlying_type<E>::type>(Val);            
    assert(U >= 0 && "Negative enum values are not allowed.");                    
    assert(U <= Mask<E>() && "Enum value too large (or largest val too small?)");   // <===== this one
    return U;                                                                     
  }                                                                               

Please let me know if you have any objections.


https://reviews.llvm.org/D23766





More information about the llvm-commits mailing list