Skip to content

Commit 25de443

Browse files
committed
[NFC] make constructor explicit LiveRange
Without it it can lead to crazy situtation, when passing a LiveRange* to a function expecting a const LiveRange& the LiveRange* is converted to bool and a new empty LiveRange is created.
1 parent cf275f9 commit 25de443

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/include/llvm/CodeGen/LiveInterval.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,9 @@ namespace llvm {
237237
}
238238

239239
/// Constructs a new LiveRange object.
240-
LiveRange(bool UseSegmentSet = false)
241-
: segmentSet(UseSegmentSet ? std::make_unique<SegmentSet>()
242-
: nullptr) {}
240+
explicit LiveRange(bool UseSegmentSet = false)
241+
: segmentSet(UseSegmentSet ? std::make_unique<SegmentSet>() : nullptr) {
242+
}
243243

244244
/// Constructs a new LiveRange object by copying segments and valnos from
245245
/// another LiveRange.

0 commit comments

Comments
 (0)