@@ -625,6 +625,16 @@ static StringRef getDumpString(ExecutionKind kind) {
625
625
return " caller" ;
626
626
}
627
627
}
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
+ }
628
638
static StringRef getDumpString (StringRef s) {
629
639
return s;
630
640
}
@@ -1925,16 +1935,38 @@ namespace {
1925
1935
}
1926
1936
1927
1937
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
+ }
1938
1970
}
1939
1971
1940
1972
void printImportPath (ImportDecl *ID, Label label) {
@@ -6526,3 +6558,19 @@ void SILResultInfo::dump() const {
6526
6558
print (llvm::errs ());
6527
6559
llvm::errs () << ' \n ' ;
6528
6560
}
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