diff --git a/clang/unittests/ASTMatchers/ASTMatchersInternalTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersInternalTest.cpp --- a/clang/unittests/ASTMatchers/ASTMatchersInternalTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersInternalTest.cpp @@ -22,6 +22,8 @@ #if GTEST_HAS_DEATH_TEST TEST(HasNameDeathTest, DiesOnEmptyName) { + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + ASSERT_DEBUG_DEATH({ DeclarationMatcher HasEmptyName = recordDecl(hasName("")); EXPECT_TRUE(notMatches("class X {};", HasEmptyName)); diff --git a/clang/unittests/ASTMatchers/Dynamic/VariantValueTest.cpp b/clang/unittests/ASTMatchers/Dynamic/VariantValueTest.cpp --- a/clang/unittests/ASTMatchers/Dynamic/VariantValueTest.cpp +++ b/clang/unittests/ASTMatchers/Dynamic/VariantValueTest.cpp @@ -164,6 +164,8 @@ .getMatcher() .hasTypedMatcher()); #if !defined(NDEBUG) && GTEST_HAS_DEATH_TEST + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + // Trying to get the wrong matcher fails an assertion in Matcher. We don't // do this test when building with MSVC because its debug C runtime prints the // assertion failure message as a wide string, which gtest doesn't understand. diff --git a/clang/unittests/Basic/FileManagerTest.cpp b/clang/unittests/Basic/FileManagerTest.cpp --- a/clang/unittests/Basic/FileManagerTest.cpp +++ b/clang/unittests/Basic/FileManagerTest.cpp @@ -291,6 +291,8 @@ EXPECT_EQ(&F1->getFileEntry(), &F1Alias2->getFileEntry()); #if !defined(NDEBUG) && GTEST_HAS_DEATH_TEST + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + EXPECT_DEATH((void)manager.getFileRef("dir/f1-alias-alias.cpp"), "filename redirected to a non-canonical filename?"); #endif diff --git a/clang/unittests/Basic/LineOffsetMappingTest.cpp b/clang/unittests/Basic/LineOffsetMappingTest.cpp --- a/clang/unittests/Basic/LineOffsetMappingTest.cpp +++ b/clang/unittests/Basic/LineOffsetMappingTest.cpp @@ -20,6 +20,8 @@ EXPECT_FALSE(Mapping); #if !defined(NDEBUG) && GTEST_HAS_DEATH_TEST + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + EXPECT_DEATH((void)Mapping.getLines(), "Storage"); #endif } @@ -34,6 +36,8 @@ EXPECT_EQ(20u, Mapping[2]); #if !defined(NDEBUG) && GTEST_HAS_DEATH_TEST + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + EXPECT_DEATH((void)Mapping[3], "Invalid index"); #endif } diff --git a/clang/unittests/Basic/SarifTest.cpp b/clang/unittests/Basic/SarifTest.cpp --- a/clang/unittests/Basic/SarifTest.cpp +++ b/clang/unittests/Basic/SarifTest.cpp @@ -129,6 +129,8 @@ #if defined(NDEBUG) || !GTEST_HAS_DEATH_TEST GTEST_SKIP() << "This death test is only available for debug builds."; #endif + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + // GIVEN: SarifDocumentWriter Writer{SourceMgr}; @@ -150,6 +152,8 @@ #if defined(NDEBUG) || !GTEST_HAS_DEATH_TEST GTEST_SKIP() << "This death test is only available for debug builds."; #endif + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + // GIVEN: SarifDocumentWriter Writer{SourceMgr}; @@ -169,6 +173,7 @@ #if defined(NDEBUG) || !GTEST_HAS_DEATH_TEST GTEST_SKIP() << "This death test is only available for debug builds."; #endif + testing::GTEST_FLAG(death_test_style) = "threadsafe"; // GIVEN: SarifDocumentWriter Writer{SourceMgr}; diff --git a/clang/unittests/Lex/LexerTest.cpp b/clang/unittests/Lex/LexerTest.cpp --- a/clang/unittests/Lex/LexerTest.cpp +++ b/clang/unittests/Lex/LexerTest.cpp @@ -485,6 +485,8 @@ EXPECT_EQ(tok::string_literal, Result.getKind()); EXPECT_STREQ("\"'C'\"", Result.getLiteralData()); #if !defined(NDEBUG) && GTEST_HAS_DEATH_TEST + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + EXPECT_DEATH(StringifyArg(3), "Invalid arg #"); #endif } diff --git a/clang/unittests/Serialization/InMemoryModuleCacheTest.cpp b/clang/unittests/Serialization/InMemoryModuleCacheTest.cpp --- a/clang/unittests/Serialization/InMemoryModuleCacheTest.cpp +++ b/clang/unittests/Serialization/InMemoryModuleCacheTest.cpp @@ -29,6 +29,8 @@ EXPECT_FALSE(Cache.shouldBuildPCM("B")); #if !defined(NDEBUG) && GTEST_HAS_DEATH_TEST + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + EXPECT_DEATH(Cache.tryToDropPCM("B"), "PCM to remove is unknown"); EXPECT_DEATH(Cache.finalizePCM("B"), "PCM to finalize is unknown"); #endif @@ -46,6 +48,8 @@ EXPECT_FALSE(Cache.shouldBuildPCM("B")); #if !defined(NDEBUG) && GTEST_HAS_DEATH_TEST + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + EXPECT_DEATH(Cache.addPCM("B", getBuffer(2)), "Already has a PCM"); EXPECT_DEATH(Cache.addBuiltPCM("B", getBuffer(2)), "Trying to override tentative PCM"); @@ -64,6 +68,8 @@ EXPECT_FALSE(Cache.shouldBuildPCM("B")); #if !defined(NDEBUG) && GTEST_HAS_DEATH_TEST + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + EXPECT_DEATH(Cache.addPCM("B", getBuffer(2)), "Already has a PCM"); EXPECT_DEATH(Cache.addBuiltPCM("B", getBuffer(2)), "Trying to override finalized PCM"); @@ -87,6 +93,8 @@ EXPECT_TRUE(Cache.shouldBuildPCM("B")); #if !defined(NDEBUG) && GTEST_HAS_DEATH_TEST + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + EXPECT_DEATH(Cache.addPCM("B", getBuffer(2)), "Already has a PCM"); EXPECT_DEATH(Cache.tryToDropPCM("B"), "PCM to remove is scheduled to be built"); diff --git a/clang/unittests/Tooling/TransformerTest.cpp b/clang/unittests/Tooling/TransformerTest.cpp --- a/clang/unittests/Tooling/TransformerTest.cpp +++ b/clang/unittests/Tooling/TransformerTest.cpp @@ -1593,6 +1593,8 @@ // Verifies that `Type` and `QualType` are not allowed as top-level matchers in // rules. TEST(TransformerDeathTest, OrderedRuleTypes) { + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + RewriteRule QualTypeRule = makeRule(qualType(), changeTo(cat("Q"))); EXPECT_DEATH(transformer::detail::buildMatchers(QualTypeRule), "Matcher must be.*node matcher"); diff --git a/llvm/unittests/ADT/APFloatTest.cpp b/llvm/unittests/ADT/APFloatTest.cpp --- a/llvm/unittests/ADT/APFloatTest.cpp +++ b/llvm/unittests/ADT/APFloatTest.cpp @@ -1361,6 +1361,8 @@ #ifdef GTEST_HAS_DEATH_TEST #ifndef NDEBUG TEST(APFloatTest, SemanticsDeath) { + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + EXPECT_DEATH(APFloat(APFloat::IEEEquad(), 0).convertToDouble(), "Float semantics is not representable by IEEEdouble"); EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), 0).convertToFloat(), diff --git a/llvm/unittests/ADT/APIntTest.cpp b/llvm/unittests/ADT/APIntTest.cpp --- a/llvm/unittests/ADT/APIntTest.cpp +++ b/llvm/unittests/ADT/APIntTest.cpp @@ -1431,6 +1431,8 @@ #ifdef GTEST_HAS_DEATH_TEST #ifndef NDEBUG TEST(APIntTest, StringDeath) { + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + EXPECT_DEATH((void)APInt(32, "", 0), "Invalid string length"); EXPECT_DEATH((void)APInt(32, "0", 0), "Radix should be 2, 8, 10, 16, or 36!"); EXPECT_DEATH((void)APInt(32, "", 10), "Invalid string length"); diff --git a/llvm/unittests/ADT/APSIntTest.cpp b/llvm/unittests/ADT/APSIntTest.cpp --- a/llvm/unittests/ADT/APSIntTest.cpp +++ b/llvm/unittests/ADT/APSIntTest.cpp @@ -193,6 +193,8 @@ #if defined(GTEST_HAS_DEATH_TEST) && !defined(NDEBUG) TEST(APSIntTest, StringDeath) { + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + EXPECT_DEATH((void)APSInt(""), "Invalid string length"); EXPECT_DEATH((void)APSInt("1a"), "Invalid character in digit string"); } diff --git a/llvm/unittests/ADT/AnyTest.cpp b/llvm/unittests/ADT/AnyTest.cpp --- a/llvm/unittests/ADT/AnyTest.cpp +++ b/llvm/unittests/ADT/AnyTest.cpp @@ -160,6 +160,8 @@ llvm::Any D{'x'}; #if !defined(NDEBUG) && GTEST_HAS_DEATH_TEST + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + EXPECT_DEATH(llvm::any_cast(A), ""); EXPECT_DEATH(llvm::any_cast(B), ""); diff --git a/llvm/unittests/ADT/BumpPtrListTest.cpp b/llvm/unittests/ADT/BumpPtrListTest.cpp --- a/llvm/unittests/ADT/BumpPtrListTest.cpp +++ b/llvm/unittests/ADT/BumpPtrListTest.cpp @@ -235,6 +235,8 @@ // Resetting a non-empty list should crash. L.push_back(5); #if defined(GTEST_HAS_DEATH_TEST) && !defined(NDEBUG) + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + EXPECT_DEATH(L.resetAlloc(), "Cannot reset allocator if not empty"); #endif } diff --git a/llvm/unittests/ADT/IteratorTest.cpp b/llvm/unittests/ADT/IteratorTest.cpp --- a/llvm/unittests/ADT/IteratorTest.cpp +++ b/llvm/unittests/ADT/IteratorTest.cpp @@ -566,6 +566,8 @@ #if !defined(NDEBUG) && GTEST_HAS_DEATH_TEST // Make sure that we can detect when the first range is not the shortest. TEST(ZipIteratorTest, ZipFirstNotShortest) { + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + const std::array longer = {}; const std::array shorter = {}; diff --git a/llvm/unittests/ADT/STLExtrasTest.cpp b/llvm/unittests/ADT/STLExtrasTest.cpp --- a/llvm/unittests/ADT/STLExtrasTest.cpp +++ b/llvm/unittests/ADT/STLExtrasTest.cpp @@ -269,6 +269,8 @@ #if defined(GTEST_HAS_DEATH_TEST) && !defined(NDEBUG) TEST(STLExtrasTest, EnumerateDifferentLengths) { + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + std::vector Ints = {0, 1}; bool Bools[] = {true, false, true}; std::string Chars = "abc"; diff --git a/llvm/unittests/ADT/SequenceTest.cpp b/llvm/unittests/ADT/SequenceTest.cpp --- a/llvm/unittests/ADT/SequenceTest.cpp +++ b/llvm/unittests/ADT/SequenceTest.cpp @@ -72,6 +72,8 @@ #if defined(GTEST_HAS_DEATH_TEST) && !defined(NDEBUG) TEST(StrongIntDeathTest, OutOfBounds) { + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + // Values above 'INTMAX_MAX' are not representable. EXPECT_DEATH(CheckedInt::from(INTMAX_MAX + 1ULL), "Out of bounds"); EXPECT_DEATH(CheckedInt::from(UINTMAX_MAX), "Out of bounds"); diff --git a/llvm/unittests/ADT/SmallVectorTest.cpp b/llvm/unittests/ADT/SmallVectorTest.cpp --- a/llvm/unittests/ADT/SmallVectorTest.cpp +++ b/llvm/unittests/ADT/SmallVectorTest.cpp @@ -360,6 +360,8 @@ EXPECT_EQ(5, Constructable::getNumDestructorCalls()); #if !defined(NDEBUG) && GTEST_HAS_DEATH_TEST + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + EXPECT_DEATH(V.truncate(2), "Cannot increase size"); #endif V.truncate(1); @@ -1340,6 +1342,8 @@ auto &V = this->V; (void)V; #if !defined(NDEBUG) && GTEST_HAS_DEATH_TEST + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + EXPECT_DEATH(V.append(V.begin(), V.begin() + 1), this->AssertionMessage); ASSERT_EQ(3u, NumBuiltinElts(V)); @@ -1394,6 +1398,8 @@ TYPED_TEST(SmallVectorReferenceInvalidationTest, AssignRange) { auto &V = this->V; #if !defined(NDEBUG) && GTEST_HAS_DEATH_TEST + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + EXPECT_DEATH(V.assign(V.begin(), V.end()), this->AssertionMessage); EXPECT_DEATH(V.assign(V.begin(), V.end() - 1), this->AssertionMessage); #endif @@ -1474,6 +1480,8 @@ auto &V = this->V; (void)V; #if !defined(NDEBUG) && GTEST_HAS_DEATH_TEST + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + EXPECT_DEATH(V.insert(V.begin(), V.begin(), V.begin() + 1), this->AssertionMessage); diff --git a/llvm/unittests/AsmParser/AsmParserTest.cpp b/llvm/unittests/AsmParser/AsmParserTest.cpp --- a/llvm/unittests/AsmParser/AsmParserTest.cpp +++ b/llvm/unittests/AsmParser/AsmParserTest.cpp @@ -35,6 +35,8 @@ #ifndef NDEBUG TEST(AsmParserTest, NonNullTerminatedInput) { + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + LLVMContext Ctx; StringRef Source = "; Empty module \n\1\2"; SMDiagnostic Error; diff --git a/llvm/unittests/BinaryFormat/MsgPackWriterTest.cpp b/llvm/unittests/BinaryFormat/MsgPackWriterTest.cpp --- a/llvm/unittests/BinaryFormat/MsgPackWriterTest.cpp +++ b/llvm/unittests/BinaryFormat/MsgPackWriterTest.cpp @@ -516,6 +516,8 @@ #ifdef GTEST_HAS_DEATH_TEST #ifndef NDEBUG + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + EXPECT_DEATH(CompatWriter.write(MemoryBufferRef(s, "")), "compatible mode"); #endif #endif diff --git a/llvm/unittests/CodeGen/GlobalISel/MachineIRBuilderTest.cpp b/llvm/unittests/CodeGen/GlobalISel/MachineIRBuilderTest.cpp --- a/llvm/unittests/CodeGen/GlobalISel/MachineIRBuilderTest.cpp +++ b/llvm/unittests/CodeGen/GlobalISel/MachineIRBuilderTest.cpp @@ -41,6 +41,8 @@ #ifndef NDEBUG TEST_F(AArch64GISelMITest, TestBuildConstantFConstantDeath) { + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + setUp(); if (!TM) GTEST_SKIP(); diff --git a/llvm/unittests/CodeGen/LowLevelTypeTest.cpp b/llvm/unittests/CodeGen/LowLevelTypeTest.cpp --- a/llvm/unittests/CodeGen/LowLevelTypeTest.cpp +++ b/llvm/unittests/CodeGen/LowLevelTypeTest.cpp @@ -222,6 +222,8 @@ // Invalid to directly change the element size for pointers. TEST(LowLevelTypeTest, ChangeElementTypeDeath) { + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + const LLT P0 = LLT::pointer(0, 32); const LLT V2P0 = LLT::fixed_vector(2, P0); diff --git a/llvm/unittests/CodeGen/MachineInstrBundleIteratorTest.cpp b/llvm/unittests/CodeGen/MachineInstrBundleIteratorTest.cpp --- a/llvm/unittests/CodeGen/MachineInstrBundleIteratorTest.cpp +++ b/llvm/unittests/CodeGen/MachineInstrBundleIteratorTest.cpp @@ -29,6 +29,8 @@ #ifdef GTEST_HAS_DEATH_TEST #ifndef NDEBUG TEST(MachineInstrBundleIteratorTest, CheckForBundles) { + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + MyBundledInstr MBI; auto I = MBI.getIterator(); auto RI = I.getReverse(); diff --git a/llvm/unittests/FileCheck/FileCheckTest.cpp b/llvm/unittests/FileCheck/FileCheckTest.cpp --- a/llvm/unittests/FileCheck/FileCheckTest.cpp +++ b/llvm/unittests/FileCheck/FileCheckTest.cpp @@ -1647,6 +1647,8 @@ ASSERT_THAT_ERROR(std::move(Res.TheError), Succeeded()); #ifndef NDEBUG + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + // Recreating @LINE pseudo numeric variable fails. EXPECT_DEATH(Cxt.createLineVariable(), "@LINE pseudo numeric variable already created"); diff --git a/llvm/unittests/IR/ConstantsTest.cpp b/llvm/unittests/IR/ConstantsTest.cpp --- a/llvm/unittests/IR/ConstantsTest.cpp +++ b/llvm/unittests/IR/ConstantsTest.cpp @@ -300,6 +300,8 @@ #ifdef GTEST_HAS_DEATH_TEST #ifndef NDEBUG TEST(ConstantsTest, ReplaceWithConstantTest) { + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + LLVMContext Context; std::unique_ptr M(new Module("MyModule", Context)); diff --git a/llvm/unittests/IR/MetadataTest.cpp b/llvm/unittests/IR/MetadataTest.cpp --- a/llvm/unittests/IR/MetadataTest.cpp +++ b/llvm/unittests/IR/MetadataTest.cpp @@ -4036,6 +4036,8 @@ // leading to infinite loops. #if defined(GTEST_HAS_DEATH_TEST) && !defined(NDEBUG) && !defined(GTEST_HAS_SEH) TEST_F(DistinctMDOperandPlaceholderTest, MetadataAsValue) { + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + // This shouldn't crash. DistinctMDOperandPlaceholder PH(7); EXPECT_DEATH(MetadataAsValue::get(Context, &PH), @@ -4043,12 +4045,16 @@ } TEST_F(DistinctMDOperandPlaceholderTest, UniquedMDNode) { + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + // This shouldn't crash. DistinctMDOperandPlaceholder PH(7); EXPECT_DEATH(MDTuple::get(Context, &PH), "Unexpected callback to owner"); } TEST_F(DistinctMDOperandPlaceholderTest, SecondDistinctMDNode) { + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + // This shouldn't crash. DistinctMDOperandPlaceholder PH(7); MDTuple::getDistinct(Context, &PH); @@ -4057,6 +4063,8 @@ } TEST_F(DistinctMDOperandPlaceholderTest, TrackingMDRefAndDistinctMDNode) { + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + // TrackingMDRef doesn't install an owner callback, so it can't be detected // as an invalid use. However, using a placeholder in a TrackingMDRef *and* // a distinct node isn't possible and we should assert. @@ -4249,6 +4257,8 @@ #if defined(GTEST_HAS_DEATH_TEST) && !defined(NDEBUG) && !defined(GTEST_HAS_SEH) typedef MetadataTest MDTupleAllocationDeathTest; TEST_F(MDTupleAllocationDeathTest, ResizeRejected) { + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + MDTuple *A = MDTuple::get(Context, None); auto *Value1 = getConstantAsMetadata(); EXPECT_DEATH(A->push_back(Value1), diff --git a/llvm/unittests/IR/ValueHandleTest.cpp b/llvm/unittests/IR/ValueHandleTest.cpp --- a/llvm/unittests/IR/ValueHandleTest.cpp +++ b/llvm/unittests/IR/ValueHandleTest.cpp @@ -191,6 +191,8 @@ #ifdef GTEST_HAS_DEATH_TEST TEST_F(ValueHandle, AssertingVH_Asserts) { + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + AssertingVH AVH(BitcastV.get()); EXPECT_DEATH({BitcastV.reset();}, "An asserting value handle still pointed to this value!"); @@ -533,6 +535,8 @@ #if LLVM_ENABLE_ABI_BREAKING_CHECKS TEST_F(ValueHandle, PoisoningVH_Asserts) { + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + PoisoningVH VH(BitcastV.get()); // The poisoned handle shouldn't assert when the value is deleted. @@ -553,6 +557,8 @@ #endif // LLVM_ENABLE_ABI_BREAKING_CHECKS TEST_F(ValueHandle, TrackingVH_Asserts) { + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + { TrackingVH VH(BitcastV.get()); diff --git a/llvm/unittests/IR/ValueTest.cpp b/llvm/unittests/IR/ValueTest.cpp --- a/llvm/unittests/IR/ValueTest.cpp +++ b/llvm/unittests/IR/ValueTest.cpp @@ -95,6 +95,8 @@ #ifndef NDEBUG TEST(GlobalTest, AlignDeath) { + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + LLVMContext Ctx; std::unique_ptr M(new Module("TestModule", Ctx)); Type *Int32Ty = Type::getInt32Ty(Ctx); diff --git a/llvm/unittests/Support/DataExtractorTest.cpp b/llvm/unittests/Support/DataExtractorTest.cpp --- a/llvm/unittests/Support/DataExtractorTest.cpp +++ b/llvm/unittests/Support/DataExtractorTest.cpp @@ -229,6 +229,8 @@ #if defined(GTEST_HAS_DEATH_TEST) && defined(_DEBUG) && \ LLVM_ENABLE_ABI_BREAKING_CHECKS TEST(DataExtractorDeathTest, Cursor) { + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + DataExtractor DE(StringRef("AB"), false, 8); // Even an unused cursor must be checked for errors: diff --git a/llvm/unittests/Support/ErrorTest.cpp b/llvm/unittests/Support/ErrorTest.cpp --- a/llvm/unittests/Support/ErrorTest.cpp +++ b/llvm/unittests/Support/ErrorTest.cpp @@ -923,6 +923,8 @@ TEST(Error, FileErrorTest) { #if !defined(NDEBUG) && GTEST_HAS_DEATH_TEST + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + EXPECT_DEATH( { Error S = Error::success(); diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp --- a/llvm/unittests/Support/Path.cpp +++ b/llvm/unittests/Support/Path.cpp @@ -1429,6 +1429,8 @@ MaybeMFR = std::move(mfr); EXPECT_FALSE(mfr); #if !defined(NDEBUG) && GTEST_HAS_DEATH_TEST + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + EXPECT_DEATH(mfr.data(), "Mapping failed but used anyway!"); EXPECT_DEATH(mfr.size(), "Mapping failed but used anyway!"); #endif diff --git a/llvm/unittests/Support/YAMLIOTest.cpp b/llvm/unittests/Support/YAMLIOTest.cpp --- a/llvm/unittests/Support/YAMLIOTest.cpp +++ b/llvm/unittests/Support/YAMLIOTest.cpp @@ -3064,6 +3064,8 @@ Output yout(ostr); #ifdef GTEST_HAS_DEATH_TEST #ifndef NDEBUG + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + EXPECT_DEATH(yout << node, "plain scalar documents are not supported"); #endif #endif diff --git a/llvm/unittests/Support/raw_pwrite_stream_test.cpp b/llvm/unittests/Support/raw_pwrite_stream_test.cpp --- a/llvm/unittests/Support/raw_pwrite_stream_test.cpp +++ b/llvm/unittests/Support/raw_pwrite_stream_test.cpp @@ -38,6 +38,8 @@ #ifdef GTEST_HAS_DEATH_TEST #ifndef NDEBUG + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + EXPECT_DEATH(OS.pwrite("12345", 5, 0), "We don't support extending the stream"); #endif @@ -74,6 +76,8 @@ #ifdef GTEST_HAS_DEATH_TEST #ifndef NDEBUG + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + EXPECT_DEATH(OS.pwrite("12345", 5, 0), "We don't support extending the stream"); #endif diff --git a/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp b/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp --- a/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp +++ b/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp @@ -265,6 +265,8 @@ #ifdef GTEST_HAS_DEATH_TEST #ifndef NDEBUG TEST(ValueMapperTest, mapMetadataLocalAsMetadata) { + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + LLVMContext C; FunctionType *FTy = FunctionType::get(Type::getVoidTy(C), Type::getInt8Ty(C), false);