diff options
author | Kazu Hirata <kazu@google.com> | 2025-05-22 12:44:20 -0700 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2025-05-22 12:44:20 -0700 |
commit | e2a885537f11f8d9ced1c80c2c90069ab5adeb1d (patch) | |
tree | d838fa124762f02c1b2ce921f667beb29acfee7b /clang/unittests/Basic | |
parent | e23a6921b47d2cfb4d27289149079e9d77aa0560 (diff) | |
download | llvm-e2a885537f11f8d9ced1c80c2c90069ab5adeb1d.zip llvm-e2a885537f11f8d9ced1c80c2c90069ab5adeb1d.tar.gz llvm-e2a885537f11f8d9ced1c80c2c90069ab5adeb1d.tar.bz2 |
Revert "[clang] Remove intrusive reference count from `DiagnosticOptions` (#139584)"
This reverts commit 9e306ad4600c4d3392c194a8be88919ee758425c.
Multiple builtbot failures have been reported:
https://github.com/llvm/llvm-project/pull/139584
Diffstat (limited to 'clang/unittests/Basic')
-rw-r--r-- | clang/unittests/Basic/DiagnosticTest.cpp | 23 | ||||
-rw-r--r-- | clang/unittests/Basic/SarifTest.cpp | 6 | ||||
-rw-r--r-- | clang/unittests/Basic/SourceManagerTest.cpp | 9 |
3 files changed, 17 insertions, 21 deletions
diff --git a/clang/unittests/Basic/DiagnosticTest.cpp b/clang/unittests/Basic/DiagnosticTest.cpp index b0a034e..88fa180 100644 --- a/clang/unittests/Basic/DiagnosticTest.cpp +++ b/clang/unittests/Basic/DiagnosticTest.cpp @@ -46,8 +46,8 @@ using testing::IsEmpty; // Check that DiagnosticErrorTrap works with SuppressAllDiagnostics. TEST(DiagnosticTest, suppressAndTrap) { - DiagnosticOptions DiagOpts; - DiagnosticsEngine Diags(new DiagnosticIDs(), DiagOpts, + DiagnosticsEngine Diags(new DiagnosticIDs(), + new DiagnosticOptions, new IgnoringDiagConsumer()); Diags.setSuppressAllDiagnostics(true); @@ -77,8 +77,8 @@ TEST(DiagnosticTest, suppressAndTrap) { // Check that FatalsAsError works as intended TEST(DiagnosticTest, fatalsAsError) { for (unsigned FatalsAsError = 0; FatalsAsError != 2; ++FatalsAsError) { - DiagnosticOptions DiagOpts; - DiagnosticsEngine Diags(new DiagnosticIDs(), DiagOpts, + DiagnosticsEngine Diags(new DiagnosticIDs(), + new DiagnosticOptions, new IgnoringDiagConsumer()); Diags.setFatalsAsError(FatalsAsError); @@ -101,8 +101,7 @@ TEST(DiagnosticTest, fatalsAsError) { } TEST(DiagnosticTest, tooManyErrorsIsAlwaysFatal) { - DiagnosticOptions DiagOpts; - DiagnosticsEngine Diags(new DiagnosticIDs(), DiagOpts, + DiagnosticsEngine Diags(new DiagnosticIDs(), new DiagnosticOptions, new IgnoringDiagConsumer()); Diags.setFatalsAsError(true); @@ -118,8 +117,7 @@ TEST(DiagnosticTest, tooManyErrorsIsAlwaysFatal) { // Check that soft RESET works as intended TEST(DiagnosticTest, softReset) { - DiagnosticOptions DiagOpts; - DiagnosticsEngine Diags(new DiagnosticIDs(), DiagOpts, + DiagnosticsEngine Diags(new DiagnosticIDs(), new DiagnosticOptions, new IgnoringDiagConsumer()); unsigned numWarnings = 0U, numErrors = 0U; @@ -142,8 +140,7 @@ TEST(DiagnosticTest, softReset) { } TEST(DiagnosticTest, diagnosticError) { - DiagnosticOptions DiagOpts; - DiagnosticsEngine Diags(new DiagnosticIDs(), DiagOpts, + DiagnosticsEngine Diags(new DiagnosticIDs(), new DiagnosticOptions, new IgnoringDiagConsumer()); PartialDiagnostic::DiagStorageAllocator Alloc; llvm::Expected<std::pair<int, int>> Value = DiagnosticError::create( @@ -165,8 +162,7 @@ TEST(DiagnosticTest, diagnosticError) { } TEST(DiagnosticTest, storedDiagEmptyWarning) { - DiagnosticOptions DiagOpts; - DiagnosticsEngine Diags(new DiagnosticIDs(), DiagOpts); + DiagnosticsEngine Diags(new DiagnosticIDs(), new DiagnosticOptions); class CaptureDiagnosticConsumer : public DiagnosticConsumer { public: @@ -196,8 +192,7 @@ public: protected: llvm::IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> FS = llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>(); - DiagnosticOptions DiagOpts; - DiagnosticsEngine Diags{new DiagnosticIDs(), DiagOpts}; + DiagnosticsEngine Diags{new DiagnosticIDs(), new DiagnosticOptions}; llvm::ArrayRef<StoredDiagnostic> diags() { return CaptureConsumer.StoredDiags; diff --git a/clang/unittests/Basic/SarifTest.cpp b/clang/unittests/Basic/SarifTest.cpp index ad9f8ec..febfbab 100644 --- a/clang/unittests/Basic/SarifTest.cpp +++ b/clang/unittests/Basic/SarifTest.cpp @@ -43,14 +43,14 @@ protected: SarifDocumentWriterTest() : InMemoryFileSystem(new llvm::vfs::InMemoryFileSystem), FileMgr(FileSystemOptions(), InMemoryFileSystem), - DiagID(new DiagnosticIDs()), - Diags(DiagID, DiagOpts, new IgnoringDiagConsumer()), + DiagID(new DiagnosticIDs()), DiagOpts(new DiagnosticOptions()), + Diags(DiagID, DiagOpts.get(), new IgnoringDiagConsumer()), SourceMgr(Diags, FileMgr) {} IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem; FileManager FileMgr; IntrusiveRefCntPtr<DiagnosticIDs> DiagID; - DiagnosticOptions DiagOpts; + IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts; DiagnosticsEngine Diags; SourceManager SourceMgr; LangOptions LangOpts; diff --git a/clang/unittests/Basic/SourceManagerTest.cpp b/clang/unittests/Basic/SourceManagerTest.cpp index cbe047b..1f0986f 100644 --- a/clang/unittests/Basic/SourceManagerTest.cpp +++ b/clang/unittests/Basic/SourceManagerTest.cpp @@ -40,9 +40,11 @@ namespace { class SourceManagerTest : public ::testing::Test { protected: SourceManagerTest() - : FileMgr(FileMgrOpts), DiagID(new DiagnosticIDs()), - Diags(DiagID, DiagOpts, new IgnoringDiagConsumer()), - SourceMgr(Diags, FileMgr), TargetOpts(new TargetOptions) { + : FileMgr(FileMgrOpts), + DiagID(new DiagnosticIDs()), + Diags(DiagID, new DiagnosticOptions, new IgnoringDiagConsumer()), + SourceMgr(Diags, FileMgr), + TargetOpts(new TargetOptions) { TargetOpts->Triple = "x86_64-apple-darwin11.1.0"; Target = TargetInfo::CreateTargetInfo(Diags, *TargetOpts); } @@ -50,7 +52,6 @@ protected: FileSystemOptions FileMgrOpts; FileManager FileMgr; IntrusiveRefCntPtr<DiagnosticIDs> DiagID; - DiagnosticOptions DiagOpts; DiagnosticsEngine Diags; SourceManager SourceMgr; LangOptions LangOpts; |