diff options
author | Teresa Johnson <tejohnson@google.com> | 2015-11-02 18:02:11 +0000 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2015-11-02 18:02:11 +0000 |
commit | f72278f051552eb4dc90a870fece327d77801fe4 (patch) | |
tree | b9dcf8e67a0acf0bdbc1965f0daa3701c4f823ef /llvm/lib/Object/FunctionIndexObjectFile.cpp | |
parent | 89a6eefe6f2ea949bd7090a7947dc5ec9c11d17f (diff) | |
download | bcm5719-llvm-f72278f051552eb4dc90a870fece327d77801fe4.tar.gz bcm5719-llvm-f72278f051552eb4dc90a870fece327d77801fe4.zip |
Clang format a few prior patches (NFC)
I had clang formatted my earlier patches using the wrong style.
Reformatted with the LLVM style.
llvm-svn: 251812
Diffstat (limited to 'llvm/lib/Object/FunctionIndexObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/FunctionIndexObjectFile.cpp | 63 |
1 files changed, 35 insertions, 28 deletions
diff --git a/llvm/lib/Object/FunctionIndexObjectFile.cpp b/llvm/lib/Object/FunctionIndexObjectFile.cpp index c5f88fc2a2b..b1e8ebc657c 100644 --- a/llvm/lib/Object/FunctionIndexObjectFile.cpp +++ b/llvm/lib/Object/FunctionIndexObjectFile.cpp @@ -1,4 +1,5 @@ -//===- FunctionIndexObjectFile.cpp - Function index file implementation ----===// +//===- FunctionIndexObjectFile.cpp - Function index file implementation +//----===// // // The LLVM Compiler Infrastructure // @@ -32,14 +33,16 @@ std::unique_ptr<FunctionInfoIndex> FunctionIndexObjectFile::takeIndex() { return std::move(Index); } -ErrorOr<MemoryBufferRef> FunctionIndexObjectFile::findBitcodeInObject( - const ObjectFile &Obj) { +ErrorOr<MemoryBufferRef> +FunctionIndexObjectFile::findBitcodeInObject(const ObjectFile &Obj) { for (const SectionRef &Sec : Obj.sections()) { StringRef SecName; - if (std::error_code EC = Sec.getName(SecName)) return EC; + if (std::error_code EC = Sec.getName(SecName)) + return EC; if (SecName == ".llvmbc") { StringRef SecContents; - if (std::error_code EC = Sec.getContents(SecContents)) return EC; + if (std::error_code EC = Sec.getContents(SecContents)) + return EC; return MemoryBufferRef(SecContents, Obj.getFileName()); } } @@ -47,22 +50,23 @@ ErrorOr<MemoryBufferRef> FunctionIndexObjectFile::findBitcodeInObject( return object_error::bitcode_section_not_found; } -ErrorOr<MemoryBufferRef> FunctionIndexObjectFile::findBitcodeInMemBuffer( - MemoryBufferRef Object) { +ErrorOr<MemoryBufferRef> +FunctionIndexObjectFile::findBitcodeInMemBuffer(MemoryBufferRef Object) { sys::fs::file_magic Type = sys::fs::identify_magic(Object.getBuffer()); switch (Type) { - case sys::fs::file_magic::bitcode: - return Object; - case sys::fs::file_magic::elf_relocatable: - case sys::fs::file_magic::macho_object: - case sys::fs::file_magic::coff_object: { - ErrorOr<std::unique_ptr<ObjectFile>> ObjFile = - ObjectFile::createObjectFile(Object, Type); - if (!ObjFile) return ObjFile.getError(); - return findBitcodeInObject(*ObjFile->get()); - } - default: - return object_error::invalid_file_type; + case sys::fs::file_magic::bitcode: + return Object; + case sys::fs::file_magic::elf_relocatable: + case sys::fs::file_magic::macho_object: + case sys::fs::file_magic::coff_object: { + ErrorOr<std::unique_ptr<ObjectFile>> ObjFile = + ObjectFile::createObjectFile(Object, Type); + if (!ObjFile) + return ObjFile.getError(); + return findBitcodeInObject(*ObjFile->get()); + } + default: + return object_error::invalid_file_type; } } @@ -71,7 +75,8 @@ ErrorOr<MemoryBufferRef> FunctionIndexObjectFile::findBitcodeInMemBuffer( bool FunctionIndexObjectFile::hasFunctionSummaryInMemBuffer( MemoryBufferRef Object, LLVMContext &Context) { ErrorOr<MemoryBufferRef> BCOrErr = findBitcodeInMemBuffer(Object); - if (!BCOrErr) return false; + if (!BCOrErr) + return false; return hasFunctionSummary(BCOrErr.get(), Context, nullptr); } @@ -85,12 +90,14 @@ FunctionIndexObjectFile::create(MemoryBufferRef Object, LLVMContext &Context, std::unique_ptr<FunctionInfoIndex> Index; ErrorOr<MemoryBufferRef> BCOrErr = findBitcodeInMemBuffer(Object); - if (!BCOrErr) return BCOrErr.getError(); + if (!BCOrErr) + return BCOrErr.getError(); ErrorOr<std::unique_ptr<FunctionInfoIndex>> IOrErr = getFunctionInfoIndex(BCOrErr.get(), Context, nullptr, IsLazy); - if (std::error_code EC = IOrErr.getError()) return EC; + if (std::error_code EC = IOrErr.getError()) + return EC; Index = std::move(IOrErr.get()); @@ -104,11 +111,11 @@ std::error_code FunctionIndexObjectFile::findFunctionSummaryInMemBuffer( MemoryBufferRef Object, LLVMContext &Context, StringRef FunctionName) { sys::fs::file_magic Type = sys::fs::identify_magic(Object.getBuffer()); switch (Type) { - case sys::fs::file_magic::bitcode: { - return readFunctionSummary(Object, Context, nullptr, FunctionName, - std::move(Index)); - } - default: - return object_error::invalid_file_type; + case sys::fs::file_magic::bitcode: { + return readFunctionSummary(Object, Context, nullptr, FunctionName, + std::move(Index)); + } + default: + return object_error::invalid_file_type; } } |