GCC Code Coverage Report


Directory: ../
File: src/util/CompilerWarning.h
Date: 2025-02-05 01:09:36
Exec Total Coverage
Lines: 0 0 -%
Functions: 0 0 -%
Branches: 0 0 -%

Line Branch Exec Source
1 // Copyright (c) 2021-2025 ChilliBits. All rights reserved.
2
3 #pragma once
4
5 #include <cstdint>
6 #include <string>
7
8 namespace spice::compiler {
9
10 // Forward declaration
11 struct CodeLoc;
12
13 enum CompilerWarningType : uint8_t {
14 UNUSED_FUNCTION,
15 UNUSED_PROCEDURE,
16 UNUSED_METHOD,
17 UNUSED_STRUCT,
18 UNUSED_INTERFACE,
19 UNUSED_IMPORT,
20 UNUSED_FIELD,
21 UNUSED_ENUM_ITEM,
22 UNUSED_ALIAS,
23 UNUSED_VARIABLE,
24 UNUSED_RETURN_VALUE,
25 UNREACHABLE_CODE,
26 SHADOWED_VARIABLE,
27 IDENTITY_CAST,
28 SINGLE_GENERIC_TYPE_CONDITION,
29 BOOL_ASSIGN_AS_CONDITION,
30 ASYNC_LAMBDA_CAPTURE_RULE_VIOLATION,
31 UNINSTALL_FAILED,
32 VERIFIER_DISABLED
33 };
34
35 /**
36 * Compiler warning template engine
37 */
38 class CompilerWarning {
39 public:
40 // Constructors
41 explicit CompilerWarning(const CodeLoc &codeLoc, CompilerWarningType type, const std::string &message);
42 explicit CompilerWarning(CompilerWarningType type, const std::string &message);
43
44 // Public methods
45 void print() const;
46
47 // Public members
48 std::string warningMessage;
49
50 private:
51 // Private methods
52 [[nodiscard]] static std::string getMessagePrefix(CompilerWarningType warningType);
53 };
54
55 } // namespace spice::compiler
56