aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Tooling/TransformerTest.cpp
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2022-07-23 15:14:14 +0200
committerDmitri Gribenko <gribozavr@gmail.com>2022-07-23 15:19:05 +0200
commitaba43035bdf89c08409f0efccaf5408165abed9e (patch)
treeae91c3b453964fe779d5dc8562b90507f59abe86 /clang/unittests/Tooling/TransformerTest.cpp
parente82880e6b8cd2f01ee18e99c4c7b6ec71b764e13 (diff)
downloadllvm-aba43035bdf89c08409f0efccaf5408165abed9e.zip
llvm-aba43035bdf89c08409f0efccaf5408165abed9e.tar.gz
llvm-aba43035bdf89c08409f0efccaf5408165abed9e.tar.bz2
Use llvm::sort instead of std::sort where possible
llvm::sort is beneficial even when we use the iterator-based overload, since it can optionally shuffle the elements (to detect non-determinism). However llvm::sort is not usable everywhere, for example, in compiler-rt. Reviewed By: nhaehnle Differential Revision: https://reviews.llvm.org/D130406
Diffstat (limited to 'clang/unittests/Tooling/TransformerTest.cpp')
-rw-r--r--clang/unittests/Tooling/TransformerTest.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/unittests/Tooling/TransformerTest.cpp b/clang/unittests/Tooling/TransformerTest.cpp
index 9bc372b..7367282 100644
--- a/clang/unittests/Tooling/TransformerTest.cpp
+++ b/clang/unittests/Tooling/TransformerTest.cpp
@@ -12,6 +12,7 @@
#include "clang/Tooling/Transformer/RangeSelector.h"
#include "clang/Tooling/Transformer/RewriteRule.h"
#include "clang/Tooling/Transformer/Stencil.h"
+#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/Error.h"
#include "gmock/gmock.h"
@@ -1617,10 +1618,9 @@ TEST_F(TransformerTest, MultipleFiles) {
"clang-tool", std::make_shared<PCHContainerOperations>(),
{{"input.h", Header}}));
- std::sort(Changes.begin(), Changes.end(),
- [](const AtomicChange &L, const AtomicChange &R) {
- return L.getFilePath() < R.getFilePath();
- });
+ llvm::sort(Changes, [](const AtomicChange &L, const AtomicChange &R) {
+ return L.getFilePath() < R.getFilePath();
+ });
ASSERT_EQ(Changes[0].getFilePath(), "./input.h");
EXPECT_THAT(Changes[0].getInsertedHeaders(), IsEmpty());