rjmccall added inline comments.

================
Comment at: clang/lib/AST/RecordLayoutBuilder.cpp:1984
+    auto checkTypeIsTypedef = [](auto &&checkTypeIsTypedef,
+                                 const auto Ty) -> bool {
+      bool isTypedef = false;
----------------
Hah.  The knot-tying here is really cute, but I think either just make it a 
static function somewhere in the file, or make it iterative instead of 
recursive.

...actually, I think it would be better to just make the computation in 
`getTypeInfo` preserve more information.  Make `TypeInfo` carry a three-valued 
enum instead of an `AlignIsRequired` flag:

```
enum class AlignRequirement {
  /// The alignment was not explicit in code.
  None,

  /// The alignment comes from an alignment attribute on a typedef.
  RequiredByTypedef,

  /// The alignment comes from an alignment attribute on a record type.
  RequiredByRecord,
};
```

You can add a method on `TypeInfo` to ask if the alignment is required for any 
reason and make all the existing clients use that instead.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107394

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

Reply via email to