File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -395,17 +395,30 @@ class OptionalStorage<AbsoluteRawSyntax> {
395
395
396
396
void reset () { Storage = AbsoluteRawSyntax (nullptr ); }
397
397
398
+ bool has_value () const { return !Storage.isNull (); }
398
399
bool hasValue () const { return !Storage.isNull (); }
399
400
401
+ AbsoluteRawSyntax &value () & {
402
+ assert (hasValue ());
403
+ return Storage;
404
+ }
400
405
AbsoluteRawSyntax &getValue () & {
401
406
assert (hasValue ());
402
407
return Storage;
403
408
}
409
+ AbsoluteRawSyntax const &value () const & {
410
+ assert (hasValue ());
411
+ return Storage;
412
+ }
404
413
AbsoluteRawSyntax const &getValue () const & {
405
414
assert (hasValue ());
406
415
return Storage;
407
416
}
408
417
#if LLVM_HAS_RVALUE_REFERENCE_THIS
418
+ AbsoluteRawSyntax &&value() &&noexcept {
419
+ assert (hasValue ());
420
+ return std::move (Storage);
421
+ }
409
422
AbsoluteRawSyntax &&getValue() &&noexcept {
410
423
assert (hasValue ());
411
424
return std::move (Storage);
Original file line number Diff line number Diff line change @@ -414,17 +414,30 @@ class OptionalStorage<SyntaxDataRef> {
414
414
415
415
void reset () { Storage = SyntaxDataRef (AbsoluteRawSyntax (nullptr ), nullptr ); }
416
416
417
+ bool has_value () const { return !Storage.getAbsoluteRaw ().isNull (); }
417
418
bool hasValue () const { return !Storage.getAbsoluteRaw ().isNull (); }
418
419
420
+ SyntaxDataRef &value () & {
421
+ assert (hasValue ());
422
+ return Storage;
423
+ }
419
424
SyntaxDataRef &getValue () & {
420
425
assert (hasValue ());
421
426
return Storage;
422
427
}
428
+ SyntaxDataRef const &value () const & {
429
+ assert (hasValue ());
430
+ return Storage;
431
+ }
423
432
SyntaxDataRef const &getValue () const & {
424
433
assert (hasValue ());
425
434
return Storage;
426
435
}
427
436
#if LLVM_HAS_RVALUE_REFERENCE_THIS
437
+ SyntaxDataRef &&value() &&noexcept {
438
+ assert (hasValue ());
439
+ return std::move (Storage);
440
+ }
428
441
SyntaxDataRef &&getValue() &&noexcept {
429
442
assert (hasValue ());
430
443
return std::move (Storage);
You can’t perform that action at this time.
0 commit comments