aaron.ballman added a comment.

Can you also add a test specifically for an enumeration declaration, as that 
was something we found bugs with?



================
Comment at: clang/lib/AST/Randstruct.cpp:201
+            dyn_cast<ConstantArrayType>(RandomizedFields.back()->getType()))
+      if (CA->getSize().sle(2) || CA->isIncompleteArrayType())
+        FlexibleArray = RandomizedFields.pop_back_val();
----------------
CA->isIncompleteArrayType() looks to be at the wrong spot. An incomplete array 
type is one of type `IncompleteArrayType`, which a `ConstantArrayType` is not. 
Are we missing test coverage, or does the `hasFlexibleArrayMember()` make it so 
that we just need to remove this check entirely?


================
Comment at: clang/unittests/AST/RandstructTest.cpp:368
+        int h;
+        char name[0];
+    } __attribute__((randomize_layout));
----------------
Can you add a test where the last field is `char name[1];` and another one for 
`char name[];` so that we have full coverage there?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123958

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

Reply via email to