[PATCH] D143300: [randstruct] Don't allow implicit forward decl to stop struct randomization
Nick Desaulniers via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 6 09:06:23 PST 2023
nickdesaulniers added a comment.
In D143300#4104469 <https://reviews.llvm.org/D143300#4104469>, @MaskRay wrote:
> `clang/test/CodeGen/init-randomized-struct-fwd-decl.c` passes without this patch. Is it correct?
Perhaps related to my comment about RecordDecl vs EnumDecl...
or the tests might require a specific randomization seed?
================
Comment at: clang/lib/Sema/SemaDecl.cpp:18891
+ // incomplete definition.
+ if (const auto *RD = dyn_cast<RecordDecl>(D))
+ return !RD->isCompleteDefinition();
----------------
what about `EnumDecl`s? I suspect the shared common base `TagDecl` might be better to use?
If it is, can you add a test? I'm guessing
```
struct foo {
enum havent_seen_yet;
enum havent_seen_yet2;
}
```
would be the test case.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143300/new/
https://reviews.llvm.org/D143300
More information about the cfe-commits
mailing list