//===--- DiagnosticGroups.h - Diagnostic Groups -----------------*- C++ -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2024 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// // // This file defines the diagnostic groups enumaration, group graph // and auxilary functions. // //===----------------------------------------------------------------------===// #ifndef SWIFT_DIAGNOSTICGROUPS_H #define SWIFT_DIAGNOSTICGROUPS_H #include "llvm/ADT/ArrayRef.h" #include #include #include namespace swift { enum class DiagID : uint32_t; enum class DiagGroupID : uint16_t { #define GROUP(Name, Version) Name, #include "swift/AST/DiagnosticGroups.def" }; constexpr const auto DiagGroupsCount = [] { size_t count = 0; #define GROUP(Name, Version) ++count; #include "DiagnosticGroups.def" return count; }(); struct DiagGroupInfo { DiagGroupID id; std::string_view name; std::string_view documentationFile; llvm::ArrayRef supergroups; llvm::ArrayRef subgroups; llvm::ArrayRef diagnostics; void traverseDepthFirst( llvm::function_ref func) const; }; extern const std::array diagnosticGroupsInfo; const DiagGroupInfo &getDiagGroupInfoByID(DiagGroupID id); std::optional getDiagGroupIDByName(std::string_view name); } // end namespace swift #endif /* SWIFT_DIAGNOSTICGROUPS_H */