summaryrefslogtreecommitdiffstats
path: root/source/compiler-core/slang-json-diagnostics.cpp
blob: 1d35e8faff24fdefb55ba879b2d136f5e4446488 (plain)
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
// slang-json-diagnostics.cpp
#include "slang-json-diagnostics.h"

namespace Slang {

namespace JSONDiagnostics
{
#define DIAGNOSTIC(id, severity, name, messageFormat) const DiagnosticInfo name = { id, Severity::severity, #name, messageFormat };
#include "slang-json-diagnostic-defs.h"
#undef DIAGNOSTIC
}

static const DiagnosticInfo* const kJSONDiagnostics[] =
{
#define DIAGNOSTIC(id, severity, name, messageFormat) &JSONDiagnostics::name, 
#include "slang-json-diagnostic-defs.h"
#undef DIAGNOSTIC
};

static DiagnosticsLookup* _newJSONDiagnosticsLookup()
{
    auto lookup = new DiagnosticsLookup;
    lookup->add(kJSONDiagnostics, SLANG_COUNT_OF(kJSONDiagnostics));
    return lookup;
}

DiagnosticsLookup* getJSONDiagnosticsLookup()
{
    static RefPtr<DiagnosticsLookup> s_lookup = _newJSONDiagnosticsLookup();
    return s_lookup;
}

} // namespace Slang