yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Ellie Hermaszewskaformatf65d756bf

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