[clang] 7f17b6b - [MC] Migrate to new createAsmStreamer that avoids unused bool parameters
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 21 09:23:49 PDT 2024
Author: Fangrui Song
Date: 2024-07-21T09:23:45-07:00
New Revision: 7f17b6b740bd49b84430a46b366381bfc8b74fb0
URL: https://github.com/llvm/llvm-project/commit/7f17b6b740bd49b84430a46b366381bfc8b74fb0
DIFF: https://github.com/llvm/llvm-project/commit/7f17b6b740bd49b84430a46b366381bfc8b74fb0.diff
LOG: [MC] Migrate to new createAsmStreamer that avoids unused bool parameters
Added:
Modified:
clang/tools/driver/cc1as_main.cpp
llvm/lib/CodeGen/LLVMTargetMachine.cpp
llvm/lib/DWARFLinker/Classic/DWARFStreamer.cpp
llvm/lib/DWARFLinker/Parallel/DWARFEmitterImpl.cpp
llvm/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp
llvm/tools/llvm-mc/llvm-mc.cpp
llvm/tools/llvm-ml/llvm-ml.cpp
Removed:
################################################################################
diff --git a/clang/tools/driver/cc1as_main.cpp b/clang/tools/driver/cc1as_main.cpp
index 15d1e0c2f2f2d..b661a43c88b08 100644
--- a/clang/tools/driver/cc1as_main.cpp
+++ b/clang/tools/driver/cc1as_main.cpp
@@ -548,10 +548,8 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
TheTarget->createMCAsmBackend(*STI, *MRI, MCOptions));
auto FOut = std::make_unique<formatted_raw_ostream>(*Out);
- Str.reset(TheTarget->createAsmStreamer(
- Ctx, std::move(FOut), /*asmverbose*/ true,
- /*useDwarfDirectory*/ true, IP, std::move(CE), std::move(MAB),
- Opts.ShowInst));
+ Str.reset(TheTarget->createAsmStreamer(Ctx, std::move(FOut), IP,
+ std::move(CE), std::move(MAB)));
} else if (Opts.OutputType == AssemblerInvocation::FT_Null) {
Str.reset(createNullStreamer(Ctx));
} else {
diff --git a/llvm/lib/CodeGen/LLVMTargetMachine.cpp b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
index 819187c129c3a..d0dfafeaef561 100644
--- a/llvm/lib/CodeGen/LLVMTargetMachine.cpp
+++ b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
@@ -171,9 +171,7 @@ Expected<std::unique_ptr<MCStreamer>> LLVMTargetMachine::createMCStreamer(
getTarget().createMCAsmBackend(STI, MRI, Options.MCOptions));
auto FOut = std::make_unique<formatted_raw_ostream>(Out);
MCStreamer *S = getTarget().createAsmStreamer(
- Context, std::move(FOut), Options.MCOptions.AsmVerbose, true,
- InstPrinter, std::move(MCE), std::move(MAB),
- Options.MCOptions.ShowMCInst);
+ Context, std::move(FOut), InstPrinter, std::move(MCE), std::move(MAB));
AsmStreamer.reset(S);
break;
}
diff --git a/llvm/lib/DWARFLinker/Classic/DWARFStreamer.cpp b/llvm/lib/DWARFLinker/Classic/DWARFStreamer.cpp
index 45a62daffb033..bca3125368353 100644
--- a/llvm/lib/DWARFLinker/Classic/DWARFStreamer.cpp
+++ b/llvm/lib/DWARFLinker/Classic/DWARFStreamer.cpp
@@ -103,9 +103,9 @@ Error DwarfStreamer::init(Triple TheTriple,
MIP = TheTarget->createMCInstPrinter(TheTriple, MAI->getAssemblerDialect(),
*MAI, *MII, *MRI);
MS = TheTarget->createAsmStreamer(
- *MC, std::make_unique<formatted_raw_ostream>(OutFile), true, true, MIP,
- std::unique_ptr<MCCodeEmitter>(MCE), std::unique_ptr<MCAsmBackend>(MAB),
- true);
+ *MC, std::make_unique<formatted_raw_ostream>(OutFile), MIP,
+ std::unique_ptr<MCCodeEmitter>(MCE),
+ std::unique_ptr<MCAsmBackend>(MAB));
break;
}
case DWARFLinker::OutputFileType::Object: {
diff --git a/llvm/lib/DWARFLinker/Parallel/DWARFEmitterImpl.cpp b/llvm/lib/DWARFLinker/Parallel/DWARFEmitterImpl.cpp
index f790766348b53..fbab6b25ca0f1 100644
--- a/llvm/lib/DWARFLinker/Parallel/DWARFEmitterImpl.cpp
+++ b/llvm/lib/DWARFLinker/Parallel/DWARFEmitterImpl.cpp
@@ -82,9 +82,9 @@ Error DwarfEmitterImpl::init(Triple TheTriple,
MIP = TheTarget->createMCInstPrinter(TheTriple, MAI->getAssemblerDialect(),
*MAI, *MII, *MRI);
MS = TheTarget->createAsmStreamer(
- *MC, std::make_unique<formatted_raw_ostream>(OutFile), true, true, MIP,
- std::unique_ptr<MCCodeEmitter>(MCE), std::unique_ptr<MCAsmBackend>(MAB),
- true);
+ *MC, std::make_unique<formatted_raw_ostream>(OutFile), MIP,
+ std::unique_ptr<MCCodeEmitter>(MCE),
+ std::unique_ptr<MCAsmBackend>(MAB));
break;
}
case DWARFLinker::OutputFileType::Object: {
diff --git a/llvm/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp b/llvm/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp
index ef9d0f37198ac..615a39ee9bb4d 100644
--- a/llvm/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp
+++ b/llvm/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp
@@ -131,10 +131,6 @@ static int AssembleInput(const char *ProgName, const Target *TheTarget,
int AssembleOneInput(const uint8_t *Data, size_t Size) {
- const bool ShowInst = false;
- const bool AsmVerbose = false;
- const bool UseDwarfDirectory = true;
-
Triple TheTriple(Triple::normalize(TripleName));
SourceMgr SrcMgr;
@@ -204,9 +200,8 @@ int AssembleOneInput(const uint8_t *Data, size_t Size) {
std::unique_ptr<MCStreamer> Str;
if (FileType == OFT_AssemblyFile) {
- Str.reset(TheTarget->createAsmStreamer(Ctx, std::move(FOut), AsmVerbose,
- UseDwarfDirectory, IP, std::move(CE),
- std::move(MAB), ShowInst));
+ Str.reset(TheTarget->createAsmStreamer(Ctx, std::move(FOut), IP,
+ std::move(CE), std::move(MAB)));
} else {
assert(FileType == OFT_ObjectFile && "Invalid file type!");
diff --git a/llvm/tools/llvm-mc/llvm-mc.cpp b/llvm/tools/llvm-mc/llvm-mc.cpp
index 0f1e330541441..3a44ddf17974a 100644
--- a/llvm/tools/llvm-mc/llvm-mc.cpp
+++ b/llvm/tools/llvm-mc/llvm-mc.cpp
@@ -537,10 +537,8 @@ int main(int argc, char **argv) {
std::unique_ptr<MCAsmBackend> MAB(
TheTarget->createMCAsmBackend(*STI, *MRI, MCOptions));
auto FOut = std::make_unique<formatted_raw_ostream>(*OS);
- Str.reset(
- TheTarget->createAsmStreamer(Ctx, std::move(FOut), /*asmverbose*/ true,
- /*useDwarfDirectory*/ true, IP,
- std::move(CE), std::move(MAB), ShowInst));
+ Str.reset(TheTarget->createAsmStreamer(Ctx, std::move(FOut), IP,
+ std::move(CE), std::move(MAB)));
} else if (FileType == OFT_Null) {
Str.reset(TheTarget->createNullStreamer(Ctx));
diff --git a/llvm/tools/llvm-ml/llvm-ml.cpp b/llvm/tools/llvm-ml/llvm-ml.cpp
index bcfec97019c1c..db69109e2d1fa 100644
--- a/llvm/tools/llvm-ml/llvm-ml.cpp
+++ b/llvm/tools/llvm-ml/llvm-ml.cpp
@@ -264,6 +264,7 @@ int llvm_ml_main(int Argc, char **Argv, const llvm::ToolContext &) {
MCOptions.AssemblyLanguage = "masm";
MCOptions.MCFatalWarnings = InputArgs.hasArg(OPT_fatal_warnings);
MCOptions.MCSaveTempLabels = InputArgs.hasArg(OPT_save_temp_labels);
+ MCOptions.ShowMCInst = InputArgs.hasArg(OPT_show_inst);
MCOptions.AsmVerbose = true;
Triple TheTriple = GetTriple(ProgName, InputArgs);
@@ -386,10 +387,8 @@ int llvm_ml_main(int Argc, char **Argv, const llvm::ToolContext &) {
std::unique_ptr<MCAsmBackend> MAB(
TheTarget->createMCAsmBackend(*STI, *MRI, MCOptions));
auto FOut = std::make_unique<formatted_raw_ostream>(*OS);
- Str.reset(TheTarget->createAsmStreamer(
- Ctx, std::move(FOut), /*asmverbose*/ true,
- /*useDwarfDirectory*/ true, IP, std::move(CE), std::move(MAB),
- InputArgs.hasArg(OPT_show_inst)));
+ Str.reset(TheTarget->createAsmStreamer(Ctx, std::move(FOut), IP,
+ std::move(CE), std::move(MAB)));
} else if (FileType == "null") {
Str.reset(TheTarget->createNullStreamer(Ctx));
More information about the cfe-commits
mailing list