[clang] 1d85d08 - Revert "[clang][PATCH][nfc] Refactor TargetInfo::adjust to pass DiagnosticsEngine to allow diagnostics on target-unsupported options"
Melanie Blower via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 28 12:47:58 PDT 2021
Author: Melanie Blower
Date: 2021-06-28T15:47:21-04:00
New Revision: 1d85d0879a75b9556b10f55739437af8233c0b64
URL: https://github.com/llvm/llvm-project/commit/1d85d0879a75b9556b10f55739437af8233c0b64
DIFF: https://github.com/llvm/llvm-project/commit/1d85d0879a75b9556b10f55739437af8233c0b64.diff
LOG: Revert "[clang][PATCH][nfc] Refactor TargetInfo::adjust to pass DiagnosticsEngine to allow diagnostics on target-unsupported options"
This reverts commit 2dbe1c675fe94eeb7973dcc25b049d25f4ca4fa0.
More buildbot failures
Added:
Modified:
clang/include/clang/Basic/TargetInfo.h
clang/lib/Basic/TargetInfo.cpp
clang/lib/Basic/Targets/AMDGPU.cpp
clang/lib/Basic/Targets/AMDGPU.h
clang/lib/Basic/Targets/PPC.cpp
clang/lib/Basic/Targets/PPC.h
clang/lib/Basic/Targets/SPIR.h
clang/lib/Basic/Targets/WebAssembly.cpp
clang/lib/Basic/Targets/WebAssembly.h
clang/lib/Frontend/ASTUnit.cpp
clang/lib/Frontend/CompilerInstance.cpp
clang/lib/Interpreter/Interpreter.cpp
clang/tools/clang-import-test/clang-import-test.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/Basic/TargetInfo.h b/clang/include/clang/Basic/TargetInfo.h
index 20f6afa76cbb3..d59bad30e7428 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -1162,7 +1162,7 @@ class TargetInfo : public virtual TransferrableTargetInfo,
/// Apply changes to the target information with respect to certain
/// language options which change the target configuration and adjust
/// the language based on the target options where applicable.
- virtual void adjust(DiagnosticsEngine &Diags, LangOptions &Opts);
+ virtual void adjust(LangOptions &Opts);
/// Adjust target options based on codegen options.
virtual void adjustTargetOptions(const CodeGenOptions &CGOpts,
diff --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp
index 4c2859e5eda7f..e73b4a3a40c74 100644
--- a/clang/lib/Basic/TargetInfo.cpp
+++ b/clang/lib/Basic/TargetInfo.cpp
@@ -346,7 +346,7 @@ bool TargetInfo::isTypeSigned(IntType T) {
/// Apply changes to the target information with respect to certain
/// language options which change the target configuration and adjust
/// the language based on the target options where applicable.
-void TargetInfo::adjust(DiagnosticsEngine &Diags, LangOptions &Opts) {
+void TargetInfo::adjust(LangOptions &Opts) {
if (Opts.NoBitFieldTypeAlign)
UseBitFieldTypeAlignment = false;
diff --git a/clang/lib/Basic/Targets/AMDGPU.cpp b/clang/lib/Basic/Targets/AMDGPU.cpp
index fac786dbcf9e2..595132e2e70ba 100644
--- a/clang/lib/Basic/Targets/AMDGPU.cpp
+++ b/clang/lib/Basic/Targets/AMDGPU.cpp
@@ -358,8 +358,8 @@ AMDGPUTargetInfo::AMDGPUTargetInfo(const llvm::Triple &Triple,
MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
}
-void AMDGPUTargetInfo::adjust(DiagnosticsEngine &Diags, LangOptions &Opts) {
- TargetInfo::adjust(Diags, Opts);
+void AMDGPUTargetInfo::adjust(LangOptions &Opts) {
+ TargetInfo::adjust(Opts);
// ToDo: There are still a few places using default address space as private
// address space in OpenCL, which needs to be cleaned up, then Opts.OpenCL
// can be removed from the following line.
diff --git a/clang/lib/Basic/Targets/AMDGPU.h b/clang/lib/Basic/Targets/AMDGPU.h
index 244a6e0446905..fe5c61c6ba2bb 100644
--- a/clang/lib/Basic/Targets/AMDGPU.h
+++ b/clang/lib/Basic/Targets/AMDGPU.h
@@ -93,7 +93,7 @@ class LLVM_LIBRARY_VISIBILITY AMDGPUTargetInfo final : public TargetInfo {
void setAddressSpaceMap(bool DefaultIsPrivate);
- void adjust(DiagnosticsEngine &Diags, LangOptions &Opts) override;
+ void adjust(LangOptions &Opts) override;
uint64_t getPointerWidthV(unsigned AddrSpace) const override {
if (isR600(getTriple()))
diff --git a/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp
index d431dda970222..6860b5e5d02fa 100644
--- a/clang/lib/Basic/Targets/PPC.cpp
+++ b/clang/lib/Basic/Targets/PPC.cpp
@@ -614,10 +614,10 @@ void PPCTargetInfo::fillValidCPUList(SmallVectorImpl<StringRef> &Values) const {
Values.append(std::begin(ValidCPUNames), std::end(ValidCPUNames));
}
-void PPCTargetInfo::adjust(DiagnosticsEngine &Diags, LangOptions &Opts) {
+void PPCTargetInfo::adjust(LangOptions &Opts) {
if (HasAltivec)
Opts.AltiVec = 1;
- TargetInfo::adjust(Diags, Opts);
+ TargetInfo::adjust(Opts);
if (LongDoubleFormat != &llvm::APFloat::IEEEdouble())
LongDoubleFormat = Opts.PPCIEEELongDouble
? &llvm::APFloat::IEEEquad()
diff --git a/clang/lib/Basic/Targets/PPC.h b/clang/lib/Basic/Targets/PPC.h
index 18ee1194c759d..554f2174fee00 100644
--- a/clang/lib/Basic/Targets/PPC.h
+++ b/clang/lib/Basic/Targets/PPC.h
@@ -89,7 +89,7 @@ class LLVM_LIBRARY_VISIBILITY PPCTargetInfo : public TargetInfo {
}
// Set the language option for altivec based on our value.
- void adjust(DiagnosticsEngine &Diags, LangOptions &Opts) override;
+ void adjust(LangOptions &Opts) override;
// Note: GCC recognizes the following additional cpus:
// 401, 403, 405, 405fp, 440fp, 464, 464fp, 476, 476fp, 505, 740, 801,
diff --git a/clang/lib/Basic/Targets/SPIR.h b/clang/lib/Basic/Targets/SPIR.h
index 50f34abd66309..c429b27709ecb 100644
--- a/clang/lib/Basic/Targets/SPIR.h
+++ b/clang/lib/Basic/Targets/SPIR.h
@@ -135,8 +135,8 @@ class LLVM_LIBRARY_VISIBILITY SPIRTargetInfo : public TargetInfo {
AddrSpaceMap = DefaultIsGeneric ? &SPIRDefIsGenMap : &SPIRDefIsPrivMap;
}
- void adjust(DiagnosticsEngine &Diags, LangOptions &Opts) override {
- TargetInfo::adjust(Diags, Opts);
+ void adjust(LangOptions &Opts) override {
+ TargetInfo::adjust(Opts);
// FIXME: SYCL specification considers unannotated pointers and references
// to be pointing to the generic address space. See section 5.9.3 of
// SYCL 2020 specification.
diff --git a/clang/lib/Basic/Targets/WebAssembly.cpp b/clang/lib/Basic/Targets/WebAssembly.cpp
index 7ef79849cb75d..2a5055c3d534b 100644
--- a/clang/lib/Basic/Targets/WebAssembly.cpp
+++ b/clang/lib/Basic/Targets/WebAssembly.cpp
@@ -234,8 +234,7 @@ ArrayRef<Builtin::Info> WebAssemblyTargetInfo::getTargetBuiltins() const {
Builtin::FirstTSBuiltin);
}
-void WebAssemblyTargetInfo::adjust(DiagnosticsEngine &Diags,
- LangOptions &Opts) {
+void WebAssemblyTargetInfo::adjust(LangOptions &Opts) {
// If the Atomics feature isn't available, turn off POSIXThreads and
// ThreadModel, so that we don't predefine _REENTRANT or __STDCPP_THREADS__.
if (!HasAtomics) {
diff --git a/clang/lib/Basic/Targets/WebAssembly.h b/clang/lib/Basic/Targets/WebAssembly.h
index b29730c5d706b..70115183e46b9 100644
--- a/clang/lib/Basic/Targets/WebAssembly.h
+++ b/clang/lib/Basic/Targets/WebAssembly.h
@@ -138,7 +138,7 @@ class LLVM_LIBRARY_VISIBILITY WebAssemblyTargetInfo : public TargetInfo {
bool hasProtectedVisibility() const override { return false; }
- void adjust(DiagnosticsEngine &Diags, LangOptions &Opts) override;
+ void adjust(LangOptions &Opts) override;
};
class LLVM_LIBRARY_VISIBILITY WebAssembly32TargetInfo
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index 4f92833e4229c..988090a8b1b13 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -588,7 +588,7 @@ class ASTInfoCollector : public ASTReaderListener {
//
// FIXME: We shouldn't need to do this, the target should be immutable once
// created. This complexity should be lifted elsewhere.
- Target->adjust(PP.getDiagnostics(), LangOpt);
+ Target->adjust(LangOpt);
// Initialize the preprocessor.
PP.Initialize(*Target);
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 2ae3be6814dec..063384130f730 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -142,7 +142,7 @@ bool CompilerInstance::createTarget() {
// Inform the target of the language options.
// FIXME: We shouldn't need to do this, the target should be immutable once
// created. This complexity should be lifted elsewhere.
- getTarget().adjust(getDiagnostics(), getLangOpts());
+ getTarget().adjust(getLangOpts());
// Adjust target options based on codegen options.
getTarget().adjustTargetOptions(getCodeGenOpts(), getTargetOpts());
@@ -457,7 +457,7 @@ void CompilerInstance::createPreprocessor(TranslationUnitKind TUKind) {
getSourceManager(), *HeaderInfo, *this,
/*IdentifierInfoLookup=*/nullptr,
/*OwnsHeaderSearch=*/true, TUKind);
- getTarget().adjust(getDiagnostics(), getLangOpts());
+ getTarget().adjust(getLangOpts());
PP->Initialize(getTarget(), getAuxTarget());
if (PPOpts.DetailedRecord)
diff --git a/clang/lib/Interpreter/Interpreter.cpp b/clang/lib/Interpreter/Interpreter.cpp
index 768847f9f0352..711a5e9ff0168 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -110,7 +110,7 @@ CreateCI(const llvm::opt::ArgStringList &Argv) {
"Initialization failed. "
"Target is missing");
- Clang->getTarget().adjust(Clang->getDiagnostics(), Clang->getLangOpts());
+ Clang->getTarget().adjust(Clang->getLangOpts());
return std::move(Clang);
}
diff --git a/clang/tools/clang-import-test/clang-import-test.cpp b/clang/tools/clang-import-test/clang-import-test.cpp
index fa5d7a54f53b4..df173cf49f35e 100644
--- a/clang/tools/clang-import-test/clang-import-test.cpp
+++ b/clang/tools/clang-import-test/clang-import-test.cpp
@@ -208,7 +208,7 @@ std::unique_ptr<CompilerInstance> BuildCompilerInstance() {
TargetInfo *TI = TargetInfo::CreateTargetInfo(
Ins->getDiagnostics(), Ins->getInvocation().TargetOpts);
Ins->setTarget(TI);
- Ins->getTarget().adjust(Ins->getDiagnostics(), Ins->getLangOpts());
+ Ins->getTarget().adjust(Ins->getLangOpts());
Ins->createFileManager();
Ins->createSourceManager(Ins->getFileManager());
Ins->createPreprocessor(TU_Complete);
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
index af44face09ed1..d38e64f9c5542 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -658,8 +658,7 @@ ClangExpressionParser::ClangExpressionParser(
//
// FIXME: We shouldn't need to do this, the target should be immutable once
// created. This complexity should be lifted elsewhere.
- m_compiler->getTarget().adjust(m_compiler->getDiagnostics(),
- m_compiler->getLangOpts());
+ m_compiler->getTarget().adjust(m_compiler->getLangOpts());
// 6. Set up the diagnostic buffer for reporting errors
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index 65f8a9dcdb004..c337ee9f79f6b 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -704,7 +704,7 @@ ClangModulesDeclVendor::Create(Target &target) {
if (!instance->hasTarget())
return nullptr;
- instance->getTarget().adjust(*diagnostics_engine, instance->getLangOpts());
+ instance->getTarget().adjust(instance->getLangOpts());
if (!action->BeginSourceFile(*instance,
instance->getFrontendOpts().Inputs[0]))
More information about the cfe-commits
mailing list