@@ -4716,7 +4716,8 @@ static void printFixIts(CXDiagnostic D, unsigned indent) {
4716
4716
}
4717
4717
}
4718
4718
4719
- static void printDiagnosticSet (CXDiagnosticSet Diags , unsigned indent ) {
4719
+ static void printDiagnosticSet (
4720
+ CXDiagnosticSet Diags , unsigned indent , CXDiagnosticSet TopDiags ) {
4720
4721
unsigned i , n ;
4721
4722
4722
4723
if (!Diags )
@@ -4766,15 +4767,15 @@ static void printDiagnosticSet(CXDiagnosticSet Diags, unsigned indent) {
4766
4767
printFixIts (D , indent );
4767
4768
4768
4769
// If we have the source file contents for this file, print them now.
4769
- FileContents = clang_getDiagnosticFileContents (Diags , File , 0 );
4770
+ FileContents = clang_getDiagnosticFileContents (TopDiags , File , 0 );
4770
4771
if (FileContents ) {
4771
4772
CXSourceRange OriginalSourceRange ;
4772
4773
4773
4774
fprintf (stderr , "CONTENTS OF FILE %s:\n" ,
4774
4775
FileNameStr ? FileNameStr : "(null)" );
4775
4776
4776
4777
OriginalSourceRange = clang_getDiagnosticFileOriginalSourceRange (
4777
- Diags , File );
4778
+ TopDiags , File );
4778
4779
if (!clang_equalRanges (clang_getNullRange (), OriginalSourceRange )) {
4779
4780
printIndent (indent );
4780
4781
fprintf (stderr , "Original source range: " );
@@ -4788,7 +4789,7 @@ static void printDiagnosticSet(CXDiagnosticSet Diags, unsigned indent) {
4788
4789
}
4789
4790
4790
4791
/* Print subdiagnostics. */
4791
- printDiagnosticSet (clang_getChildDiagnostics (D ), indent + 2 );
4792
+ printDiagnosticSet (clang_getChildDiagnostics (D ), indent + 2 , TopDiags );
4792
4793
4793
4794
clang_disposeString (FileName );
4794
4795
clang_disposeString (DiagSpelling );
@@ -4811,7 +4812,7 @@ static int read_diagnostics(const char *filename) {
4811
4812
return 1 ;
4812
4813
}
4813
4814
4814
- printDiagnosticSet (Diags , 0 );
4815
+ printDiagnosticSet (Diags , 0 , Diags );
4815
4816
fprintf (stderr , "Number of diagnostics: %d\n" ,
4816
4817
clang_getNumDiagnosticsInSet (Diags ));
4817
4818
clang_disposeDiagnosticSet (Diags );
0 commit comments