• Home
  • Raw
  • Download

Lines Matching full:diagnostic

15 #include "source/diagnostic.h"
25 // Diagnostic API
29 spv_diagnostic diagnostic = new spv_diagnostic_t; in spvDiagnosticCreate() local
30 if (!diagnostic) return nullptr; in spvDiagnosticCreate()
32 diagnostic->error = new char[length]; in spvDiagnosticCreate()
33 if (!diagnostic->error) { in spvDiagnosticCreate()
34 delete diagnostic; in spvDiagnosticCreate()
37 diagnostic->position = *position; in spvDiagnosticCreate()
38 diagnostic->isTextSource = false; in spvDiagnosticCreate()
39 memset(diagnostic->error, 0, length); in spvDiagnosticCreate()
40 strcpy(diagnostic->error, message); in spvDiagnosticCreate()
41 return diagnostic; in spvDiagnosticCreate()
44 void spvDiagnosticDestroy(spv_diagnostic diagnostic) { in spvDiagnosticDestroy() argument
45 if (!diagnostic) return; in spvDiagnosticDestroy()
46 delete[] diagnostic->error; in spvDiagnosticDestroy()
47 delete diagnostic; in spvDiagnosticDestroy()
50 spv_result_t spvDiagnosticPrint(const spv_diagnostic diagnostic) { in spvDiagnosticPrint() argument
51 if (!diagnostic) return SPV_ERROR_INVALID_DIAGNOSTIC; in spvDiagnosticPrint()
53 if (diagnostic->isTextSource) { in spvDiagnosticPrint()
57 std::cerr << "error: " << diagnostic->position.line + 1 << ": " in spvDiagnosticPrint()
58 << diagnostic->position.column + 1 << ": " << diagnostic->error in spvDiagnosticPrint()
65 if (diagnostic->position.index > 0) in spvDiagnosticPrint()
66 std::cerr << diagnostic->position.index << ": "; in spvDiagnosticPrint()
67 std::cerr << diagnostic->error << "\n"; in spvDiagnosticPrint()
117 spv_diagnostic* diagnostic) { in UseDiagnosticAsMessageConsumer() argument
118 assert(diagnostic && *diagnostic == nullptr); in UseDiagnosticAsMessageConsumer()
120 auto create_diagnostic = [diagnostic](spv_message_level_t, const char*, in UseDiagnosticAsMessageConsumer()
124 spvDiagnosticDestroy(*diagnostic); // Avoid memory leak. in UseDiagnosticAsMessageConsumer()
125 *diagnostic = spvDiagnosticCreate(&p, message); in UseDiagnosticAsMessageConsumer()