Skip to content

Commit 46b2a46

Browse files
committed
[randstruct] Use llvm::shuffle to avoid STL impl difference after D121556
This reverts commit 2a2149c. This reverts commit 8d7595b. This reverts commit e2e6899. If this doesn't work, I'll revert the whole thing.
1 parent 6bf7c1b commit 46b2a46

File tree

3 files changed

+445
-2
lines changed

3 files changed

+445
-2
lines changed

clang/lib/AST/Randstruct.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,14 @@ void randomizeStructureLayoutImpl(const ASTContext &Context,
150150
if (CurrentBitfieldRun)
151151
Buckets.push_back(std::move(CurrentBitfieldRun));
152152

153-
std::shuffle(std::begin(Buckets), std::end(Buckets), RNG);
153+
llvm::shuffle(std::begin(Buckets), std::end(Buckets), RNG);
154154

155155
// Produce the new ordering of the elements from the Buckets.
156156
SmallVector<FieldDecl *, 16> FinalOrder;
157157
for (const std::unique_ptr<Bucket> &B : Buckets) {
158158
llvm::SmallVectorImpl<FieldDecl *> &RandFields = B->fields();
159159
if (!B->isBitfieldRun())
160-
std::shuffle(std::begin(RandFields), std::end(RandFields), RNG);
160+
llvm::shuffle(std::begin(RandFields), std::end(RandFields), RNG);
161161

162162
FinalOrder.insert(FinalOrder.end(), RandFields.begin(), RandFields.end());
163163
}

clang/unittests/AST/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ add_clang_unittest(ASTTests
2525
EvaluateAsRValueTest.cpp
2626
ExternalASTSourceTest.cpp
2727
NamedDeclPrinterTest.cpp
28+
RandstructTest.cpp
2829
RecursiveASTVisitorTest.cpp
2930
SizelessTypesTest.cpp
3031
SourceLocationTest.cpp

0 commit comments

Comments
 (0)