[PATCH] D61239: [libclang] Allow field offset lookups in types with incomplete arrays.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 1 07:54:17 PDT 2019


aaron.ballman added inline comments.


================
Comment at: test/Index/print-type-size.c:6
+  // CHECK: FieldDecl=size:4:7 (Definition) [type=int] [typekind=Int] [sizeof=4] [alignof=4] [offsetof=0]
+  void* data[];
+  // CHECK: FieldDecl=data:6:9 (Definition) [type=void *[]] [typekind=IncompleteArray] [sizeof=-2] [alignof=8] [offsetof=64]
----------------
Can you run this through clang-format so it matches our usual formatting style rules?


================
Comment at: tools/libclang/CXType.cpp:888
 
+static bool isIncompleteTypeWithAlignment(const QualType &QT) {
+  return QT->isIncompleteArrayType() || !QT->isIncompleteType();
----------------
No need to use a reference here, just pass `QualType` (non-const).


================
Comment at: tools/libclang/CXType.cpp:957
 
+static bool isTypeIncompleteForLayout(const QualType &QT) {
+  return QT->isIncompleteType() && !QT->isIncompleteArrayType();
----------------
Similar here.


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

https://reviews.llvm.org/D61239





More information about the cfe-commits mailing list