[PATCH] D117616: GCC ABI Compatibility: Preserve alignment of non-pod members in packed structs

2022-02-03 Thread Bhramar Vatsa via Phabricator via cfe-commits
Bhramar.vatsa added a comment.

@dblaikie 
The condition "FieldClass->isPOD()" returns false for the following case (when 
considering field 'struct foo t' of 'struct foo1') :

  class foo {
 foo() = default;
 int _a;
  };
  
  struct foo1 {
  struct foo t;
  } t1;

The same code though doesn't give any warning for gcc: 
https://godbolt.org/z/f4chraerY

This is because the way it works for CXXRecordDecl : 
https://github.com/llvm/llvm-project/blob/1e3a02162db20264e9615b1346420c8d199cb347/clang/lib/AST/DeclCXX.cpp#L928

So, there seems to be a difference the way GCC is handling this case, in 
comparison to how now clang handles it.

For the same case, `D->getType().isCXX11PODType()` (or `isPODType()`) indicates 
it to be a POD type. So, we think that this should be further changed such that 
it doesn't break the code that works with GCC.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117616

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


[PATCH] D119051: Fix pod-packed functionality to use the C++11 definition of pod-ness

2022-02-05 Thread Bhramar Vatsa via Phabricator via cfe-commits
Bhramar.vatsa added inline comments.



Comment at: clang/lib/AST/RecordLayoutBuilder.cpp:1892
+  bool FieldPacked =
+  (Packed && (!FieldClass || D->getType().isCXX11PODType(Context) ||
+  Context.getLangOpts().getClangABICompat() <=

Maybe irrespective of the field's type itself, only important thing is just if 
it is a POD type or not?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119051

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


[PATCH] D119051: Extend the C++03 definition of POD to include defaulted functions

2022-02-11 Thread Bhramar Vatsa via Phabricator via cfe-commits
Bhramar.vatsa added a comment.

Sorry, but I can only add a bit more confusion: https://godbolt.org/z/dzYhhxbz4
There are two cases, only differing in terms of user-defined constructor.

Gcc and clang differs in the two cases. Gcc at least packs the second case 
(without user defined constructor), but clang doesn't.

Uncomment/define macro 'PROPS' to check that the type-traits indicate in both 
cases that it can be considered POD.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119051

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