private bool DealingWithDiagnostic(CXDiagnostic d) { // error spelling string spelling = clang.getDiagnosticSpelling(d).ToString(); // category text string categoryText = clang.getDiagnosticCategoryText(d).ToString(); // severity text CXDiagnosticSeverity severity = clang.getDiagnosticSeverity(d); string severityStr = ClangTraits.ToString(severity); // source location CXSourceLocation location = clang.getDiagnosticLocation(d); CXFile file = new CXFile(IntPtr.Zero); clang.getInstantiationLocation( location, out file, out uint line, out uint column, out uint offset); string fileName = clang.getFileName(file).ToString(); clang.disposeDiagnostic(d); string errorString = string.Format("{0}: {1}-{2}, IN {3}, line: {4}, column: {5}", severityStr, spelling, categoryText, fileName, line, column); return(ClangTraits.IsFatal(severity)); }