@@ -1365,23 +1365,6 @@ void ItaniumRecordLayoutBuilder::LayoutFields(const RecordDecl *D) {
1365
1365
bool InsertExtraPadding = D->mayInsertExtraPadding (/* EmitRemark=*/ true );
1366
1366
bool HasFlexibleArrayMember = D->hasFlexibleArrayMember ();
1367
1367
1368
- // A staging area to easily reorder the fields
1369
- SmallVector<Decl *, 64 > fields;
1370
- for (auto f : D->fields ()) {
1371
- fields.push_back (f);
1372
- }
1373
-
1374
- bool ShouldBeRandomized = D->getAttr <RandomizeLayoutAttr>() != nullptr ;
1375
- if (ShouldBeRandomized) {
1376
- // FIXME Should call our Randstruct code once we port it.
1377
- auto rng = std::default_random_engine {};
1378
- std::shuffle (std::begin (fields), std::end (fields), rng);
1379
-
1380
- // This will rebuild the Decl chain of fields
1381
- D->reorderFields (fields);
1382
- }
1383
-
1384
-
1385
1368
for (auto I = D->field_begin (), End = D->field_end (); I != End; ++I) {
1386
1369
auto Next (I);
1387
1370
++Next;
@@ -3005,6 +2988,24 @@ ASTContext::getASTRecordLayout(const RecordDecl *D) const {
3005
2988
3006
2989
const ASTRecordLayout *NewEntry = nullptr ;
3007
2990
2991
+ // FIXME Randstruct code should be called here!
2992
+ // A staging area to easily reorder the fields
2993
+ SmallVector<Decl *, 64 > fields;
2994
+ for (auto f : D->fields ()) {
2995
+ fields.push_back (f);
2996
+ }
2997
+
2998
+ bool ShouldBeRandomized = D->getAttr <RandomizeLayoutAttr>() != nullptr ;
2999
+ if (ShouldBeRandomized) {
3000
+ // FIXME Should call our Randstruct code once we port it.
3001
+ auto rng = std::default_random_engine {};
3002
+ std::shuffle (std::begin (fields), std::end (fields), rng);
3003
+
3004
+ // This will rebuild the Decl chain of fields
3005
+ D->reorderFields (fields);
3006
+ }
3007
+ // FIXME end Randstruct code
3008
+
3008
3009
if (isMsLayout (*this )) {
3009
3010
MicrosoftRecordLayoutBuilder Builder (*this );
3010
3011
if (const auto *RD = dyn_cast<CXXRecordDecl>(D)) {
0 commit comments