@@ -624,6 +624,16 @@ static StringRef getDumpString(ExecutionKind kind) {
624624 return " caller" ;
625625 }
626626}
627+ static StringRef getDumpString (ExplicitSafety safety) {
628+ switch (safety) {
629+ case ExplicitSafety::Unspecified:
630+ return " unspecified" ;
631+ case ExplicitSafety::Safe:
632+ return " safe" ;
633+ case ExplicitSafety::Unsafe:
634+ return " unsafe" ;
635+ }
636+ }
627637static StringRef getDumpString (StringRef s) {
628638 return s;
629639}
@@ -1924,16 +1934,38 @@ namespace {
19241934 }
19251935
19261936 void printInherited (InheritedTypes Inherited) {
1927- printStringListField (Inherited.getEntries (), [&](InheritedEntry Super) {
1928- if (Writer.isParsable ()) {
1929- return typeUSR (Super.getType ());
1930- } else {
1931- std::string value;
1932- llvm::raw_string_ostream SOS (value);
1933- Super.getType ().print (SOS);
1934- return value;
1935- }
1936- }, Label::always (" inherits" ), /* delimiter=*/ " , " );
1937+ if (Writer.isParsable ()) {
1938+ printList (
1939+ Inherited.getEntries (),
1940+ [&](InheritedEntry Super, Label label) {
1941+ printRecArbitrary (
1942+ [&](Label label) {
1943+ printHead (" inherited_entry" , FieldLabelColor, label);
1944+ printTypeField (Super.getType (), Label::always (" type" ));
1945+ printFlag (Super.isPreconcurrency (), " preconcurrency" );
1946+ printFlag (Super.isRetroactive (), " retroactive" );
1947+ printFlag (Super.isSuppressed (), " suppressed" );
1948+ printFlag (Super.isUnchecked (), " unchecked" );
1949+ if (Super.getExplicitSafety () !=
1950+ ExplicitSafety::Unspecified)
1951+ printField (Super.getExplicitSafety (),
1952+ Label::always (" safety" ));
1953+ printFoot ();
1954+ },
1955+ label);
1956+ },
1957+ Label::always (" inherits" ));
1958+ } else {
1959+ printStringListField (
1960+ Inherited.getEntries (),
1961+ [&](InheritedEntry Super) {
1962+ std::string value;
1963+ llvm::raw_string_ostream SOS (value);
1964+ Super.dump (SOS);
1965+ return value;
1966+ },
1967+ Label::always (" inherits" ), /* delimiter=*/ " , " );
1968+ }
19371969 }
19381970
19391971 void printImportPath (ImportDecl *ID, Label label) {
@@ -6504,3 +6536,19 @@ void SILResultInfo::dump() const {
65046536 print (llvm::errs ());
65056537 llvm::errs () << ' \n ' ;
65066538}
6539+
6540+ void InheritedEntry::dump (llvm::raw_ostream &os) const {
6541+ if (isPreconcurrency ())
6542+ os << " @preconcurrency " ;
6543+ if (isRetroactive ())
6544+ os << " @retroactive " ;
6545+ if (isUnchecked ())
6546+ os << " @unchecked " ;
6547+ if (getExplicitSafety () != ExplicitSafety::Unspecified)
6548+ os << ' @' << getDumpString (getExplicitSafety ()) << ' ' ;
6549+ if (isSuppressed ())
6550+ os << " ~" ;
6551+ getType ().print (os);
6552+ }
6553+
6554+ void InheritedEntry::dump () const { dump (llvm::errs ()); }
0 commit comments