diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/LTO/LTO.cpp | 20 | ||||
-rw-r--r-- | llvm/lib/LTO/LTOBackend.cpp | 20 | ||||
-rw-r--r-- | llvm/lib/Object/Archive.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/Object/Error.cpp | 21 | ||||
-rw-r--r-- | llvm/lib/Object/MachOObjectFile.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Object/MachOUniversal.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp | 2 |
7 files changed, 36 insertions, 37 deletions
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp index b599830d092..12de8445568 100644 --- a/llvm/lib/LTO/LTO.cpp +++ b/llvm/lib/LTO/LTO.cpp @@ -437,7 +437,7 @@ Error LTO::addThinLTO(std::unique_ptr<InputFile> Input, assert(ResI == Res.end()); ThinLTO.ModuleMap[MBRef.getBufferIdentifier()] = MBRef; - return Error(); + return Error::success(); } unsigned LTO::getMaxTasks() const { @@ -489,7 +489,7 @@ Error LTO::runRegularLTO(AddStreamFn AddStream) { if (Conf.PreOptModuleHook && !Conf.PreOptModuleHook(0, *RegularLTO.CombinedModule)) - return Error(); + return Error::success(); if (!Conf.CodeGenOnly) { for (const auto &R : GlobalResolutions) { @@ -512,7 +512,7 @@ Error LTO::runRegularLTO(AddStreamFn AddStream) { if (Conf.PostInternalizeModuleHook && !Conf.PostInternalizeModuleHook(0, *RegularLTO.CombinedModule)) - return Error(); + return Error::success(); } return backend(Conf, AddStream, RegularLTO.ParallelCodeGenParallelismLevel, std::move(RegularLTO.CombinedModule)); @@ -593,7 +593,7 @@ public: if (AddStreamFn CacheAddStream = Cache(Task, Key)) return RunThinBackend(CacheAddStream); - return Error(); + return Error::success(); } Error start( @@ -628,7 +628,7 @@ public: MBRef, std::ref(CombinedIndex), std::ref(ImportList), std::ref(ExportList), std::ref(ResolvedODR), std::ref(DefinedGlobals), std::ref(ModuleMap)); - return Error(); + return Error::success(); } Error wait() override { @@ -636,7 +636,7 @@ public: if (Err) return std::move(*Err); else - return Error(); + return Error::success(); } }; @@ -722,10 +722,10 @@ public: if (ShouldEmitImportsFiles) return errorCodeToError( EmitImportsFiles(ModulePath, NewModulePath + ".imports", ImportList)); - return Error(); + return Error::success(); } - Error wait() override { return Error(); } + Error wait() override { return Error::success(); } }; ThinBackend lto::createWriteIndexesThinBackend(std::string OldPrefix, @@ -744,10 +744,10 @@ ThinBackend lto::createWriteIndexesThinBackend(std::string OldPrefix, Error LTO::runThinLTO(AddStreamFn AddStream, NativeObjectCache Cache, bool HasRegularLTO) { if (ThinLTO.ModuleMap.empty()) - return Error(); + return Error::success(); if (Conf.CombinedIndexHook && !Conf.CombinedIndexHook(ThinLTO.CombinedIndex)) - return Error(); + return Error::success(); // Collect for each module the list of function it defines (GUID -> // Summary). diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp index fb1cfed96bb..4643b9af74a 100644 --- a/llvm/lib/LTO/LTOBackend.cpp +++ b/llvm/lib/LTO/LTOBackend.cpp @@ -105,7 +105,7 @@ Error Config::addSaveTemps(std::string OutputFileName, return true; }; - return Error(); + return Error::success(); } namespace { @@ -302,7 +302,7 @@ Error lto::backend(Config &C, AddStreamFn AddStream, if (!C.CodeGenOnly) if (!opt(C, TM.get(), 0, *Mod, /*IsThinLto=*/false)) - return Error(); + return Error::success(); if (ParallelCodeGenParallelismLevel == 1) { codegen(C, TM.get(), AddStream, 0, *Mod); @@ -310,7 +310,7 @@ Error lto::backend(Config &C, AddStreamFn AddStream, splitCodeGen(C, TM.get(), AddStream, ParallelCodeGenParallelismLevel, std::move(Mod)); } - return Error(); + return Error::success(); } Error lto::thinBackend(Config &Conf, unsigned Task, AddStreamFn AddStream, @@ -329,25 +329,25 @@ Error lto::thinBackend(Config &Conf, unsigned Task, AddStreamFn AddStream, if (Conf.CodeGenOnly) { codegen(Conf, TM.get(), AddStream, Task, Mod); - return Error(); + return Error::success(); } if (Conf.PreOptModuleHook && !Conf.PreOptModuleHook(Task, Mod)) - return Error(); + return Error::success(); renameModuleForThinLTO(Mod, CombinedIndex); thinLTOResolveWeakForLinkerModule(Mod, DefinedGlobals); if (Conf.PostPromoteModuleHook && !Conf.PostPromoteModuleHook(Task, Mod)) - return Error(); + return Error::success(); if (!DefinedGlobals.empty()) thinLTOInternalizeModule(Mod, DefinedGlobals); if (Conf.PostInternalizeModuleHook && !Conf.PostInternalizeModuleHook(Task, Mod)) - return Error(); + return Error::success(); auto ModuleLoader = [&](StringRef Identifier) { assert(Mod.getContext().isODRUniquingDebugTypes() && @@ -363,11 +363,11 @@ Error lto::thinBackend(Config &Conf, unsigned Task, AddStreamFn AddStream, return Err; if (Conf.PostImportModuleHook && !Conf.PostImportModuleHook(Task, Mod)) - return Error(); + return Error::success(); if (!opt(Conf, TM.get(), Task, Mod, /*IsThinLto=*/true)) - return Error(); + return Error::success(); codegen(Conf, TM.get(), AddStream, Task, Mod); - return Error(); + return Error::success(); } diff --git a/llvm/lib/Object/Archive.cpp b/llvm/lib/Object/Archive.cpp index 4684c186fb4..f2021f796d1 100644 --- a/llvm/lib/Object/Archive.cpp +++ b/llvm/lib/Object/Archive.cpp @@ -458,7 +458,7 @@ Expected<Archive::Child> Archive::Child::getNext() const { return malformedError(Msg + NameOrErr.get()); } - Error Err; + Error Err = Error::success(); Child Ret(Parent, NextLoc, &Err); if (Err) return std::move(Err); @@ -508,7 +508,7 @@ Archive::Child::getAsBinary(LLVMContext *Context) const { } Expected<std::unique_ptr<Archive>> Archive::create(MemoryBufferRef Source) { - Error Err; + Error Err = Error::success(); std::unique_ptr<Archive> Ret(new Archive(Source, Err)); if (Err) return std::move(Err); @@ -830,7 +830,7 @@ Expected<Archive::Child> Archive::Symbol::getMember() const { } const char *Loc = Parent->getData().begin() + Offset; - Error Err; + Error Err = Error::success(); Child C(Parent, Loc, &Err); if (Err) return std::move(Err); diff --git a/llvm/lib/Object/Error.cpp b/llvm/lib/Object/Error.cpp index 578da22c044..7d43a84f3e0 100644 --- a/llvm/lib/Object/Error.cpp +++ b/llvm/lib/Object/Error.cpp @@ -79,18 +79,17 @@ const std::error_category &object::object_category() { llvm::Error llvm::object::isNotObjectErrorInvalidFileType(llvm::Error Err) { if (auto Err2 = - handleErrors(std::move(Err), - [](std::unique_ptr<ECError> M) { - // Try to handle 'M'. If successful, return a success value from - // the handler. - if (M->convertToErrorCode() == object_error::invalid_file_type) - return Error::success(); + handleErrors(std::move(Err), [](std::unique_ptr<ECError> M) -> Error { + // Try to handle 'M'. If successful, return a success value from + // the handler. + if (M->convertToErrorCode() == object_error::invalid_file_type) + return Error::success(); - // We failed to handle 'M' - return it from the handler. - // This value will be passed back from catchErrors and - // wind up in Err2, where it will be returned from this function. - return Error(std::move(M)); - })) + // We failed to handle 'M' - return it from the handler. + // This value will be passed back from catchErrors and + // wind up in Err2, where it will be returned from this function. + return Error(std::move(M)); + })) return Err2; return Err; } diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp index ad52235a50d..6650ace0845 100644 --- a/llvm/lib/Object/MachOObjectFile.cpp +++ b/llvm/lib/Object/MachOObjectFile.cpp @@ -1073,7 +1073,7 @@ Expected<std::unique_ptr<MachOObjectFile>> MachOObjectFile::create(MemoryBufferRef Object, bool IsLittleEndian, bool Is64Bits, uint32_t UniversalCputype, uint32_t UniversalIndex) { - Error Err; + Error Err = Error::success(); std::unique_ptr<MachOObjectFile> Obj( new MachOObjectFile(std::move(Object), IsLittleEndian, Is64Bits, Err, UniversalCputype, diff --git a/llvm/lib/Object/MachOUniversal.cpp b/llvm/lib/Object/MachOUniversal.cpp index c57fdc677f5..9ab0ae656bf 100644 --- a/llvm/lib/Object/MachOUniversal.cpp +++ b/llvm/lib/Object/MachOUniversal.cpp @@ -107,7 +107,7 @@ void MachOUniversalBinary::anchor() { } Expected<std::unique_ptr<MachOUniversalBinary>> MachOUniversalBinary::create(MemoryBufferRef Source) { - Error Err; + Error Err = Error::success(); std::unique_ptr<MachOUniversalBinary> Ret( new MachOUniversalBinary(Source, Err)); if (Err) diff --git a/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp b/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp index 1a4b4f59084..a6c7031ccd3 100644 --- a/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp +++ b/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp @@ -648,7 +648,7 @@ BinaryCoverageReader::create(std::unique_ptr<MemoryBuffer> &ObjectBuffer, StringRef Coverage; uint8_t BytesInAddress; support::endianness Endian; - Error E; + Error E = Error::success(); consumeError(std::move(E)); if (ObjectBuffer->getBuffer().startswith(TestingFormatMagic)) // This is a special format used for testing. |