@@ -422,15 +422,15 @@ void SDiagsWriter::EmitPreamble() {
422
422
EmitMetaBlock ();
423
423
}
424
424
425
- static void AddSourceLocationAbbrev (llvm::BitCodeAbbrev * Abbrev) {
425
+ static void AddSourceLocationAbbrev (llvm::BitCodeAbbrev & Abbrev) {
426
426
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;
431
431
}
432
432
433
- static void AddRangeLocationAbbrev (llvm::BitCodeAbbrev * Abbrev) {
433
+ static void AddRangeLocationAbbrev (llvm::BitCodeAbbrev & Abbrev) {
434
434
AddSourceLocationAbbrev (Abbrev);
435
435
AddSourceLocationAbbrev (Abbrev);
436
436
}
@@ -449,7 +449,7 @@ void SDiagsWriter::EmitBlockInfoBlock() {
449
449
450
450
EmitBlockID (BLOCK_META, " Meta" , Stream, Record);
451
451
EmitRecordID (RECORD_VERSION, " Version" , Stream, Record);
452
- BitCodeAbbrev * Abbrev = new BitCodeAbbrev ();
452
+ auto Abbrev = std::make_shared< BitCodeAbbrev> ();
453
453
Abbrev->Add (BitCodeAbbrevOp (RECORD_VERSION));
454
454
Abbrev->Add (BitCodeAbbrevOp (BitCodeAbbrevOp::Fixed , 32 ));
455
455
Abbrevs.set (RECORD_VERSION, Stream.EmitBlockInfoAbbrev (BLOCK_META, Abbrev));
@@ -467,33 +467,33 @@ void SDiagsWriter::EmitBlockInfoBlock() {
467
467
EmitRecordID (RECORD_FIXIT, " FixIt" , Stream, Record);
468
468
469
469
// Emit abbreviation for RECORD_DIAG.
470
- Abbrev = new BitCodeAbbrev ();
470
+ Abbrev = std::make_shared< BitCodeAbbrev> ();
471
471
Abbrev->Add (BitCodeAbbrevOp (RECORD_DIAG));
472
472
Abbrev->Add (BitCodeAbbrevOp (BitCodeAbbrevOp::Fixed , 3 )); // Diag level.
473
- AddSourceLocationAbbrev (Abbrev);
473
+ AddSourceLocationAbbrev (* Abbrev);
474
474
Abbrev->Add (BitCodeAbbrevOp (BitCodeAbbrevOp::Fixed , 10 )); // Category.
475
475
Abbrev->Add (BitCodeAbbrevOp (BitCodeAbbrevOp::Fixed , 10 )); // Mapped Diag ID.
476
476
Abbrev->Add (BitCodeAbbrevOp (BitCodeAbbrevOp::VBR, 16 )); // Text size.
477
477
Abbrev->Add (BitCodeAbbrevOp (BitCodeAbbrevOp::Blob)); // Diagnostc text.
478
478
Abbrevs.set (RECORD_DIAG, Stream.EmitBlockInfoAbbrev (BLOCK_DIAG, Abbrev));
479
479
480
480
// Emit abbrevation for RECORD_CATEGORY.
481
- Abbrev = new BitCodeAbbrev ();
481
+ Abbrev = std::make_shared< BitCodeAbbrev> ();
482
482
Abbrev->Add (BitCodeAbbrevOp (RECORD_CATEGORY));
483
483
Abbrev->Add (BitCodeAbbrevOp (BitCodeAbbrevOp::Fixed , 16 )); // Category ID.
484
484
Abbrev->Add (BitCodeAbbrevOp (BitCodeAbbrevOp::Fixed , 8 )); // Text size.
485
485
Abbrev->Add (BitCodeAbbrevOp (BitCodeAbbrevOp::Blob)); // Category text.
486
486
Abbrevs.set (RECORD_CATEGORY, Stream.EmitBlockInfoAbbrev (BLOCK_DIAG, Abbrev));
487
487
488
488
// Emit abbrevation for RECORD_SOURCE_RANGE.
489
- Abbrev = new BitCodeAbbrev ();
489
+ Abbrev = std::make_shared< BitCodeAbbrev> ();
490
490
Abbrev->Add (BitCodeAbbrevOp (RECORD_SOURCE_RANGE));
491
- AddRangeLocationAbbrev (Abbrev);
491
+ AddRangeLocationAbbrev (* Abbrev);
492
492
Abbrevs.set (RECORD_SOURCE_RANGE,
493
493
Stream.EmitBlockInfoAbbrev (BLOCK_DIAG, Abbrev));
494
494
495
495
// Emit the abbreviation for RECORD_DIAG_FLAG.
496
- Abbrev = new BitCodeAbbrev ();
496
+ Abbrev = std::make_shared< BitCodeAbbrev> ();
497
497
Abbrev->Add (BitCodeAbbrevOp (RECORD_DIAG_FLAG));
498
498
Abbrev->Add (BitCodeAbbrevOp (BitCodeAbbrevOp::Fixed , 10 )); // Mapped Diag ID.
499
499
Abbrev->Add (BitCodeAbbrevOp (BitCodeAbbrevOp::Fixed , 16 )); // Text size.
@@ -502,7 +502,7 @@ void SDiagsWriter::EmitBlockInfoBlock() {
502
502
Abbrev));
503
503
504
504
// Emit the abbreviation for RECORD_FILENAME.
505
- Abbrev = new BitCodeAbbrev ();
505
+ Abbrev = std::make_shared< BitCodeAbbrev> ();
506
506
Abbrev->Add (BitCodeAbbrevOp (RECORD_FILENAME));
507
507
Abbrev->Add (BitCodeAbbrevOp (BitCodeAbbrevOp::Fixed , 10 )); // Mapped file ID.
508
508
Abbrev->Add (BitCodeAbbrevOp (BitCodeAbbrevOp::Fixed , 32 )); // Size.
@@ -513,9 +513,9 @@ void SDiagsWriter::EmitBlockInfoBlock() {
513
513
Abbrev));
514
514
515
515
// Emit the abbreviation for RECORD_FIXIT.
516
- Abbrev = new BitCodeAbbrev ();
516
+ Abbrev = std::make_shared< BitCodeAbbrev> ();
517
517
Abbrev->Add (BitCodeAbbrevOp (RECORD_FIXIT));
518
- AddRangeLocationAbbrev (Abbrev);
518
+ AddRangeLocationAbbrev (* Abbrev);
519
519
Abbrev->Add (BitCodeAbbrevOp (BitCodeAbbrevOp::Fixed , 16 )); // Text size.
520
520
Abbrev->Add (BitCodeAbbrevOp (BitCodeAbbrevOp::Blob)); // FixIt text.
521
521
Abbrevs.set (RECORD_FIXIT, Stream.EmitBlockInfoAbbrev (BLOCK_DIAG,
0 commit comments