<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/153638>153638</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Override file of '-foverride-record-layout' is not read when C++ Modules are enabled
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:modules
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
sks75220
</td>
</tr>
</table>
<pre>
The lit test "clang/test/CodeGenCXX/override-layout-nameless-struct-union.cpp" fails when C++ Modules are enabled. We encountered this internally because we have set the default dialect to C++20 for PlayStation, exposing this problem.
The test case includes the following code:
```
// RUN: %clang_cc1 -w -fdump-record-layouts-simple -foverride-record-layout=%S/Inputs/override-layout-nameless-struct-union.layout %s | FileCheck %s
// CHECK: Type: struct S
// CHECK: Size:64
// CHECK: Alignment:32
// CHECK: FieldOffsets: [0, 32, 32]
struct S {
short _s;
//union {
int _su0;
char _su1;
//};
};
```
It is an attempt to compile this struct with a non-standard layout specified in the input file.
However, if modules are enabled (either explicitly via -fmodules or implicitly via -std=c++20, or that being the default of the compiler) that layout file is never read, leading to the test failure.
It appears to be a bug in the order of operations in clang/lib/Frontend/FrontEndAction.cpp in presence of modules.
This isn't urgent for us, because we are working around it by suppressing C++ Modules via adding the switch -fno-cxx-modules in the test's RUN line. But regardless, I thought I should report it
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMVUFv4zYT_TX0ZSBDpqzIPvhgO-tvgw_tFs0W3duCIkcWuzQpkEN73V9fjCwnaZuiBYJYJIfDmcf3HlVK9ugRN6LeifpxpjL1IW7St9TUUpazNpjr5nOP4CwBYSIQUmqn_FHIA4-FPOyDwf-h33_5IuQhnDFGa7Bw6hoyFV6d0GFKRaKYNRXZ2-DnehiElNAp6xJcevSwF3In5A5-CCY7TKAiAnrVOjRzgF95oEP2hBENUG8TWB545dwVWtQqJ4QLQq_OCAkJqEcw2KnsCIxVDjUBhf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