1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
// slang-artifact-diagnostic-util.h
#ifndef SLANG_ARTIFACT_DIAGNOSTIC_UTIL_H
#define SLANG_ARTIFACT_DIAGNOSTIC_UTIL_H
#include "slang-artifact-associated.h"
#include "slang-artifact.h"
#include "slang-slice-allocator.h"
namespace Slang
{
struct ArtifactDiagnosticUtil
{
typedef ArtifactDiagnostic::Severity Severity;
/// Given severity return as text
static UnownedStringSlice getSeverityText(Severity severity);
/// Given a path, that holds line number and potentially column number in () after path, writes
/// result into outDiagnostic
static SlangResult splitPathLocation(
SliceAllocator& allocator,
const UnownedStringSlice& pathLocation,
ArtifactDiagnostic& outDiagnostic);
/// Split the line (separated by :), where a path is at pathIndex
static SlangResult splitColonDelimitedLine(
const UnownedStringSlice& line,
Int pathIndex,
List<UnownedStringSlice>& outSlices);
typedef SlangResult (*LineParser)(
SliceAllocator& allocator,
const UnownedStringSlice& line,
List<UnownedStringSlice>& lineSlices,
ArtifactDiagnostic& outDiagnostic);
/// Given diagnostics in inText that are colon delimited, use lineParser to do per line parsing.
static SlangResult parseColonDelimitedDiagnostics(
SliceAllocator& allocator,
const UnownedStringSlice& inText,
Int pathIndex,
LineParser lineParser,
IArtifactDiagnostics* diagnostics);
/// Maybe add a note
static void maybeAddNote(const UnownedStringSlice& in, IArtifactDiagnostics* diagnostics);
};
} // namespace Slang
#endif
|