[PATCH] D23766: DebugInfo: introduce DIFlagsUnderlying type for debug info flags

Victor via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 29 11:30:49 PDT 2016


vleschuk added a comment.

In https://reviews.llvm.org/D23766#528004, @dblaikie wrote:

> Why is it that we aren't just using teh DIFlags type directly everywhere we are currently using unsigned (everywhere you're changing to DIFlagsUnderlying)?


Because constructions like the following do not compile

  enum DIFlags: uint32_t
  {
      Flag1 = 1,
      Flag2 = 1 << 2,
      Flag3 = 1 << 3,
  };
  
  // .... 
  
  DIFlags Flags = Flag1 | Flag2; // expression (Flag1 | Flag2) isn't DIFlags, it results in underlying type



  clang++ -std=c++11 t.cpp -o t
  t.cpp:12:13: error: cannot initialize a variable of type 'DIFlags' with an rvalue of type 'unsigned int'
      DIFlags Flags = Flag1 | Flag2;
              ^       ~~~~~~~~~~~~~
  1 error generated.


https://reviews.llvm.org/D23766





More information about the llvm-commits mailing list