@@ -4746,7 +4746,8 @@ static void printFixIts(CXDiagnostic D, unsigned indent) {
4746
4746
}
4747
4747
}
4748
4748
4749
- static void printDiagnosticSet (CXDiagnosticSet Diags , unsigned indent ) {
4749
+ static void printDiagnosticSet (
4750
+ CXDiagnosticSet Diags , unsigned indent , CXDiagnosticSet TopDiags ) {
4750
4751
unsigned i , n ;
4751
4752
4752
4753
if (!Diags )
@@ -4796,15 +4797,15 @@ static void printDiagnosticSet(CXDiagnosticSet Diags, unsigned indent) {
4796
4797
printFixIts (D , indent );
4797
4798
4798
4799
// If we have the source file contents for this file, print them now.
4799
- FileContents = clang_getDiagnosticFileContents (Diags , File , 0 );
4800
+ FileContents = clang_getDiagnosticFileContents (TopDiags , File , 0 );
4800
4801
if (FileContents ) {
4801
4802
CXSourceRange OriginalSourceRange ;
4802
4803
4803
4804
fprintf (stderr , "CONTENTS OF FILE %s:\n" ,
4804
4805
FileNameStr ? FileNameStr : "(null)" );
4805
4806
4806
4807
OriginalSourceRange = clang_getDiagnosticFileOriginalSourceRange (
4807
- Diags , File );
4808
+ TopDiags , File );
4808
4809
if (!clang_equalRanges (clang_getNullRange (), OriginalSourceRange )) {
4809
4810
printIndent (indent );
4810
4811
fprintf (stderr , "Original source range: " );
@@ -4818,7 +4819,7 @@ static void printDiagnosticSet(CXDiagnosticSet Diags, unsigned indent) {
4818
4819
}
4819
4820
4820
4821
/* Print subdiagnostics. */
4821
- printDiagnosticSet (clang_getChildDiagnostics (D ), indent + 2 );
4822
+ printDiagnosticSet (clang_getChildDiagnostics (D ), indent + 2 , TopDiags );
4822
4823
4823
4824
clang_disposeString (FileName );
4824
4825
clang_disposeString (DiagSpelling );
@@ -4841,7 +4842,7 @@ static int read_diagnostics(const char *filename) {
4841
4842
return 1 ;
4842
4843
}
4843
4844
4844
- printDiagnosticSet (Diags , 0 );
4845
+ printDiagnosticSet (Diags , 0 , Diags );
4845
4846
fprintf (stderr , "Number of diagnostics: %d\n" ,
4846
4847
clang_getNumDiagnosticsInSet (Diags ));
4847
4848
clang_disposeDiagnosticSet (Diags );
0 commit comments