Bug 1890887 - Revert more patches that conflict with previous reverts. r=firefox-build-system-reviewers,sergesanspaille

Differential Revision: https://phabricator.services.mozilla.com/D207220
This commit is contained in:
Mike Hommey 2024-04-15 20:50:05 +00:00
parent 5a271ec6cf
commit f9c7fc80a0
4 changed files with 3001 additions and 0 deletions

View File

@ -1,5 +1,8 @@
{
"patches": [
"revert-llvmorg-19-init-7807-gf04452de1986.patch",
"revert-llvmorg-19-init-7619-gf139387fb6e7.patch",
"revert-llvmorg-19-init-7501-g27b2d7d4bb79.patch",
"revert-llvmorg-19-init-7044-g30fd099d5062.patch",
"revert-llvmorg-19-init-6902-gbdb60e6f0c8e.patch",
"revert-llvmorg-19-init-6898-g60deb8b39afe.patch",

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,29 @@
From ac70c3cfc46e04a6658550e4aa5620a332741f5f Mon Sep 17 00:00:00 2001
From: Mike Hommey <mh@glandium.org>
Date: Thu, 11 Apr 2024 08:56:28 +0900
Subject: [PATCH 1/3] Revert "Fix MSVC "not all control paths return a value"
warning. NFC."
This reverts commit f139387fb6e76a5249e8d7c2d124565e6b566ef4.
---
clang/lib/InstallAPI/DiagnosticBuilderWrappers.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/clang/lib/InstallAPI/DiagnosticBuilderWrappers.cpp b/clang/lib/InstallAPI/DiagnosticBuilderWrappers.cpp
index cc252d51e3b6..1fa988f93bdd 100644
--- a/clang/lib/InstallAPI/DiagnosticBuilderWrappers.cpp
+++ b/clang/lib/InstallAPI/DiagnosticBuilderWrappers.cpp
@@ -81,9 +81,8 @@ const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
return DB;
case FileType::Invalid:
case FileType::All:
- break;
+ llvm_unreachable("Unexpected file type for diagnostics.");
}
- llvm_unreachable("Unexpected file type for diagnostics.");
}
const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
--
2.44.0.1.g9765aa7075

View File

