@@ -625,6 +625,16 @@ static StringRef getDumpString(ExecutionKind kind) {
625625 return " caller" ;
626626 }
627627}
628+ static StringRef getDumpString (ExplicitSafety safety) {
629+ switch (safety) {
630+ case ExplicitSafety::Unspecified:
631+ return " unspecified" ;
632+ case ExplicitSafety::Safe:
633+ return " safe" ;
634+ case ExplicitSafety::Unsafe:
635+ return " unsafe" ;
636+ }
637+ }
628638static StringRef getDumpString (StringRef s) {
629639 return s;
630640}
@@ -1925,16 +1935,38 @@ namespace {
19251935 }
19261936
19271937 void printInherited (InheritedTypes Inherited) {
1928- printStringListField (Inherited.getEntries (), [&](InheritedEntry Super) {
1929- if (Writer.isParsable ()) {
1930- return typeUSR (Super.getType ());
1931- } else {
1932- std::string value;
1933- llvm::raw_string_ostream SOS (value);
1934- Super.getType ().print (SOS);
1935- return value;
1936- }
1937- }, Label::always (" inherits" ), /* delimiter=*/ " , " );
1938+ if (Writer.isParsable ()) {
1939+ printList (
1940+ Inherited.getEntries (),
1941+ [&](InheritedEntry Super, Label label) {
1942+ printRecArbitrary (
1943+ [&](Label label) {
1944+ printHead (" inherited_entry" , FieldLabelColor, label);
1945+ printTypeField (Super.getType (), Label::always (" type" ));
1946+ printFlag (Super.isPreconcurrency (), " preconcurrency" );
1947+ printFlag (Super.isRetroactive (), " retroactive" );
1948+ printFlag (Super.isSuppressed (), " suppressed" );
1949+ printFlag (Super.isUnchecked (), " unchecked" );
1950+ if (Super.getExplicitSafety () !=
1951+ ExplicitSafety::Unspecified)
1952+ printField (Super.getExplicitSafety (),
1953+ Label::always (" safety" ));
1954+ printFoot ();
1955+ },
1956+ label);
1957+ },
1958+ Label::always (" inherits" ));
1959+ } else {
1960+ printStringListField (
1961+ Inherited.getEntries (),
1962+ [&](InheritedEntry Super) {
1963+ std::string value;
1964+ llvm::raw_string_ostream SOS (value);
1965+ Super.dump (SOS);
1966+ return value;
1967+ },
1968+ Label::always (" inherits" ), /* delimiter=*/ " , " );
1969+ }
19381970 }
19391971
19401972 void printImportPath (ImportDecl *ID, Label label) {
@@ -6526,3 +6558,19 @@ void SILResultInfo::dump() const {
65266558 print (llvm::errs ());
65276559 llvm::errs () << ' \n ' ;
65286560}
6561+
6562+ void InheritedEntry::dump (llvm::raw_ostream &os) const {
6563+ if (isPreconcurrency ())
6564+ os << " @preconcurrency " ;
6565+ if (isRetroactive ())
6566+ os << " @retroactive " ;
6567+ if (isUnchecked ())
6568+ os << " @unchecked " ;
6569+ if (getExplicitSafety () != ExplicitSafety::Unspecified)
6570+ os << ' @' << getDumpString (getExplicitSafety ()) << ' ' ;
6571+ if (isSuppressed ())
6572+ os << " ~" ;
6573+ getType ().print (os);
6574+ }
6575+
6576+ void InheritedEntry::dump () const { dump (llvm::errs ()); }
0 commit comments