summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ir-missing-return.h
blob: 68c652ebe2636be0f32763ba0a591351e0ffe861 (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
// slang-ir-missing-return.h
#pragma once

namespace Slang
{
class DiagnosticSink;
struct IRModule;
enum class CodeGenTarget;

/// This IR check pass is performed twice, once during IR lowering(with no code gen target
/// specified) and once during linking(with code gen target specified).
///
/// Some code gen targets allow missing returns while some do not. The first pass, where no target
/// is specified, emit warnings on missing returns, and the second pass may additionally emit errors
/// when compiling for targets that do not support missing returns.
///
/// On the second pass, `diagnoseWarning` is set to false to suppress warnings, ensuring that only
/// errors are emitted. This prevents duplicate warnings from appearing in both passes.
void checkForMissingReturns(
    IRModule* module,
    DiagnosticSink* sink,
    CodeGenTarget target,
    bool diagnoseWarning);

} // namespace Slang