@ -0,0 +1,273 @@
From 74e0d23a9f7523db759e26462c2dd721ababff48 Mon Sep 17 00:00:00 2001
From: Mike Hommey <mh@glandium.org>
Date: Thu, 11 Apr 2024 08:57:06 +0900
Subject: [PATCH 2/3] Revert "[InstallAPI] Tie lifetime of FE objects to
DylibVerifier (#88189)"
This reverts commit f04452de1986e4e01296a80231efb212d6c84c42.
---
.../include/clang/InstallAPI/DylibVerifier.h | 10 ++--
clang/include/clang/InstallAPI/Frontend.h | 2 +-
.../clang/InstallAPI/FrontendRecords.h | 1 -
clang/lib/InstallAPI/DylibVerifier.cpp | 47 ++++++++++---------
clang/lib/InstallAPI/Frontend.cpp | 15 +++---
.../clang-installapi/ClangInstallAPI.cpp | 2 -
6 files changed, 37 insertions(+), 40 deletions(-)
diff --git a/clang/include/clang/InstallAPI/DylibVerifier.h b/clang/include/clang/InstallAPI/DylibVerifier.h
index a3df25f10de4..07dbd3bf5f2b 100644
--- a/clang/include/clang/InstallAPI/DylibVerifier.h
+++ b/clang/include/clang/InstallAPI/DylibVerifier.h
@@ -10,7 +10,6 @@
#define LLVM_CLANG_INSTALLAPI_DYLIBVERIFIER_H
#include "clang/Basic/Diagnostic.h"
-#include "clang/Basic/SourceManager.h"
#include "clang/InstallAPI/MachO.h"
namespace clang {
@@ -100,7 +99,11 @@ public:
Result getState() const { return Ctx.FrontendState; }
/// Set different source managers to the same diagnostics engine.
- void setSourceManager(IntrusiveRefCntPtr<SourceManager> SourceMgr);
+ void setSourceManager(SourceManager &SourceMgr) const {
+ if (!Ctx.Diag)
+ return;
+ Ctx.Diag->setSourceManager(&SourceMgr);
+ }
private:
/// Determine whether to compare declaration to symbol in binary.
@@ -187,9 +190,6 @@ private:
// Track DWARF provided source location for dylibs.
DWARFContext *DWARFCtx = nullptr;
-
- // Source manager for each unique compiler instance.
- llvm::SmallVector<IntrusiveRefCntPtr<SourceManager>, 12> SourceManagers;
};
} // namespace installapi
diff --git a/clang/include/clang/InstallAPI/Frontend.h b/clang/include/clang/InstallAPI/Frontend.h
index bc4e77de2b72..5cccd891c580 100644
--- a/clang/include/clang/InstallAPI/Frontend.h
+++ b/clang/include/clang/InstallAPI/Frontend.h
@@ -36,7 +36,7 @@ public:
std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
StringRef InFile) override {
Ctx.Diags->getClient()->BeginSourceFile(CI.getLangOpts());
- Ctx.Verifier->setSourceManager(CI.getSourceManagerPtr());
+ Ctx.Verifier->setSourceManager(CI.getSourceManager());
return std::make_unique<InstallAPIVisitor>(
CI.getASTContext(), Ctx, CI.getSourceManager(), CI.getPreprocessor());
}
diff --git a/clang/include/clang/InstallAPI/FrontendRecords.h b/clang/include/clang/InstallAPI/FrontendRecords.h
index ef82398addd7..59271e81e230 100644
--- a/clang/include/clang/InstallAPI/FrontendRecords.h
+++ b/clang/include/clang/InstallAPI/FrontendRecords.h
@@ -21,7 +21,6 @@ namespace installapi {
struct FrontendAttrs {
const AvailabilityInfo Avail;
const Decl *D;
- const SourceLocation Loc;
const HeaderType Access;
};
diff --git a/clang/lib/InstallAPI/DylibVerifier.cpp b/clang/lib/InstallAPI/DylibVerifier.cpp
index 4fa2d4e9292c..2387ee0e78ad 100644
--- a/clang/lib/InstallAPI/DylibVerifier.cpp
+++ b/clang/lib/InstallAPI/DylibVerifier.cpp
@@ -214,16 +214,16 @@ bool DylibVerifier::compareObjCInterfaceSymbols(const Record *R,
StringRef SymName, bool PrintAsWarning = false) {
if (SymLinkage == RecordLinkage::Unknown)
Ctx.emitDiag([&]() {
- Ctx.Diag->Report(SymCtx.FA->Loc, PrintAsWarning
- ? diag::warn_library_missing_symbol
- : diag::err_library_missing_symbol)
+ Ctx.Diag->Report(SymCtx.FA->D->getLocation(),
+ PrintAsWarning ? diag::warn_library_missing_symbol
+ : diag::err_library_missing_symbol)
<< SymName;
});
else
Ctx.emitDiag([&]() {
- Ctx.Diag->Report(SymCtx.FA->Loc, PrintAsWarning
- ? diag::warn_library_hidden_symbol
- : diag::err_library_hidden_symbol)
+ Ctx.Diag->Report(SymCtx.FA->D->getLocation(),
+ PrintAsWarning ? diag::warn_library_hidden_symbol
+ : diag::err_library_hidden_symbol)
<< SymName;
});
};
@@ -270,14 +270,16 @@ DylibVerifier::Result DylibVerifier::compareVisibility(const Record *R,
if (R->isExported()) {
if (!DR) {
Ctx.emitDiag([&]() {
- Ctx.Diag->Report(SymCtx.FA->Loc, diag::err_library_missing_symbol)
+ Ctx.Diag->Report(SymCtx.FA->D->getLocation(),
+ diag::err_library_missing_symbol)
<< getAnnotatedName(R, SymCtx);
});
return Result::Invalid;
}
if (DR->isInternal()) {
Ctx.emitDiag([&]() {
- Ctx.Diag->Report(SymCtx.FA->Loc, diag::err_library_hidden_symbol)
+ Ctx.Diag->Report(SymCtx.FA->D->getLocation(),
+ diag::err_library_hidden_symbol)
<< getAnnotatedName(R, SymCtx);
});
return Result::Invalid;
@@ -304,7 +306,8 @@ DylibVerifier::Result DylibVerifier::compareVisibility(const Record *R,
Outcome = Result::Invalid;
}
Ctx.emitDiag([&]() {
- Ctx.Diag->Report(SymCtx.FA->Loc, ID) << getAnnotatedName(R, SymCtx);
+ Ctx.Diag->Report(SymCtx.FA->D->getLocation(), ID)
+ << getAnnotatedName(R, SymCtx);
});
return Outcome;
}
@@ -326,13 +329,15 @@ DylibVerifier::Result DylibVerifier::compareAvailability(const Record *R,
switch (Mode) {
case VerificationMode::ErrorsAndWarnings:
Ctx.emitDiag([&]() {
- Ctx.Diag->Report(SymCtx.FA->Loc, diag::warn_header_availability_mismatch)
+ Ctx.Diag->Report(SymCtx.FA->D->getLocation(),
+ diag::warn_header_availability_mismatch)
<< getAnnotatedName(R, SymCtx) << IsDeclAvailable << IsDeclAvailable;
});
return Result::Ignore;
case VerificationMode::Pedantic:
Ctx.emitDiag([&]() {
- Ctx.Diag->Report(SymCtx.FA->Loc, diag::err_header_availability_mismatch)
+ Ctx.Diag->Report(SymCtx.FA->D->getLocation(),
+ diag::err_header_availability_mismatch)
<< getAnnotatedName(R, SymCtx) << IsDeclAvailable << IsDeclAvailable;
});
return Result::Invalid;
@@ -348,14 +353,16 @@ bool DylibVerifier::compareSymbolFlags(const Record *R, SymbolContext &SymCtx,
const Record *DR) {
if (DR->isThreadLocalValue() && !R->isThreadLocalValue()) {
Ctx.emitDiag([&]() {
- Ctx.Diag->Report(SymCtx.FA->Loc, diag::err_dylib_symbol_flags_mismatch)
+ Ctx.Diag->Report(SymCtx.FA->D->getLocation(),
+ diag::err_dylib_symbol_flags_mismatch)
<< getAnnotatedName(DR, SymCtx) << DR->isThreadLocalValue();
});
return false;
}
if (!DR->isThreadLocalValue() && R->isThreadLocalValue()) {
Ctx.emitDiag([&]() {
- Ctx.Diag->Report(SymCtx.FA->Loc, diag::err_header_symbol_flags_mismatch)
+ Ctx.Diag->Report(SymCtx.FA->D->getLocation(),
+ diag::err_header_symbol_flags_mismatch)
<< getAnnotatedName(R, SymCtx) << R->isThreadLocalValue();
});
return false;
@@ -363,14 +370,16 @@ bool DylibVerifier::compareSymbolFlags(const Record *R, SymbolContext &SymCtx,
if (DR->isWeakDefined() && !R->isWeakDefined()) {
Ctx.emitDiag([&]() {
- Ctx.Diag->Report(SymCtx.FA->Loc, diag::err_dylib_symbol_flags_mismatch)
+ Ctx.Diag->Report(SymCtx.FA->D->getLocation(),
+ diag::err_dylib_symbol_flags_mismatch)
<< getAnnotatedName(DR, SymCtx) << R->isWeakDefined();
});
return false;
}
if (!DR->isWeakDefined() && R->isWeakDefined()) {
Ctx.emitDiag([&]() {
- Ctx.Diag->Report(SymCtx.FA->Loc, diag::err_header_symbol_flags_mismatch)
+ Ctx.Diag->Report(SymCtx.FA->D->getLocation(),
+ diag::err_header_symbol_flags_mismatch)
<< getAnnotatedName(R, SymCtx) << R->isWeakDefined();
});
return false;
@@ -478,14 +487,6 @@ void DylibVerifier::setTarget(const Target &T) {
assignSlice(T);
}
-void DylibVerifier::setSourceManager(
- IntrusiveRefCntPtr<SourceManager> SourceMgr) {
- if (!Ctx.Diag)
- return;
- SourceManagers.push_back(std::move(SourceMgr));
- Ctx.Diag->setSourceManager(SourceManagers.back().get());
-}
-
DylibVerifier::Result DylibVerifier::verify(ObjCIVarRecord *R,
const FrontendAttrs *FA,
const StringRef SuperClass) {
diff --git a/clang/lib/InstallAPI/Frontend.cpp b/clang/lib/InstallAPI/Frontend.cpp
index 04d06f46d265..bd7589c13e04 100644
--- a/clang/lib/InstallAPI/Frontend.cpp
+++ b/clang/lib/InstallAPI/Frontend.cpp
@@ -23,8 +23,7 @@ std::pair<GlobalRecord *, FrontendAttrs *> FrontendRecordsSlice::addGlobal(
GlobalRecord *GR =
llvm::MachO::RecordsSlice::addGlobal(Name, Linkage, GV, Flags, Inlined);
- auto Result = FrontendRecords.insert(
- {GR, FrontendAttrs{Avail, D, D->getLocation(), Access}});
+ auto Result = FrontendRecords.insert({GR, FrontendAttrs{Avail, D, Access}});
return {GR, &(Result.first->second)};
}
@@ -40,8 +39,8 @@ FrontendRecordsSlice::addObjCInterface(StringRef Name, RecordLinkage Linkage,
ObjCInterfaceRecord *ObjCR =
llvm::MachO::RecordsSlice::addObjCInterface(Name, Linkage, SymType);
- auto Result = FrontendRecords.insert(
- {ObjCR, FrontendAttrs{Avail, D, D->getLocation(), Access}});
+ auto Result =
+ FrontendRecords.insert({ObjCR, FrontendAttrs{Avail, D, Access}});
return {ObjCR, &(Result.first->second)};
}
@@ -52,8 +51,8 @@ FrontendRecordsSlice::addObjCCategory(StringRef ClassToExtend,
const Decl *D, HeaderType Access) {
ObjCCategoryRecord *ObjCR =
llvm::MachO::RecordsSlice::addObjCCategory(ClassToExtend, CategoryName);
- auto Result = FrontendRecords.insert(
- {ObjCR, FrontendAttrs{Avail, D, D->getLocation(), Access}});
+ auto Result =
+ FrontendRecords.insert({ObjCR, FrontendAttrs{Avail, D, Access}});
return {ObjCR, &(Result.first->second)};
}
@@ -68,8 +67,8 @@ std::pair<ObjCIVarRecord *, FrontendAttrs *> FrontendRecordsSlice::addObjCIVar(
Linkage = RecordLinkage::Internal;
ObjCIVarRecord *ObjCR =
llvm::MachO::RecordsSlice::addObjCIVar(Container, IvarName, Linkage);
- auto Result = FrontendRecords.insert(
- {ObjCR, FrontendAttrs{Avail, D, D->getLocation(), Access}});
+ auto Result =
+ FrontendRecords.insert({ObjCR, FrontendAttrs{Avail, D, Access}});
return {ObjCR, &(Result.first->second)};
}
diff --git a/clang/tools/clang-installapi/ClangInstallAPI.cpp b/clang/tools/clang-installapi/ClangInstallAPI.cpp
index fd71aaec5943..0c1980ba5d62 100644
--- a/clang/tools/clang-installapi/ClangInstallAPI.cpp
+++ b/clang/tools/clang-installapi/ClangInstallAPI.cpp
@@ -121,7 +121,6 @@ static bool run(ArrayRef<const char *> Args, const char *ProgName) {
// Execute, verify and gather AST results.
// An invocation is ran for each unique target triple and for each header
// access level.
- Records FrontendRecords;
for (const auto &[Targ, Trip] : Opts.DriverOpts.Targets) {
Ctx.Verifier->setTarget(Targ);
Ctx.Slice = std::make_shared<FrontendRecordsSlice>(Trip);
@@ -132,7 +131,6 @@ static bool run(ArrayRef<const char *> Args, const char *ProgName) {
InMemoryFileSystem.get(), Opts.getClangFrontendArgs()))
return EXIT_FAILURE;
}
- FrontendRecords.emplace_back(std::move(Ctx.Slice));
}
if (Ctx.Verifier->verifyRemainingSymbols() == DylibVerifier::Result::Invalid)
--
2.44.0.1.g9765aa7075