Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit d3ccc21

Browse files
committed
Fix for LLVM Bitcode API change (to use std::shared_ptr)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291018 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent e50c4ef commit d3ccc21

File tree

5 files changed

+136
-136
lines changed

5 files changed

+136
-136
lines changed

Diff for: lib/Frontend/SerializedDiagnosticPrinter.cpp

+16-16
Original file line numberDiff line numberDiff line change
@@ -422,15 +422,15 @@ void SDiagsWriter::EmitPreamble() {
422422
EmitMetaBlock();
423423
}
424424

425-
static void AddSourceLocationAbbrev(llvm::BitCodeAbbrev *Abbrev) {
425+
static void AddSourceLocationAbbrev(llvm::BitCodeAbbrev &Abbrev) {
426426
using namespace llvm;
427-
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10)); // File ID.
428-
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Line.
429-
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Column.
430-
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Offset;
427+
Abbrev.Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10)); // File ID.
428+
Abbrev.Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Line.
429+
Abbrev.Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Column.
430+
Abbrev.Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Offset;
431431
}
432432

433-
static void AddRangeLocationAbbrev(llvm::BitCodeAbbrev *Abbrev) {
433+
static void AddRangeLocationAbbrev(llvm::BitCodeAbbrev &Abbrev) {
434434
AddSourceLocationAbbrev(Abbrev);
435435
AddSourceLocationAbbrev(Abbrev);
436436
}
@@ -449,7 +449,7 @@ void SDiagsWriter::EmitBlockInfoBlock() {
449449

450450
EmitBlockID(BLOCK_META, "Meta", Stream, Record);
451451
EmitRecordID(RECORD_VERSION, "Version", Stream, Record);
452-
BitCodeAbbrev *Abbrev = new BitCodeAbbrev();
452+
auto Abbrev = std::make_shared<BitCodeAbbrev>();
453453
Abbrev->Add(BitCodeAbbrevOp(RECORD_VERSION));
454454
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
455455
Abbrevs.set(RECORD_VERSION, Stream.EmitBlockInfoAbbrev(BLOCK_META, Abbrev));
@@ -467,33 +467,33 @@ void SDiagsWriter::EmitBlockInfoBlock() {
467467
EmitRecordID(RECORD_FIXIT, "FixIt", Stream, Record);
468468

469469
// Emit abbreviation for RECORD_DIAG.
470-
Abbrev = new BitCodeAbbrev();
470+
Abbrev = std::make_shared<BitCodeAbbrev>();
471471
Abbrev->Add(BitCodeAbbrevOp(RECORD_DIAG));
472472
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Diag level.
473-
AddSourceLocationAbbrev(Abbrev);
473+
AddSourceLocationAbbrev(*Abbrev);
474474
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10)); // Category.
475475
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10)); // Mapped Diag ID.
476476
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 16)); // Text size.
477477
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // Diagnostc text.
478478
Abbrevs.set(RECORD_DIAG, Stream.EmitBlockInfoAbbrev(BLOCK_DIAG, Abbrev));
479479

480480
// Emit abbrevation for RECORD_CATEGORY.
481-
Abbrev = new BitCodeAbbrev();
481+
Abbrev = std::make_shared<BitCodeAbbrev>();
482482
Abbrev->Add(BitCodeAbbrevOp(RECORD_CATEGORY));
483483
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16)); // Category ID.
484484
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8)); // Text size.
485485
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // Category text.
486486
Abbrevs.set(RECORD_CATEGORY, Stream.EmitBlockInfoAbbrev(BLOCK_DIAG, Abbrev));
487487

488488
// Emit abbrevation for RECORD_SOURCE_RANGE.
489-
Abbrev = new BitCodeAbbrev();
489+
Abbrev = std::make_shared<BitCodeAbbrev>();
490490
Abbrev->Add(BitCodeAbbrevOp(RECORD_SOURCE_RANGE));
491-
AddRangeLocationAbbrev(Abbrev);
491+
AddRangeLocationAbbrev(*Abbrev);
492492
Abbrevs.set(RECORD_SOURCE_RANGE,
493493
Stream.EmitBlockInfoAbbrev(BLOCK_DIAG, Abbrev));
494494

495495
// Emit the abbreviation for RECORD_DIAG_FLAG.
496-
Abbrev = new BitCodeAbbrev();
496+
Abbrev = std::make_shared<BitCodeAbbrev>();
497497
Abbrev->Add(BitCodeAbbrevOp(RECORD_DIAG_FLAG));
498498
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10)); // Mapped Diag ID.
499499
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16)); // Text size.
@@ -502,7 +502,7 @@ void SDiagsWriter::EmitBlockInfoBlock() {
502502
Abbrev));
503503

504504
// Emit the abbreviation for RECORD_FILENAME.
505-
Abbrev = new BitCodeAbbrev();
505+
Abbrev = std::make_shared<BitCodeAbbrev>();
506506
Abbrev->Add(BitCodeAbbrevOp(RECORD_FILENAME));
507507
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10)); // Mapped file ID.
508508
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Size.
@@ -513,9 +513,9 @@ void SDiagsWriter::EmitBlockInfoBlock() {
513513
Abbrev));
514514

515515
// Emit the abbreviation for RECORD_FIXIT.
516-
Abbrev = new BitCodeAbbrev();
516+
Abbrev = std::make_shared<BitCodeAbbrev>();
517517
Abbrev->Add(BitCodeAbbrevOp(RECORD_FIXIT));
518-
AddRangeLocationAbbrev(Abbrev);
518+
AddRangeLocationAbbrev(*Abbrev);
519519
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16)); // Text size.
520520
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // FixIt text.
521521
Abbrevs.set(RECORD_FIXIT, Stream.EmitBlockInfoAbbrev(BLOCK_DIAG,

Diff for: lib/Frontend/TestModuleFileExtension.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ void TestModuleFileExtension::Writer::writeExtensionContents(
2424
using namespace llvm;
2525

2626
// Write an abbreviation for this record.
27-
BitCodeAbbrev *Abv = new llvm::BitCodeAbbrev();
27+
auto Abv = std::make_shared<llvm::BitCodeAbbrev>();
2828
Abv->Add(BitCodeAbbrevOp(FIRST_EXTENSION_RECORD_ID));
2929
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // # of characters
3030
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // message
31-
auto Abbrev = Stream.EmitAbbrev(Abv);
31+
auto Abbrev = Stream.EmitAbbrev(std::move(Abv));
3232

3333
// Write a message into the extension block.
3434
SmallString<64> Message;

0 commit comments

Comments
 (0)