SILICON
Loading...
Searching...
No Matches
isaArchitecture.hpp
Go to the documentation of this file.
1/*
2 Copyright (c) 2026. Giulio Cocconi
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#pragma once
19
20#include <optional>
21#include <string>
22#include <string_view>
23#include <vector>
24
25#include <sisl/sisl.hpp>
26
27namespace SILICON::project {
28
30[[nodiscard]] bool isArchitecturePathSlug(std::string_view name);
32[[nodiscard]] bool isValidArchitectureName(std::string_view name);
34[[nodiscard]] std::optional<std::string>
35declaredArchitectureName(std::string_view source);
37[[nodiscard]] std::string renameArchitectureDeclaration(std::string_view source,
38 std::string_view oldName,
39 std::string_view newName);
41void validateArchitectureDeclaration(std::string_view directoryName,
42 std::string_view source);
43[[nodiscard]] std::string architectureDirectory(std::string_view name);
44
48 std::optional<sisl::Isa> isa;
50 std::vector<sisl::Diagnostic> diagnostics;
52 std::optional<std::string> error;
53
54 [[nodiscard]] bool success() const noexcept { return isa.has_value(); }
55 explicit operator bool() const noexcept { return success(); }
56};
57
68[[nodiscard]] ArchitectureBuildResult
69buildArchitecture(std::optional<std::string> expectedName, std::string_view source);
70
71} // namespace SILICON::project
std::optional< std::string > declaredArchitectureName(const std::string_view source)
std::string renameArchitectureDeclaration(const std::string_view source, const std::string_view oldName, const std::string_view newName)
void validateArchitectureDeclaration(const std::string_view directoryName, const std::string_view source)
ArchitectureBuildResult buildArchitecture(const std::optional< std::string > expectedName, const std::string_view source)
bool isValidArchitectureName(const std::string_view name)
bool isArchitecturePathSlug(const std::string_view name)
std::string architectureDirectory(const std::string_view name)
std::vector< sisl::Diagnostic > diagnostics