diff options
author | Kazu Hirata <kazu@google.com> | 2024-07-06 16:48:32 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-06 16:48:32 +0900 |
commit | acd7a688fcd26ce4d72cecbddeddef788482e17e (patch) | |
tree | 1da7c2e9748fa062c221af0c4b297cecdaa906d7 | |
parent | 9cb9a97e44130e17e96f994c3e594aba69ea1ad5 (diff) | |
download | llvm-acd7a688fcd26ce4d72cecbddeddef788482e17e.zip llvm-acd7a688fcd26ce4d72cecbddeddef788482e17e.tar.gz llvm-acd7a688fcd26ce4d72cecbddeddef788482e17e.tar.bz2 |
[llvm] Remove redundant calls to std::unique_ptr<T>::get (NFC) (#97778)
-rw-r--r-- | llvm/include/llvm/CodeGen/TargetInstrInfo.h | 2 | ||||
-rw-r--r-- | llvm/lib/DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/DWARFLinker/Parallel/DWARFLinkerImpl.cpp | 28 | ||||
-rw-r--r-- | llvm/lib/Target/AMDGPU/SIInstrInfo.h | 2 | ||||
-rw-r--r-- | llvm/tools/bugpoint/BugDriver.cpp | 2 | ||||
-rw-r--r-- | llvm/tools/llvm-as/llvm-as.cpp | 2 | ||||
-rw-r--r-- | llvm/tools/llvm-extract/llvm-extract.cpp | 2 | ||||
-rw-r--r-- | llvm/tools/llvm-link/llvm-link.cpp | 4 | ||||
-rw-r--r-- | llvm/tools/verify-uselistorder/verify-uselistorder.cpp | 4 |
9 files changed, 24 insertions, 24 deletions
diff --git a/llvm/include/llvm/CodeGen/TargetInstrInfo.h b/llvm/include/llvm/CodeGen/TargetInstrInfo.h index 75cb17f..5c7f6dd 100644 --- a/llvm/include/llvm/CodeGen/TargetInstrInfo.h +++ b/llvm/include/llvm/CodeGen/TargetInstrInfo.h @@ -2214,7 +2214,7 @@ public: /// Return MIR formatter to format/parse MIR operands. Target can override /// this virtual function and return target specific MIR formatter. virtual const MIRFormatter *getMIRFormatter() const { - if (!Formatter.get()) + if (!Formatter) Formatter = std::make_unique<MIRFormatter>(); return Formatter.get(); } diff --git a/llvm/lib/DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp b/llvm/lib/DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp index 8a73136..0cb9cd5 100644 --- a/llvm/lib/DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp +++ b/llvm/lib/DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp @@ -1833,7 +1833,7 @@ TypeUnit *CompileUnit::OutputUnitVariantPtr::getAsTypeUnit() { bool CompileUnit::resolveDependenciesAndMarkLiveness( bool InterCUProcessingStarted, std::atomic<bool> &HasNewInterconnectedCUs) { - if (!Dependencies.get()) + if (!Dependencies) Dependencies.reset(new DependencyTracker(*this)); return Dependencies->resolveDependenciesAndMarkLiveness( diff --git a/llvm/lib/DWARFLinker/Parallel/DWARFLinkerImpl.cpp b/llvm/lib/DWARFLinker/Parallel/DWARFLinkerImpl.cpp index c060f8f..84fd080 100644 --- a/llvm/lib/DWARFLinker/Parallel/DWARFLinkerImpl.cpp +++ b/llvm/lib/DWARFLinker/Parallel/DWARFLinkerImpl.cpp @@ -107,7 +107,7 @@ Error DWARFLinkerImpl::link() { std::optional<uint16_t> Language; for (std::unique_ptr<LinkContext> &Context : ObjectContexts) { - if (Context->InputDWARFFile.Dwarf.get() == nullptr) { + if (Context->InputDWARFFile.Dwarf == nullptr) { Context->setOutputFormat(Context->getFormParams(), GlobalEndianness); continue; } @@ -203,13 +203,13 @@ Error DWARFLinkerImpl::link() { Pool.wait(); } - if (ArtificialTypeUnit.get() != nullptr && !ArtificialTypeUnit->getTypePool() - .getRoot() - ->getValue() - .load() - ->Children.empty()) { + if (ArtificialTypeUnit != nullptr && !ArtificialTypeUnit->getTypePool() + .getRoot() + ->getValue() + .load() + ->Children.empty()) { if (GlobalData.getTargetTriple().has_value()) - if (Error Err = ArtificialTypeUnit.get()->finishCloningAndEmit( + if (Error Err = ArtificialTypeUnit->finishCloningAndEmit( (*GlobalData.getTargetTriple()).get())) return Err; } @@ -732,7 +732,7 @@ Error DWARFLinkerImpl::LinkContext::cloneAndEmitDebugFrame() { if (!GlobalData.getTargetTriple().has_value()) return Error::success(); - if (InputDWARFFile.Dwarf.get() == nullptr) + if (InputDWARFFile.Dwarf == nullptr) return Error::success(); const DWARFObject &InputDWARFObj = InputDWARFFile.Dwarf->getDWARFObj(); @@ -865,7 +865,7 @@ void DWARFLinkerImpl::glueCompileUnitsAndWriteToTheOutput() { // units into the resulting file. emitCommonSectionsAndWriteCompileUnitsToTheOutput(); - if (ArtificialTypeUnit.get() != nullptr) + if (ArtificialTypeUnit != nullptr) ArtificialTypeUnit.reset(); // Write common debug sections into the resulting file. @@ -1018,7 +1018,7 @@ void DWARFLinkerImpl::forEachOutputString( }); }); - if (ArtificialTypeUnit.get() != nullptr) { + if (ArtificialTypeUnit != nullptr) { ArtificialTypeUnit->forEach([&](SectionDescriptor &OutSection) { OutSection.ListDebugStrPatch.forEach([&](DebugStrPatch &Patch) { StringHandler(StringDestinationKind::DebugStr, Patch.String); @@ -1049,7 +1049,7 @@ void DWARFLinkerImpl::forEachOutputString( void DWARFLinkerImpl::forEachObjectSectionsSet( function_ref<void(OutputSections &)> SectionsSetHandler) { // Handle artificial type unit first. - if (ArtificialTypeUnit.get() != nullptr) + if (ArtificialTypeUnit != nullptr) SectionsSetHandler(*ArtificialTypeUnit); // Then all modules(before regular compilation units). @@ -1072,7 +1072,7 @@ void DWARFLinkerImpl::forEachObjectSectionsSet( void DWARFLinkerImpl::forEachCompileAndTypeUnit( function_ref<void(DwarfUnit *CU)> UnitHandler) { - if (ArtificialTypeUnit.get() != nullptr) + if (ArtificialTypeUnit != nullptr) UnitHandler(ArtificialTypeUnit.get()); // Enumerate module units. @@ -1348,7 +1348,7 @@ void DWARFLinkerImpl::emitDWARFv5DebugNamesSection(const Triple &TargetTriple) { forEachCompileAndTypeUnit([&](DwarfUnit *CU) { bool HasRecords = false; CU->forEachAcceleratorRecord([&](const DwarfUnit::AccelInfo &Info) { - if (DebugNames.get() == nullptr) + if (DebugNames == nullptr) DebugNames = std::make_unique<DWARF5AccelTable>(); HasRecords = true; @@ -1375,7 +1375,7 @@ void DWARFLinkerImpl::emitDWARFv5DebugNamesSection(const Triple &TargetTriple) { } }); - if (DebugNames.get() != nullptr) { + if (DebugNames != nullptr) { // FIXME: we use AsmPrinter to emit accelerator sections. // It might be beneficial to directly emit accelerator data // to the raw_svector_ostream. diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.h b/llvm/lib/Target/AMDGPU/SIInstrInfo.h index 84bb73c..1e2b687 100644 --- a/llvm/lib/Target/AMDGPU/SIInstrInfo.h +++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.h @@ -1384,7 +1384,7 @@ public: getGenericInstructionUniformity(const MachineInstr &MI) const; const MIRFormatter *getMIRFormatter() const override { - if (!Formatter.get()) + if (!Formatter) Formatter = std::make_unique<AMDGPUMIRFormatter>(); return Formatter.get(); } diff --git a/llvm/tools/bugpoint/BugDriver.cpp b/llvm/tools/bugpoint/BugDriver.cpp index 32c747f..f9b8d09 100644 --- a/llvm/tools/bugpoint/BugDriver.cpp +++ b/llvm/tools/bugpoint/BugDriver.cpp @@ -142,7 +142,7 @@ bool BugDriver::addSources(const std::vector<std::string> &Filenames) { for (unsigned i = 1, e = Filenames.size(); i != e; ++i) { std::unique_ptr<Module> M = parseInputFile(Filenames[i], Context); - if (!M.get()) + if (!M) return true; outs() << "Linking in input file: '" << Filenames[i] << "'\n"; diff --git a/llvm/tools/llvm-as/llvm-as.cpp b/llvm/tools/llvm-as/llvm-as.cpp index 082565a..9b9af76 100644 --- a/llvm/tools/llvm-as/llvm-as.cpp +++ b/llvm/tools/llvm-as/llvm-as.cpp @@ -137,7 +137,7 @@ int main(int argc, char **argv) { nullptr, SetDataLayout); } std::unique_ptr<Module> M = std::move(ModuleAndIndex.Mod); - if (!M.get()) { + if (!M) { Err.print(argv[0], errs()); return 1; } diff --git a/llvm/tools/llvm-extract/llvm-extract.cpp b/llvm/tools/llvm-extract/llvm-extract.cpp index 5915f92..4ee644f 100644 --- a/llvm/tools/llvm-extract/llvm-extract.cpp +++ b/llvm/tools/llvm-extract/llvm-extract.cpp @@ -147,7 +147,7 @@ int main(int argc, char **argv) { SMDiagnostic Err; std::unique_ptr<Module> M = getLazyIRFileModule(InputFilename, Err, Context); - if (!M.get()) { + if (!M) { Err.print(argv[0], errs()); return 1; } diff --git a/llvm/tools/llvm-link/llvm-link.cpp b/llvm/tools/llvm-link/llvm-link.cpp index 24ee02b..b311820 100644 --- a/llvm/tools/llvm-link/llvm-link.cpp +++ b/llvm/tools/llvm-link/llvm-link.cpp @@ -231,7 +231,7 @@ static std::unique_ptr<Module> loadArFile(const char *Argv0, M = getLazyIRModule(MemoryBuffer::getMemBuffer(MemBuf.get(), false), ParseErr, Context); - if (!M.get()) { + if (!M) { errs() << Argv0 << ": "; WithColor::error() << " parsing member '" << ChildName << "' of archive library failed'" << ArchiveName @@ -417,7 +417,7 @@ static bool linkFiles(const char *argv0, LLVMContext &Context, Linker &L, identify_magic(Buffer->getBuffer()) == file_magic::archive ? loadArFile(argv0, std::move(Buffer), Context) : loadFile(argv0, std::move(Buffer), Context); - if (!M.get()) { + if (!M) { errs() << argv0 << ": "; WithColor::error() << " loading file '" << File << "'\n"; return false; diff --git a/llvm/tools/verify-uselistorder/verify-uselistorder.cpp b/llvm/tools/verify-uselistorder/verify-uselistorder.cpp index 84fc777..f316bff 100644 --- a/llvm/tools/verify-uselistorder/verify-uselistorder.cpp +++ b/llvm/tools/verify-uselistorder/verify-uselistorder.cpp @@ -176,7 +176,7 @@ std::unique_ptr<Module> TempFile::readAssembly(LLVMContext &Context) const { LLVM_DEBUG(dbgs() << " - read assembly\n"); SMDiagnostic Err; std::unique_ptr<Module> M = parseAssemblyFile(Filename, Err, Context); - if (!M.get()) + if (!M) Err.print("verify-uselistorder", errs()); return M; } @@ -555,7 +555,7 @@ int main(int argc, char **argv) { // Load the input module... std::unique_ptr<Module> M = parseIRFile(InputFilename, Err, Context); - if (!M.get()) { + if (!M) { Err.print(argv[0], errs()); return 1; } |