GCC Code Coverage Report


Directory: ../
File: src/util/CompilerWarning.h
Date: 2025-03-05 01:50:32
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 INEFFECTIVE_GENERIC_TYPE_CONDITION,
30 BOOL_ASSIGN_AS_CONDITION,
31 ASYNC_LAMBDA_CAPTURE_RULE_VIOLATION,
32 UNINSTALL_FAILED,
33 VERIFIER_DISABLED
34 };
35
36 /**
37 * Compiler warning template engine
38 */
39 class CompilerWarning {
40 public:
41 // Constructors
42 explicit CompilerWarning(const CodeLoc &codeLoc, CompilerWarningType type, const std::string &message);
43 explicit CompilerWarning(CompilerWarningType type, const std::string &message);
44
45 // Public methods
46 void print() const;
47
48 // Public members
49 std::string warningMessage;
50
51 private:
52 // Private methods
53 [[nodiscard]] static std::string getMessagePrefix(CompilerWarningType warningType);
54 };
55
56 } // namespace spice::compiler
57