@@ -513,7 +513,7 @@ enum class OperatorKind {
513
513
};
514
514
515
515
// / A mangling error, which consists of an error code and a Node pointer
516
- struct ManglingError {
516
+ struct SWIFT_NODISCARD ManglingError {
517
517
enum Code {
518
518
Success = 0 ,
519
519
Uninitialized,
@@ -524,20 +524,32 @@ struct ManglingError {
524
524
UnsupportedNodeKind,
525
525
UnexpectedBuiltinVectorType,
526
526
UnexpectedBuiltinType,
527
+ MultipleChildNodes,
528
+ WrongNodeType,
529
+ WrongDependentMemberType,
530
+ BadDirectness,
531
+ UnknownEncoding,
532
+ InvalidImplCalleeConvention,
533
+ InvalidImplDifferentiability,
534
+ InvalidImplFunctionAttribute,
535
+ InvalidImplParameterConvention,
536
+ InvalidMetatypeRepresentation,
537
+ MultiByteRelatedEntity,
527
538
};
528
539
529
540
Code code;
530
541
NodePointer node;
531
542
532
543
ManglingError () : code(Uninitialized), node(nullptr ) {}
533
- ManglingError (Code c, NodePointer n = nullptr ) : code(c), node(n) {}
544
+ ManglingError (Code c) : code(c), node(nullptr ) {}
545
+ ManglingError (Code c, NodePointer n) : code(c), node(n) {}
534
546
535
547
bool isSuccess () const { return code == Success; }
536
548
};
537
549
538
550
// / Used as a return type for mangling functions that may fail
539
551
template <typename T>
540
- class ManglingErrorOr {
552
+ class SWIFT_NODISCARD ManglingErrorOr {
541
553
private:
542
554
ManglingError err_;
543
555
T value_;
@@ -552,6 +564,7 @@ class ManglingErrorOr {
552
564
553
565
bool isSuccess () const { return err_.code == ManglingError::Success; }
554
566
567
+ const ManglingError &error () const { return err_; }
555
568
ManglingError::Code errorCode () const { return err_.code ; }
556
569
NodePointer errorNode () const { return err_.node ; }
557
570
0 commit comments