Skip to content

Commit 6a86e25

Browse files
committed
Pass a reference to a module to the bitcode writer.
This simplifies most callers as they are already using references or std::unique_ptr. llvm-svn: 325155
1 parent 6d9cf8a commit 6a86e25

File tree

21 files changed

+53
-55
lines changed

21 files changed

+53
-55
lines changed

llvm/include/llvm/Bitcode/BitcodeWriter.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class raw_ostream;
8686
/// Can be used to produce the same module hash for a minimized bitcode
8787
/// used just for the thin link as in the regular full bitcode that will
8888
/// be used in the backend.
89-
void writeModule(const Module *M, bool ShouldPreserveUseListOrder = false,
89+
void writeModule(const Module &M, bool ShouldPreserveUseListOrder = false,
9090
const ModuleSummaryIndex *Index = nullptr,
9191
bool GenerateHash = false, ModuleHash *ModHash = nullptr);
9292

@@ -97,7 +97,7 @@ class raw_ostream;
9797
///
9898
/// ModHash is for use in ThinLTO incremental build, generated while the
9999
/// IR bitcode file writing.
100-
void writeThinLinkBitcode(const Module *M, const ModuleSummaryIndex &Index,
100+
void writeThinLinkBitcode(const Module &M, const ModuleSummaryIndex &Index,
101101
const ModuleHash &ModHash);
102102

103103
void writeIndex(
@@ -126,7 +126,7 @@ class raw_ostream;
126126
/// Can be used to produce the same module hash for a minimized bitcode
127127
/// used just for the thin link as in the regular full bitcode that will
128128
/// be used in the backend.
129-
void WriteBitcodeToFile(const Module *M, raw_ostream &Out,
129+
void WriteBitcodeToFile(const Module &M, raw_ostream &Out,
130130
bool ShouldPreserveUseListOrder = false,
131131
const ModuleSummaryIndex *Index = nullptr,
132132
bool GenerateHash = false,
@@ -139,7 +139,7 @@ class raw_ostream;
139139
///
140140
/// ModHash is for use in ThinLTO incremental build, generated while the IR
141141
/// bitcode file writing.
142-
void WriteThinLinkBitcodeToFile(const Module *M, raw_ostream &Out,
142+
void WriteThinLinkBitcodeToFile(const Module &M, raw_ostream &Out,
143143
const ModuleSummaryIndex &Index,
144144
const ModuleHash &ModHash);
145145

llvm/lib/Bitcode/Writer/BitWriter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ int LLVMWriteBitcodeToFile(LLVMModuleRef M, const char *Path) {
2525
if (EC)
2626
return -1;
2727

28-
WriteBitcodeToFile(unwrap(M), OS);
28+
WriteBitcodeToFile(*unwrap(M), OS);
2929
return 0;
3030
}
3131

3232
int LLVMWriteBitcodeToFD(LLVMModuleRef M, int FD, int ShouldClose,
3333
int Unbuffered) {
3434
raw_fd_ostream OS(FD, ShouldClose, Unbuffered);
3535

36-
WriteBitcodeToFile(unwrap(M), OS);
36+
WriteBitcodeToFile(*unwrap(M), OS);
3737
return 0;
3838
}
3939

@@ -45,6 +45,6 @@ LLVMMemoryBufferRef LLVMWriteBitcodeToMemoryBuffer(LLVMModuleRef M) {
4545
std::string Data;
4646
raw_string_ostream OS(Data);
4747

48-
WriteBitcodeToFile(unwrap(M), OS);
48+
WriteBitcodeToFile(*unwrap(M), OS);
4949
return wrap(MemoryBuffer::getMemBufferCopy(OS.str()).release());
5050
}

llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,12 @@ class ModuleBitcodeWriterBase : public BitcodeWriterBase {
170170
public:
171171
/// Constructs a ModuleBitcodeWriterBase object for the given Module,
172172
/// writing to the provided \p Buffer.
173-
ModuleBitcodeWriterBase(const Module *M, StringTableBuilder &StrtabBuilder,
173+
ModuleBitcodeWriterBase(const Module &M, StringTableBuilder &StrtabBuilder,
174174
BitstreamWriter &Stream,
175175
bool ShouldPreserveUseListOrder,
176176
const ModuleSummaryIndex *Index)
177-
: BitcodeWriterBase(Stream, StrtabBuilder), M(*M),
178-
VE(*M, ShouldPreserveUseListOrder), Index(Index) {
177+
: BitcodeWriterBase(Stream, StrtabBuilder), M(M),
178+
VE(M, ShouldPreserveUseListOrder), Index(Index) {
179179
// Assign ValueIds to any callee values in the index that came from
180180
// indirect call profiles and were recorded as a GUID not a Value*
181181
// (which would have been assigned an ID by the ValueEnumerator).
@@ -254,7 +254,7 @@ class ModuleBitcodeWriter : public ModuleBitcodeWriterBase {
254254
public:
255255
/// Constructs a ModuleBitcodeWriter object for the given Module,
256256
/// writing to the provided \p Buffer.
257-
ModuleBitcodeWriter(const Module *M, SmallVectorImpl<char> &Buffer,
257+
ModuleBitcodeWriter(const Module &M, SmallVectorImpl<char> &Buffer,
258258
StringTableBuilder &StrtabBuilder,
259259
BitstreamWriter &Stream, bool ShouldPreserveUseListOrder,
260260
const ModuleSummaryIndex *Index, bool GenerateHash,
@@ -4038,7 +4038,7 @@ void BitcodeWriter::copyStrtab(StringRef Strtab) {
40384038
WroteStrtab = true;
40394039
}
40404040

4041-
void BitcodeWriter::writeModule(const Module *M,
4041+
void BitcodeWriter::writeModule(const Module &M,
40424042
bool ShouldPreserveUseListOrder,
40434043
const ModuleSummaryIndex *Index,
40444044
bool GenerateHash, ModuleHash *ModHash) {
@@ -4048,8 +4048,8 @@ void BitcodeWriter::writeModule(const Module *M,
40484048
// Modules in case it needs to materialize metadata. But the bitcode writer
40494049
// requires that the module is materialized, so we can cast to non-const here,
40504050
// after checking that it is in fact materialized.
4051-
assert(M->isMaterialized());
4052-
Mods.push_back(const_cast<Module *>(M));
4051+
assert(M.isMaterialized());
4052+
Mods.push_back(const_cast<Module *>(&M));
40534053

40544054
ModuleBitcodeWriter ModuleWriter(M, Buffer, StrtabBuilder, *Stream,
40554055
ShouldPreserveUseListOrder, Index,
@@ -4065,9 +4065,8 @@ void BitcodeWriter::writeIndex(
40654065
IndexWriter.write();
40664066
}
40674067

4068-
/// WriteBitcodeToFile - Write the specified module to the specified output
4069-
/// stream.
4070-
void llvm::WriteBitcodeToFile(const Module *M, raw_ostream &Out,
4068+
/// Write the specified module to the specified output stream.
4069+
void llvm::WriteBitcodeToFile(const Module &M, raw_ostream &Out,
40714070
bool ShouldPreserveUseListOrder,
40724071
const ModuleSummaryIndex *Index,
40734072
bool GenerateHash, ModuleHash *ModHash) {
@@ -4076,7 +4075,7 @@ void llvm::WriteBitcodeToFile(const Module *M, raw_ostream &Out,
40764075

40774076
// If this is darwin or another generic macho target, reserve space for the
40784077
// header.
4079-
Triple TT(M->getTargetTriple());
4078+
Triple TT(M.getTargetTriple());
40804079
if (TT.isOSDarwin() || TT.isOSBinFormatMachO())
40814080
Buffer.insert(Buffer.begin(), BWH_HeaderSize, 0);
40824081

@@ -4133,7 +4132,7 @@ class ThinLinkBitcodeWriter : public ModuleBitcodeWriterBase {
41334132
const ModuleHash *ModHash;
41344133

41354134
public:
4136-
ThinLinkBitcodeWriter(const Module *M, StringTableBuilder &StrtabBuilder,
4135+
ThinLinkBitcodeWriter(const Module &M, StringTableBuilder &StrtabBuilder,
41374136
BitstreamWriter &Stream,
41384137
const ModuleSummaryIndex &Index,
41394138
const ModuleHash &ModHash)
@@ -4251,7 +4250,7 @@ void ThinLinkBitcodeWriter::write() {
42514250
Stream.ExitBlock();
42524251
}
42534252

4254-
void BitcodeWriter::writeThinLinkBitcode(const Module *M,
4253+
void BitcodeWriter::writeThinLinkBitcode(const Module &M,
42554254
const ModuleSummaryIndex &Index,
42564255
const ModuleHash &ModHash) {
42574256
assert(!WroteStrtab);
@@ -4260,8 +4259,8 @@ void BitcodeWriter::writeThinLinkBitcode(const Module *M,
42604259
// Modules in case it needs to materialize metadata. But the bitcode writer
42614260
// requires that the module is materialized, so we can cast to non-const here,
42624261
// after checking that it is in fact materialized.
4263-
assert(M->isMaterialized());
4264-
Mods.push_back(const_cast<Module *>(M));
4262+
assert(M.isMaterialized());
4263+
Mods.push_back(const_cast<Module *>(&M));
42654264

42664265
ThinLinkBitcodeWriter ThinLinkWriter(M, StrtabBuilder, *Stream, Index,
42674266
ModHash);
@@ -4271,7 +4270,7 @@ void BitcodeWriter::writeThinLinkBitcode(const Module *M,
42714270
// Write the specified thin link bitcode file to the given raw output stream,
42724271
// where it will be written in a new bitcode block. This is used when
42734272
// writing the per-module index file for ThinLTO.
4274-
void llvm::WriteThinLinkBitcodeToFile(const Module *M, raw_ostream &Out,
4273+
void llvm::WriteThinLinkBitcodeToFile(const Module &M, raw_ostream &Out,
42754274
const ModuleSummaryIndex &Index,
42764275
const ModuleHash &ModHash) {
42774276
SmallVector<char, 0> Buffer;

llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ PreservedAnalyses BitcodeWriterPass::run(Module &M, ModuleAnalysisManager &AM) {
2323
const ModuleSummaryIndex *Index =
2424
EmitSummaryIndex ? &(AM.getResult<ModuleSummaryIndexAnalysis>(M))
2525
: nullptr;
26-
WriteBitcodeToFile(&M, OS, ShouldPreserveUseListOrder, Index, EmitModuleHash);
26+
WriteBitcodeToFile(M, OS, ShouldPreserveUseListOrder, Index, EmitModuleHash);
2727
return PreservedAnalyses::all();
2828
}
2929

@@ -55,7 +55,7 @@ namespace {
5555
EmitSummaryIndex
5656
? &(getAnalysis<ModuleSummaryIndexWrapperPass>().getIndex())
5757
: nullptr;
58-
WriteBitcodeToFile(&M, OS, ShouldPreserveUseListOrder, Index,
58+
WriteBitcodeToFile(M, OS, ShouldPreserveUseListOrder, Index,
5959
EmitModuleHash);
6060
return false;
6161
}

llvm/lib/CodeGen/ParallelCG.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ std::unique_ptr<Module> llvm::splitCodeGen(
4444

4545
if (OSs.size() == 1) {
4646
if (!BCOSs.empty())
47-
WriteBitcodeToFile(M.get(), *BCOSs[0]);
47+
WriteBitcodeToFile(*M, *BCOSs[0]);
4848
codegen(M.get(), *OSs[0], TMFactory, FileType);
4949
return M;
5050
}
@@ -66,7 +66,7 @@ std::unique_ptr<Module> llvm::splitCodeGen(
6666
// FIXME: Provide a more direct way to do this in LLVM.
6767
SmallString<0> BC;
6868
raw_svector_ostream BCOS(BC);
69-
WriteBitcodeToFile(MPart.get(), BCOS);
69+
WriteBitcodeToFile(*MPart, BCOS);
7070

7171
if (!BCOSs.empty()) {
7272
BCOSs[ThreadCount]->write(BC.begin(), BC.size());

llvm/lib/FuzzMutate/FuzzerCLI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ size_t llvm::writeModule(const Module &M, uint8_t *Dest, size_t MaxSize) {
169169
std::string Buf;
170170
{
171171
raw_string_ostream OS(Buf);
172-
WriteBitcodeToFile(&M, OS);
172+
WriteBitcodeToFile(M, OS);
173173
}
174174
if (Buf.size() > MaxSize)
175175
return 0;

llvm/lib/LTO/LTOBackend.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Error Config::addSaveTemps(std::string OutputFileName,
8282
// directly and exit.
8383
if (EC)
8484
reportOpenError(Path, EC.message());
85-
WriteBitcodeToFile(&M, OS, /*ShouldPreserveUseListOrder=*/false);
85+
WriteBitcodeToFile(M, OS, /*ShouldPreserveUseListOrder=*/false);
8686
return true;
8787
};
8888
};
@@ -309,7 +309,7 @@ void splitCodeGen(Config &C, TargetMachine *TM, AddStreamFn AddStream,
309309
// FIXME: Provide a more direct way to do this in LLVM.
310310
SmallString<0> BC;
311311
raw_svector_ostream BCOS(BC);
312-
WriteBitcodeToFile(MPart.get(), BCOS);
312+
WriteBitcodeToFile(*MPart, BCOS);
313313

314314
// Enqueue the task
315315
CodegenThreadPool.async(

llvm/lib/LTO/LTOCodeGenerator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ bool LTOCodeGenerator::writeMergedModules(StringRef Path) {
220220
}
221221

222222
// write bitcode to it
223-
WriteBitcodeToFile(MergedModule.get(), Out.os(), ShouldEmbedUselists);
223+
WriteBitcodeToFile(*MergedModule, Out.os(), ShouldEmbedUselists);
224224
Out.os().close();
225225

226226
if (Out.os().has_error()) {

llvm/lib/LTO/ThinLTOCodeGenerator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static void saveTempBitcode(const Module &TheModule, StringRef TempDir,
8282
if (EC)
8383
report_fatal_error(Twine("Failed to open ") + SaveTempPath +
8484
" to save optimized bitcode\n");
85-
WriteBitcodeToFile(&TheModule, OS, /* ShouldPreserveUseListOrder */ true);
85+
WriteBitcodeToFile(TheModule, OS, /* ShouldPreserveUseListOrder */ true);
8686
}
8787

8888
static const GlobalValueSummary *
@@ -476,7 +476,7 @@ ProcessThinLTOModule(Module &TheModule, ModuleSummaryIndex &Index,
476476
raw_svector_ostream OS(OutputBuffer);
477477
ProfileSummaryInfo PSI(TheModule);
478478
auto Index = buildModuleSummaryIndex(TheModule, nullptr, &PSI);
479-
WriteBitcodeToFile(&TheModule, OS, true, &Index);
479+
WriteBitcodeToFile(TheModule, OS, true, &Index);
480480
}
481481
return make_unique<ObjectMemoryBuffer>(std::move(OutputBuffer));
482482
}

llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,11 @@ void splitAndWriteThinLTOBitcode(
202202
if (ModuleId.empty()) {
203203
// We couldn't generate a module ID for this module, just write it out as a
204204
// regular LTO module.
205-
WriteBitcodeToFile(&M, OS);
205+
WriteBitcodeToFile(M, OS);
206206
if (ThinLinkOS)
207207
// We don't have a ThinLTO part, but still write the module to the
208208
// ThinLinkOS if requested so that the expected output file is produced.
209-
WriteBitcodeToFile(&M, *ThinLinkOS);
209+
WriteBitcodeToFile(M, *ThinLinkOS);
210210
return;
211211
}
212212

@@ -374,10 +374,9 @@ void splitAndWriteThinLTOBitcode(
374374
// be used in the backends, and use that in the minimized bitcode
375375
// produced for the full link.
376376
ModuleHash ModHash = {{0}};
377-
W.writeModule(&M, /*ShouldPreserveUseListOrder=*/false, &Index,
377+
W.writeModule(M, /*ShouldPreserveUseListOrder=*/false, &Index,
378378
/*GenerateHash=*/true, &ModHash);
379-
W.writeModule(MergedM.get(), /*ShouldPreserveUseListOrder=*/false,
380-
&MergedMIndex);
379+
W.writeModule(*MergedM, /*ShouldPreserveUseListOrder=*/false, &MergedMIndex);
381380
W.writeSymtab();
382381
W.writeStrtab();
383382
OS << Buffer;
@@ -389,8 +388,8 @@ void splitAndWriteThinLTOBitcode(
389388
Buffer.clear();
390389
BitcodeWriter W2(Buffer);
391390
StripDebugInfo(M);
392-
W2.writeThinLinkBitcode(&M, Index, ModHash);
393-
W2.writeModule(MergedM.get(), /*ShouldPreserveUseListOrder=*/false,
391+
W2.writeThinLinkBitcode(M, Index, ModHash);
392+
W2.writeModule(*MergedM, /*ShouldPreserveUseListOrder=*/false,
394393
&MergedMIndex);
395394
W2.writeSymtab();
396395
W2.writeStrtab();
@@ -423,13 +422,13 @@ void writeThinLTOBitcode(raw_ostream &OS, raw_ostream *ThinLinkOS,
423422
// be used in the backends, and use that in the minimized bitcode
424423
// produced for the full link.
425424
ModuleHash ModHash = {{0}};
426-
WriteBitcodeToFile(&M, OS, /*ShouldPreserveUseListOrder=*/false, Index,
425+
WriteBitcodeToFile(M, OS, /*ShouldPreserveUseListOrder=*/false, Index,
427426
/*GenerateHash=*/true, &ModHash);
428427
// If a minimized bitcode module was requested for the thin link, only
429428
// the information that is needed by thin link will be written in the
430429
// given OS.
431430
if (ThinLinkOS && Index)
432-
WriteThinLinkBitcodeToFile(&M, *ThinLinkOS, *Index, ModHash);
431+
WriteThinLinkBitcodeToFile(M, *ThinLinkOS, *Index, ModHash);
433432
}
434433

435434
class WriteThinLTOBitcode : public ModulePass {

llvm/tools/bugpoint/OptimizerDriver.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static cl::opt<std::string>
5252
/// file. If an error occurs, true is returned.
5353
///
5454
static bool writeProgramToFileAux(ToolOutputFile &Out, const Module *M) {
55-
WriteBitcodeToFile(M, Out.os(), PreserveBitcodeUseListOrder);
55+
WriteBitcodeToFile(*M, Out.os(), PreserveBitcodeUseListOrder);
5656
Out.os().close();
5757
if (!Out.os().has_error()) {
5858
Out.keep();
@@ -69,7 +69,7 @@ bool BugDriver::writeProgramToFile(const std::string &Filename, int FD,
6969

7070
bool BugDriver::writeProgramToFile(int FD, const Module *M) const {
7171
raw_fd_ostream OS(FD, /*shouldClose*/ false);
72-
WriteBitcodeToFile(M, OS, PreserveBitcodeUseListOrder);
72+
WriteBitcodeToFile(*M, OS, PreserveBitcodeUseListOrder);
7373
OS.flush();
7474
if (!OS.has_error())
7575
return false;
@@ -158,7 +158,7 @@ bool BugDriver::runPasses(Module *Program,
158158
DiscardTemp Discard{*Temp};
159159
raw_fd_ostream OS(Temp->FD, /*shouldClose*/ false);
160160

161-
WriteBitcodeToFile(Program, OS, PreserveBitcodeUseListOrder);
161+
WriteBitcodeToFile(*Program, OS, PreserveBitcodeUseListOrder);
162162
OS.flush();
163163
if (OS.has_error()) {
164164
errs() << "Error writing bitcode file: " << Temp->TmpName << "\n";

llvm/tools/gold/gold-plugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ static std::unique_ptr<LTO> createLTO(IndexWriteCallback OnIndexWrite) {
784784
raw_fd_ostream OS(output_name, EC, sys::fs::OpenFlags::F_None);
785785
if (EC)
786786
message(LDPL_FATAL, "Failed to write the output file.");
787-
WriteBitcodeToFile(&M, OS, /* ShouldPreserveUseListOrder */ false);
787+
WriteBitcodeToFile(M, OS, /* ShouldPreserveUseListOrder */ false);
788788
return false;
789789
};
790790
break;

llvm/tools/llvm-as/llvm-as.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static void WriteOutputFile(const Module *M) {
8585
}
8686

8787
if (Force || !CheckBitcodeOutputToConsole(Out->os(), true))
88-
WriteBitcodeToFile(M, Out->os(), PreserveBitcodeUseListOrder, nullptr,
88+
WriteBitcodeToFile(*M, Out->os(), PreserveBitcodeUseListOrder, nullptr,
8989
EmitModuleHash);
9090

9191
// Declare success.

llvm/tools/llvm-cat/llvm-cat.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ int main(int argc, char **argv) {
7373
Err.print(argv[0], errs());
7474
return 1;
7575
}
76-
Writer.writeModule(M.get());
76+
Writer.writeModule(*M);
7777
OwnedMods.push_back(std::move(M));
7878
}
7979
Writer.writeStrtab();

llvm/tools/llvm-link/llvm-link.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ int main(int argc, char **argv) {
398398
if (OutputAssembly) {
399399
Composite->print(Out.os(), nullptr, PreserveAssemblyUseListOrder);
400400
} else if (Force || !CheckBitcodeOutputToConsole(Out.os(), true))
401-
WriteBitcodeToFile(Composite.get(), Out.os(), PreserveBitcodeUseListOrder);
401+
WriteBitcodeToFile(*Composite, Out.os(), PreserveBitcodeUseListOrder);
402402

403403
// Declare success.
404404
Out.keep();

llvm/tools/llvm-lto/llvm-lto.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ static void writeModuleToFile(Module &TheModule, StringRef Filename) {
462462
raw_fd_ostream OS(Filename, EC, sys::fs::OpenFlags::F_None);
463463
error(EC, "error opening the file '" + Filename + "'");
464464
maybeVerifyModule(TheModule);
465-
WriteBitcodeToFile(&TheModule, OS, /* ShouldPreserveUseListOrder */ true);
465+
WriteBitcodeToFile(TheModule, OS, /* ShouldPreserveUseListOrder */ true);
466466
}
467467

468468
class ThinLTOProcessing {

llvm/tools/llvm-modextract/llvm-modextract.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ int main(int argc, char **argv) {
7070
}
7171

7272
std::unique_ptr<Module> M = ExitOnErr(Ms[ModuleIndex].parseModule(Context));
73-
WriteBitcodeToFile(M.get(), Out->os());
73+
WriteBitcodeToFile(*M, Out->os());
7474

7575
Out->keep();
7676
return 0;

llvm/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ extern "C" LLVM_ATTRIBUTE_USED size_t LLVMFuzzerCustomMutator(
7777
std::string Buf;
7878
{
7979
raw_string_ostream OS(Buf);
80-
WriteBitcodeToFile(M.get(), OS);
80+
WriteBitcodeToFile(*M, OS);
8181
}
8282
if (Buf.size() > MaxSize)
8383
return 0;

0 commit comments

Comments
 (0)