about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp
diff options
context:
space:
mode:
authorDianQK <dianqk@dianqk.net>2024-06-04 22:46:20 +0800
committerDianQK <dianqk@dianqk.net>2024-06-26 20:18:49 +0800
commite17c16d55b20b9d2702fafa017263406d1e94042 (patch)
tree6eedc6d087162fe5b3565a634c38ac66cd8285a9 /compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp
parentde0ece2f2935d005232a5062eeb8b916b1d8a41a (diff)
downloadrust-e17c16d55b20b9d2702fafa017263406d1e94042.tar.gz
rust-e17c16d55b20b9d2702fafa017263406d1e94042.zip
Format C++ files in `llvm-wrapper`
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp')
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp33
1 files changed, 14 insertions, 19 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp
index 8871f410e36..a8c278741a7 100644
--- a/compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp
@@ -13,10 +13,7 @@ struct RustArchiveMember {
   Archive::Child Child;
 
   RustArchiveMember()
-      : Filename(nullptr), Name(nullptr),
-        Child(nullptr, nullptr, nullptr)
-  {
-  }
+      : Filename(nullptr), Name(nullptr), Child(nullptr, nullptr, nullptr) {}
   ~RustArchiveMember() {}
 };
 
@@ -27,11 +24,8 @@ struct RustArchiveIterator {
   std::unique_ptr<Error> Err;
 
   RustArchiveIterator(Archive::child_iterator Cur, Archive::child_iterator End,
-      std::unique_ptr<Error> Err)
-    : First(true),
-      Cur(Cur),
-      End(End),
-      Err(std::move(Err)) {}
+                      std::unique_ptr<Error> Err)
+      : First(true), Cur(Cur), End(End), Err(std::move(Err)) {}
 };
 
 enum class LLVMRustArchiveKind {
@@ -66,8 +60,8 @@ typedef Archive::Child const *LLVMRustArchiveChildConstRef;
 typedef RustArchiveIterator *LLVMRustArchiveIteratorRef;
 
 extern "C" LLVMRustArchiveRef LLVMRustOpenArchive(char *Path) {
-  ErrorOr<std::unique_ptr<MemoryBuffer>> BufOr =
-      MemoryBuffer::getFile(Path, /*IsText*/false, /*RequiresNullTerminator=*/false);
+  ErrorOr<std::unique_ptr<MemoryBuffer>> BufOr = MemoryBuffer::getFile(
+      Path, /*IsText*/ false, /*RequiresNullTerminator=*/false);
   if (!BufOr) {
     LLVMRustSetLastError(BufOr.getError().message().c_str());
     return nullptr;
@@ -146,8 +140,8 @@ extern "C" const char *
 LLVMRustArchiveChildName(LLVMRustArchiveChildConstRef Child, size_t *Size) {
   Expected<StringRef> NameOrErr = Child->getName();
   if (!NameOrErr) {
-    // rustc_codegen_llvm currently doesn't use this error string, but it might be
-    // useful in the future, and in the meantime this tells LLVM that the
+    // rustc_codegen_llvm currently doesn't use this error string, but it might
+    // be useful in the future, and in the meantime this tells LLVM that the
     // error was not ignored and that it shouldn't abort the process.
     LLVMRustSetLastError(toString(NameOrErr.takeError()).c_str());
     return nullptr;
@@ -172,10 +166,9 @@ extern "C" void LLVMRustArchiveMemberFree(LLVMRustArchiveMemberRef Member) {
   delete Member;
 }
 
-extern "C" LLVMRustResult
-LLVMRustWriteArchive(char *Dst, size_t NumMembers,
-                     const LLVMRustArchiveMemberRef *NewMembers,
-                     bool WriteSymbtab, LLVMRustArchiveKind RustKind, bool isEC) {
+extern "C" LLVMRustResult LLVMRustWriteArchive(
+    char *Dst, size_t NumMembers, const LLVMRustArchiveMemberRef *NewMembers,
+    bool WriteSymbtab, LLVMRustArchiveKind RustKind, bool isEC) {
 
   std::vector<NewArchiveMember> Members;
   auto Kind = fromRust(RustKind);
@@ -206,8 +199,10 @@ LLVMRustWriteArchive(char *Dst, size_t NumMembers,
 #if LLVM_VERSION_LT(18, 0)
   auto Result = writeArchive(Dst, Members, WriteSymbtab, Kind, true, false);
 #else
-  auto SymtabMode = WriteSymbtab ? SymtabWritingMode::NormalSymtab : SymtabWritingMode::NoSymtab;
-  auto Result = writeArchive(Dst, Members, SymtabMode, Kind, true, false, nullptr, isEC);
+  auto SymtabMode = WriteSymbtab ? SymtabWritingMode::NormalSymtab
+                                 : SymtabWritingMode::NoSymtab;
+  auto Result =
+      writeArchive(Dst, Members, SymtabMode, Kind, true, false, nullptr, isEC);
 #endif
   if (!Result)
     return LLVMRustResult::Success;