29
29
30
30
namespace buildcc {
31
31
32
- // TODO, Make this private
33
- struct UserToolchainSchema {
34
- std::unordered_set<std::string> preprocessor_flags;
35
- std::unordered_set<std::string> common_compile_flags;
36
- std::unordered_set<std::string> pch_compile_flags;
37
- std::unordered_set<std::string> pch_object_flags;
38
- std::unordered_set<std::string> asm_compile_flags;
39
- std::unordered_set<std::string> c_compile_flags;
40
- std::unordered_set<std::string> cpp_compile_flags;
41
- std::unordered_set<std::string> link_flags;
42
- };
43
-
44
32
// Base toolchain class
45
33
class Toolchain : public internal ::FlagApi<Toolchain>,
46
34
public ToolchainVerify<Toolchain> {
@@ -58,21 +46,18 @@ class Toolchain : public internal::FlagApi<Toolchain>,
58
46
explicit Toolchain (Id id, std::string_view name,
59
47
std::string_view asm_compiler, std::string_view c_compiler,
60
48
std::string_view cpp_compiler, std::string_view archiver,
61
- std::string_view linker, bool locked = true ,
49
+ std::string_view linker, bool lock = true ,
62
50
const ToolchainConfig &config = ToolchainConfig())
63
51
: id_(id), name_(name), asm_compiler_(asm_compiler),
64
52
c_compiler_(c_compiler), cpp_compiler_(cpp_compiler),
65
- archiver_(archiver), linker_(linker), config_(config) {
66
- locked ? lock_.Lock () : lock_.Unlock ();
67
- UpdateConfig (config_);
53
+ archiver_(archiver), linker_(linker), config_(config), lock_(lock) {
54
+ Initialize ();
68
55
}
69
56
70
57
Toolchain (Toolchain &&toolchain) = default ;
71
58
Toolchain (const Toolchain &toolchain) = delete ;
72
- void Lock () {
73
- lock_.Lock ();
74
- // TODO, In the future add some more code here
75
- }
59
+
60
+ void Lock ();
76
61
77
62
// Getters
78
63
Id GetId () const { return id_; }
@@ -86,8 +71,21 @@ class Toolchain : public internal::FlagApi<Toolchain>,
86
71
const FunctionLock &GetLockInfo () const { return lock_; }
87
72
const ToolchainConfig &GetConfig () const { return config_; }
88
73
74
+ private:
75
+ struct UserSchema {
76
+ std::unordered_set<std::string> preprocessor_flags;
77
+ std::unordered_set<std::string> common_compile_flags;
78
+ std::unordered_set<std::string> pch_compile_flags;
79
+ std::unordered_set<std::string> pch_object_flags;
80
+ std::unordered_set<std::string> asm_compile_flags;
81
+ std::unordered_set<std::string> c_compile_flags;
82
+ std::unordered_set<std::string> cpp_compile_flags;
83
+ std::unordered_set<std::string> link_flags;
84
+ };
85
+
89
86
private:
90
87
virtual void UpdateConfig (ToolchainConfig &config) { (void )config; }
88
+ void Initialize ();
91
89
92
90
private:
93
91
friend class internal ::FlagApi<Toolchain>;
@@ -106,10 +104,10 @@ class Toolchain : public internal::FlagApi<Toolchain>,
106
104
std::string archiver_;
107
105
std::string linker_;
108
106
ToolchainConfig config_;
107
+ FunctionLock lock_;
109
108
110
109
//
111
- UserToolchainSchema user_;
112
- FunctionLock lock_;
110
+ UserSchema user_;
113
111
};
114
112
115
113
typedef Toolchain::Id ToolchainId;
0 commit comments