@@ -13,10 +13,7 @@ struct RustArchiveMember {
13
13
Archive::Child Child;
14
14
15
15
RustArchiveMember ()
16
- : Filename(nullptr ), Name(nullptr ),
17
- Child (nullptr , nullptr , nullptr )
18
- {
19
- }
16
+ : Filename(nullptr ), Name(nullptr ), Child(nullptr , nullptr , nullptr ) {}
20
17
~RustArchiveMember () {}
21
18
};
22
19
@@ -27,11 +24,8 @@ struct RustArchiveIterator {
27
24
std::unique_ptr<Error> Err;
28
25
29
26
RustArchiveIterator (Archive::child_iterator Cur, Archive::child_iterator End,
30
- std::unique_ptr<Error> Err)
31
- : First(true ),
32
- Cur (Cur),
33
- End(End),
34
- Err(std::move(Err)) {}
27
+ std::unique_ptr<Error> Err)
28
+ : First(true ), Cur(Cur), End(End), Err(std::move(Err)) {}
35
29
};
36
30
37
31
enum class LLVMRustArchiveKind {
@@ -66,8 +60,8 @@ typedef Archive::Child const *LLVMRustArchiveChildConstRef;
66
60
typedef RustArchiveIterator *LLVMRustArchiveIteratorRef;
67
61
68
62
extern " C" LLVMRustArchiveRef LLVMRustOpenArchive (char *Path) {
69
- ErrorOr<std::unique_ptr<MemoryBuffer>> BufOr =
70
- MemoryBuffer::getFile ( Path, /* IsText*/ false , /* RequiresNullTerminator=*/ false );
63
+ ErrorOr<std::unique_ptr<MemoryBuffer>> BufOr = MemoryBuffer::getFile (
64
+ Path, /* IsText*/ false , /* RequiresNullTerminator=*/ false );
71
65
if (!BufOr) {
72
66
LLVMRustSetLastError (BufOr.getError ().message ().c_str ());
73
67
return nullptr ;
@@ -146,8 +140,8 @@ extern "C" const char *
146
140
LLVMRustArchiveChildName (LLVMRustArchiveChildConstRef Child, size_t *Size ) {
147
141
Expected<StringRef> NameOrErr = Child->getName ();
148
142
if (!NameOrErr) {
149
- // rustc_codegen_llvm currently doesn't use this error string, but it might be
150
- // useful in the future, and in the meantime this tells LLVM that the
143
+ // rustc_codegen_llvm currently doesn't use this error string, but it might
144
+ // be useful in the future, and in the meantime this tells LLVM that the
151
145
// error was not ignored and that it shouldn't abort the process.
152
146
LLVMRustSetLastError (toString (NameOrErr.takeError ()).c_str ());
153
147
return nullptr ;
@@ -172,10 +166,9 @@ extern "C" void LLVMRustArchiveMemberFree(LLVMRustArchiveMemberRef Member) {
172
166
delete Member;
173
167
}
174
168
175
- extern " C" LLVMRustResult
176
- LLVMRustWriteArchive (char *Dst, size_t NumMembers,
177
- const LLVMRustArchiveMemberRef *NewMembers,
178
- bool WriteSymbtab, LLVMRustArchiveKind RustKind, bool isEC) {
169
+ extern " C" LLVMRustResult LLVMRustWriteArchive (
170
+ char *Dst, size_t NumMembers, const LLVMRustArchiveMemberRef *NewMembers,
171
+ bool WriteSymbtab, LLVMRustArchiveKind RustKind, bool isEC) {
179
172
180
173
std::vector<NewArchiveMember> Members;
181
174
auto Kind = fromRust (RustKind);
@@ -206,8 +199,10 @@ LLVMRustWriteArchive(char *Dst, size_t NumMembers,
206
199
#if LLVM_VERSION_LT(18, 0)
207
200
auto Result = writeArchive (Dst, Members, WriteSymbtab, Kind, true , false );
208
201
#else
209
- auto SymtabMode = WriteSymbtab ? SymtabWritingMode::NormalSymtab : SymtabWritingMode::NoSymtab;
210
- auto Result = writeArchive (Dst, Members, SymtabMode, Kind, true , false , nullptr , isEC);
202
+ auto SymtabMode = WriteSymbtab ? SymtabWritingMode::NormalSymtab
203
+ : SymtabWritingMode::NoSymtab;
204
+ auto Result =
205
+ writeArchive (Dst, Members, SymtabMode, Kind, true , false , nullptr , isEC);
211
206
#endif
212
207
if (!Result)
213
208
return LLVMRustResult::Success;
0 commit comments