shafik added a comment.

I think @dblaikie original idea of adding a DWARF attribute for this case is 
the right way to go here. AFAICT this will change the answer to basic questions 
such as what size a `struct` is and this will likely lead to confusion from our 
users who will expect the answers in expression parsing to match what they are 
seeing elsewhere e.g.:

  struct X {
      int i;
      [[no_unique_address]] Empty e;
  };
   
  struct X2 {
      int i;
      Empty e;
  };
   
  struct Z {
      char c;
      [[no_unique_address]] Empty e1, e2;
  };
  
  struct Z2 {
      char c;
      Empty e1, e2;
  };
  
  
  struct W {
      char c[2];
      [[no_unique_address]] Empty e1, e2;
  };
  
  struct W2 {
      char c[2];
      Empty e1, e2;
  };
  
  
  int main()
  {
      std::cout << sizeof(Empty) << "\n"
                << "X: " << sizeof(X) << "\n"
                << "X2: " << sizeof(X2) << "\n"
                << "Z: " << sizeof(Z) << "\n"
                << "Z2: " << sizeof(Z2) << "\n"
                << "W: " << sizeof(W) << "\n"
                << "W2: " << sizeof(W2) << "\n";
    
  }

See godbolt <https://godbolt.org/z/qYzWeEh7n> which shows this result:

  1
  X: 4
  X2: 8
  Z: 2
  Z2: 3
  W: 3
  W2: 4


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101237/new/

https://reviews.llvm.org/D101237

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to