summaryrefslogtreecommitdiffstats
path: root/llvm/unittests
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests')
-rw-r--r--llvm/unittests/ADT/ArrayRefTest.cpp3
-rw-r--r--llvm/unittests/ADT/ImmutableListTest.cpp3
-rw-r--r--llvm/unittests/ADT/PointerIntPairTest.cpp8
-rw-r--r--llvm/unittests/ADT/StringRefTest.cpp2
-rw-r--r--llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp4
-rw-r--r--llvm/unittests/Bitcode/BitstreamReaderTest.cpp3
-rw-r--r--llvm/unittests/CodeGen/CMakeLists.txt1
-rw-r--r--llvm/unittests/CodeGen/MachineInstrTest.cpp2
-rw-r--r--llvm/unittests/IR/CFGBuilder.cpp9
-rw-r--r--llvm/unittests/Support/ScaledNumberTest.cpp3
10 files changed, 38 insertions, 0 deletions
diff --git a/llvm/unittests/ADT/ArrayRefTest.cpp b/llvm/unittests/ADT/ArrayRefTest.cpp
index ba540688cb5..a5609f89ff9 100644
--- a/llvm/unittests/ADT/ArrayRefTest.cpp
+++ b/llvm/unittests/ADT/ArrayRefTest.cpp
@@ -248,4 +248,7 @@ TEST(ArrayRefTest, makeArrayRef) {
EXPECT_TRUE(AR2.equals(AR2Ref));
}
+static_assert(is_trivially_copyable<ArrayRef<int>>::value,
+ "trivially copyable");
+
} // end anonymous namespace
diff --git a/llvm/unittests/ADT/ImmutableListTest.cpp b/llvm/unittests/ADT/ImmutableListTest.cpp
index bd5289d6b29..b0b1e0e6c29 100644
--- a/llvm/unittests/ADT/ImmutableListTest.cpp
+++ b/llvm/unittests/ADT/ImmutableListTest.cpp
@@ -267,4 +267,7 @@ TEST_F(ImmutableListTest, LongListOrderingTest) {
ASSERT_EQ(6, i);
}
+static_assert(is_trivially_copyable<ImmutableList<Wrapper<long>>>::value,
+ "trivially copyable");
+
} // namespace
diff --git a/llvm/unittests/ADT/PointerIntPairTest.cpp b/llvm/unittests/ADT/PointerIntPairTest.cpp
index 95e280330a7..6b3a4c055c9 100644
--- a/llvm/unittests/ADT/PointerIntPairTest.cpp
+++ b/llvm/unittests/ADT/PointerIntPairTest.cpp
@@ -61,6 +61,9 @@ TEST(PointerIntPairTest, GetSet) {
Pair2.setPointerAndInt(&s, E::Case3);
EXPECT_EQ(&s, Pair2.getPointer());
EXPECT_EQ(E::Case3, Pair2.getInt());
+
+ static_assert(is_trivially_copyable<PointerIntPair<S *, 2, E>>::value,
+ "trivially copyable");
}
TEST(PointerIntPairTest, DefaultInitialize) {
@@ -96,6 +99,11 @@ TEST(PointerIntPairTest, ManyUnusedBits) {
EXPECT_EQ(FixnumPointerTraits::NumLowBitsAvailable - 1,
PointerLikeTypeTraits<decltype(pair)>::NumLowBitsAvailable);
+
+ static_assert(
+ is_trivially_copyable<
+ PointerIntPair<Fixnum31, 1, bool, FixnumPointerTraits>>::value,
+ "trivially copyable");
}
} // end anonymous namespace
diff --git a/llvm/unittests/ADT/StringRefTest.cpp b/llvm/unittests/ADT/StringRefTest.cpp
index fbb60e6ce26..6f83dc3224a 100644
--- a/llvm/unittests/ADT/StringRefTest.cpp
+++ b/llvm/unittests/ADT/StringRefTest.cpp
@@ -1061,4 +1061,6 @@ TEST(StringRefTest, StringLiteral) {
EXPECT_EQ(StringRef("Bar"), Strings[1]);
}
+static_assert(is_trivially_copyable<StringRef>::value, "trivially copyable");
+
} // end anonymous namespace
diff --git a/llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp b/llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp
index 5572f5ba597..2aeba947a74 100644
--- a/llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp
+++ b/llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/Analysis/BlockFrequencyInfo.h"
+#include "llvm/Analysis/BlockFrequencyInfoImpl.h"
#include "llvm/Analysis/BranchProbabilityInfo.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/AsmParser/Parser.h"
@@ -90,5 +91,8 @@ TEST_F(BlockFrequencyInfoTest, Basic) {
EXPECT_EQ(BFI.getBlockFreq(BB3).getFrequency(), BB3Freq);
}
+static_assert(is_trivially_copyable<bfi_detail::BlockMass>::value,
+ "trivially copyable");
+
} // end anonymous namespace
} // end namespace llvm
diff --git a/llvm/unittests/Bitcode/BitstreamReaderTest.cpp b/llvm/unittests/Bitcode/BitstreamReaderTest.cpp
index e9e6d9a1d07..85954858609 100644
--- a/llvm/unittests/Bitcode/BitstreamReaderTest.cpp
+++ b/llvm/unittests/Bitcode/BitstreamReaderTest.cpp
@@ -147,4 +147,7 @@ TEST(BitstreamReaderTest, shortRead) {
}
}
+static_assert(is_trivially_copyable<BitCodeAbbrevOp>::value,
+ "trivially copyable");
+
} // end anonymous namespace
diff --git a/llvm/unittests/CodeGen/CMakeLists.txt b/llvm/unittests/CodeGen/CMakeLists.txt
index 5ef8c2afb8c..772c075de12 100644
--- a/llvm/unittests/CodeGen/CMakeLists.txt
+++ b/llvm/unittests/CodeGen/CMakeLists.txt
@@ -19,6 +19,7 @@ add_llvm_unittest(CodeGenTests
MachineInstrTest.cpp
MachineOperandTest.cpp
ScalableVectorMVTsTest.cpp
+ TypeTraitsTest.cpp
)
add_subdirectory(GlobalISel)
diff --git a/llvm/unittests/CodeGen/MachineInstrTest.cpp b/llvm/unittests/CodeGen/MachineInstrTest.cpp
index 880e013b99f..2678a4589f9 100644
--- a/llvm/unittests/CodeGen/MachineInstrTest.cpp
+++ b/llvm/unittests/CodeGen/MachineInstrTest.cpp
@@ -272,4 +272,6 @@ TEST(MachineInstrPrintingTest, DebugLocPrinting) {
StringRef(OS.str()).endswith("filename:1:5"));
}
+static_assert(is_trivially_copyable<MCOperand>::value, "trivially copyable");
+
} // end namespace
diff --git a/llvm/unittests/IR/CFGBuilder.cpp b/llvm/unittests/IR/CFGBuilder.cpp
index ca7a0555dd0..a2016f7e6cb 100644
--- a/llvm/unittests/IR/CFGBuilder.cpp
+++ b/llvm/unittests/IR/CFGBuilder.cpp
@@ -8,6 +8,7 @@
#include "CFGBuilder.h"
+#include "llvm/IR/CFG.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/Support/Debug.h"
@@ -265,3 +266,11 @@ TEST(CFGBuilder, Rebuild) {
EXPECT_TRUE(isa<SwitchInst>(B.getOrAddBlock("c")->getTerminator()));
EXPECT_TRUE(isa<SwitchInst>(B.getOrAddBlock("d")->getTerminator()));
}
+
+static_assert(is_trivially_copyable<succ_iterator>::value,
+ "trivially copyable");
+static_assert(is_trivially_copyable<succ_const_iterator>::value,
+ "trivially copyable");
+static_assert(is_trivially_copyable<succ_range>::value, "trivially copyable");
+static_assert(is_trivially_copyable<succ_const_range>::value,
+ "trivially copyable");
diff --git a/llvm/unittests/Support/ScaledNumberTest.cpp b/llvm/unittests/Support/ScaledNumberTest.cpp
index 449c0477b0a..3fa63b7bf3c 100644
--- a/llvm/unittests/Support/ScaledNumberTest.cpp
+++ b/llvm/unittests/Support/ScaledNumberTest.cpp
@@ -562,4 +562,7 @@ TEST(ScaledNumberHelpersTest, toIntBug) {
EXPECT_EQ(1u, (n * n).toInt<uint32_t>());
}
+static_assert(is_trivially_copyable<ScaledNumber<uint32_t>>::value,
+ "trivially copyable");
+
} // end namespace
OpenPOWER on IntegriCloud