diff --git a/clang-tools-extra/modularize/ModuleAssistant.cpp b/clang-tools-extra/modularize/ModuleAssistant.cpp --- a/clang-tools-extra/modularize/ModuleAssistant.cpp +++ b/clang-tools-extra/modularize/ModuleAssistant.cpp @@ -305,7 +305,7 @@ loadModuleDescriptions( RootModuleName, HeaderFileNames, ProblemFileNames, Dependencies, HeaderPrefix)); - if (!RootModule.get()) + if (!RootModule) return false; // Write module map file. diff --git a/clang/lib/Driver/OffloadBundler.cpp b/clang/lib/Driver/OffloadBundler.cpp --- a/clang/lib/Driver/OffloadBundler.cpp +++ b/clang/lib/Driver/OffloadBundler.cpp @@ -1183,7 +1183,7 @@ assert(FileHandler && "FileHandle creation failed for file in the archive!"); - if (Error ReadErr = FileHandler.get()->ReadHeader(*CodeObjectBuffer)) + if (Error ReadErr = FileHandler->ReadHeader(*CodeObjectBuffer)) return ReadErr; Expected> CurBundleIDOrErr = @@ -1208,8 +1208,7 @@ BundlerConfig)) { std::string BundleData; raw_string_ostream DataStream(BundleData); - if (Error Err = - FileHandler.get()->ReadBundle(DataStream, *CodeObjectBuffer)) + if (Error Err = FileHandler->ReadBundle(DataStream, *CodeObjectBuffer)) return Err; for (auto &CompatibleTarget : CompatibleTargets) { @@ -1248,7 +1247,7 @@ } } - if (Error Err = FileHandler.get()->ReadBundleEnd(*CodeObjectBuffer)) + if (Error Err = FileHandler->ReadBundleEnd(*CodeObjectBuffer)) return Err; Expected> NextTripleOrErr = diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp --- a/clang/lib/Driver/ToolChain.cpp +++ b/clang/lib/Driver/ToolChain.cpp @@ -150,9 +150,9 @@ } const XRayArgs& ToolChain::getXRayArgs() const { - if (!XRayArguments.get()) + if (!XRayArguments) XRayArguments.reset(new XRayArgs(*this, Args)); - return *XRayArguments.get(); + return *XRayArguments; } namespace { diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -1031,8 +1031,8 @@ // to the start of the .got or .got.plt section. InputSection *sec = in.gotPlt.get(); if (!target->gotBaseSymInGotPlt) - sec = in.mipsGot.get() ? cast(in.mipsGot.get()) - : cast(in.got.get()); + sec = in.mipsGot ? cast(in.mipsGot.get()) + : cast(in.got.get()); ElfSym::globalOffsetTable->section = sec; } diff --git a/llvm/include/llvm/Analysis/RegionInfoImpl.h b/llvm/include/llvm/Analysis/RegionInfoImpl.h --- a/llvm/include/llvm/Analysis/RegionInfoImpl.h +++ b/llvm/include/llvm/Analysis/RegionInfoImpl.h @@ -778,12 +778,12 @@ void RegionInfoBase::dump() const { print(dbgs()); } #endif -template -void RegionInfoBase::releaseMemory() { +template void RegionInfoBase::releaseMemory() { BBtoRegion.clear(); - if (TopLevelRegion) + if (TopLevelRegion) { delete TopLevelRegion; - TopLevelRegion = nullptr; + TopLevelRegion = nullptr; + } } template diff --git a/llvm/include/llvm/MC/MCContext.h b/llvm/include/llvm/MC/MCContext.h --- a/llvm/include/llvm/MC/MCContext.h +++ b/llvm/include/llvm/MC/MCContext.h @@ -190,8 +190,7 @@ SmallString<128> CompilationDir; /// Prefix replacement map for source file information. - std::map> - DebugPrefixMap; + std::map> DebugPrefixMap; /// The main file name if passed in explicitly. std::string MainFileName; diff --git a/llvm/include/llvm/ProfileData/InstrProfReader.h b/llvm/include/llvm/ProfileData/InstrProfReader.h --- a/llvm/include/llvm/ProfileData/InstrProfReader.h +++ b/llvm/include/llvm/ProfileData/InstrProfReader.h @@ -256,8 +256,8 @@ Error readNextRecord(NamedInstrProfRecord &Record) override; InstrProfSymtab &getSymtab() override { - assert(Symtab.get()); - return *Symtab.get(); + assert(Symtab); + return *Symtab; } }; @@ -700,10 +700,10 @@ ProfileSummary &getSummary(bool UseCS) { if (UseCS) { assert(CS_Summary && "No context sensitive summary"); - return *(CS_Summary.get()); + return *CS_Summary; } else { assert(Summary && "No profile summary"); - return *(Summary.get()); + return *Summary; } } }; diff --git a/llvm/include/llvm/Support/YAMLParser.h b/llvm/include/llvm/Support/YAMLParser.h --- a/llvm/include/llvm/Support/YAMLParser.h +++ b/llvm/include/llvm/Support/YAMLParser.h @@ -611,7 +611,7 @@ return *this; } - Document &operator*() { return *Doc->get(); } + Document &operator*() { return **Doc; } std::unique_ptr &operator->() { return *Doc; } diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp --- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp @@ -591,7 +591,7 @@ bool DWARFUnit::parseDWO(StringRef DWOAlternativeLocation) { if (IsDWO) return false; - if (DWO.get()) + if (DWO) return false; DWARFDie UnitDie = getUnitDIE(); if (!UnitDie) diff --git a/llvm/lib/DebugInfo/LogicalView/Core/LVElement.cpp b/llvm/lib/DebugInfo/LogicalView/Core/LVElement.cpp --- a/llvm/lib/DebugInfo/LogicalView/Core/LVElement.cpp +++ b/llvm/lib/DebugInfo/LogicalView/Core/LVElement.cpp @@ -332,7 +332,7 @@ "Extra double spaces in name."); LLVM_DEBUG({ dbgs() << "Fullname = '" << Fullname << "'\n"; }); - setName(Fullname.c_str()); + setName(Fullname); } void LVElement::setFile(LVElement *Reference) { diff --git a/llvm/lib/DebugInfo/LogicalView/Core/LVScope.cpp b/llvm/lib/DebugInfo/LogicalView/Core/LVScope.cpp --- a/llvm/lib/DebugInfo/LogicalView/Core/LVScope.cpp +++ b/llvm/lib/DebugInfo/LogicalView/Core/LVScope.cpp @@ -503,7 +503,7 @@ // Encode the arguments as part of the template name and update the // template name, to reflect the encoded parameters. encodeTemplateArguments(EncodedArgs, &Params); - setEncodedArgs(EncodedArgs.c_str()); + setEncodedArgs(EncodedArgs); } } } @@ -1970,7 +1970,7 @@ Name.append(")"); // Update the scope name, to reflect the encoded parameters. - setName(Name.c_str()); + setName(Name); } //===----------------------------------------------------------------------===// diff --git a/llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp b/llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp --- a/llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp +++ b/llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp @@ -404,7 +404,7 @@ std::string Buffer; raw_string_ostream Stream(Buffer); StringRef AnnotationsStr = Annotations.str(); - MIP.get()->printInst(&Instruction, Address, AnnotationsStr, *STI, Stream); + MIP->printInst(&Instruction, Address, AnnotationsStr, *STI, Stream); LLVM_DEBUG({ std::string BufferCodes; raw_string_ostream StreamCodes(BufferCodes); diff --git a/llvm/lib/ObjCopy/MachO/MachOObjcopy.cpp b/llvm/lib/ObjCopy/MachO/MachOObjcopy.cpp --- a/llvm/lib/ObjCopy/MachO/MachOObjcopy.cpp +++ b/llvm/lib/ObjCopy/MachO/MachOObjcopy.cpp @@ -348,7 +348,7 @@ SecName.str().c_str()); assert(FoundSec->get()->CanonicalName == (SegName + "," + SecName).str()); - return *FoundSec->get(); + return **FoundSec; } static Error updateSection(const NewSectionInfo &NewSection, Object &O) { diff --git a/llvm/lib/Target/BPF/BTFDebug.cpp b/llvm/lib/Target/BPF/BTFDebug.cpp --- a/llvm/lib/Target/BPF/BTFDebug.cpp +++ b/llvm/lib/Target/BPF/BTFDebug.cpp @@ -1356,7 +1356,7 @@ OS.emitLabel(LineSym); // Construct the lineinfo. - auto SP = DL.get()->getScope()->getSubprogram(); + auto SP = DL->getScope()->getSubprogram(); constructLineInfo(SP, LineSym, DL.getLine(), DL.getCol()); LineInfoGenerated = true; diff --git a/llvm/tools/dsymutil/BinaryHolder.cpp b/llvm/tools/dsymutil/BinaryHolder.cpp --- a/llvm/tools/dsymutil/BinaryHolder.cpp +++ b/llvm/tools/dsymutil/BinaryHolder.cpp @@ -173,7 +173,7 @@ // Try the cache first. std::lock_guard Lock(MemberCacheMutex); if (MemberCache.count(Key)) - return *MemberCache[Key].get(); + return *MemberCache[Key]; // Create a new ObjectEntry, but don't add it to the cache yet. Loading of // the archive members might fail and we don't want to lock the whole archive diff --git a/llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp b/llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp --- a/llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp +++ b/llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp @@ -365,7 +365,7 @@ void FileAnalysis::printInstruction(const Instr &InstrMeta, raw_ostream &OS) const { - Printer->printInst(&InstrMeta.Instruction, 0, "", *SubtargetInfo.get(), OS); + Printer->printInst(&InstrMeta.Instruction, 0, "", *SubtargetInfo, OS); } Error FileAnalysis::initialiseDisassemblyMembers() { diff --git a/llvm/tools/llvm-cov/CodeCoverage.cpp b/llvm/tools/llvm-cov/CodeCoverage.cpp --- a/llvm/tools/llvm-cov/CodeCoverage.cpp +++ b/llvm/tools/llvm-cov/CodeCoverage.cpp @@ -1076,7 +1076,7 @@ FilenameFunctionMap; for (const auto &SourceFile : SourceFiles) for (const auto &Function : Coverage->getCoveredFunctions(SourceFile)) - if (Filters.matches(*Coverage.get(), Function)) + if (Filters.matches(*Coverage, Function)) FilenameFunctionMap[SourceFile].push_back(&Function); // Only print filter matching functions for each file. @@ -1165,7 +1165,7 @@ if (!Coverage) return 1; - CoverageReport Report(ViewOpts, *Coverage.get()); + CoverageReport Report(ViewOpts, *Coverage); if (!ShowFunctionSummaries) { if (SourceFiles.empty()) Report.renderFileReports(llvm::outs(), IgnoreFilenameFilters); @@ -1231,16 +1231,16 @@ switch (ViewOpts.Format) { case CoverageViewOptions::OutputFormat::Text: - Exporter = std::make_unique(*Coverage.get(), - ViewOpts, outs()); + Exporter = + std::make_unique(*Coverage, ViewOpts, outs()); break; case CoverageViewOptions::OutputFormat::HTML: // Unreachable because we should have gracefully terminated with an error // above. llvm_unreachable("Export in HTML is not supported!"); case CoverageViewOptions::OutputFormat::Lcov: - Exporter = std::make_unique(*Coverage.get(), - ViewOpts, outs()); + Exporter = + std::make_unique(*Coverage, ViewOpts, outs()); break; } diff --git a/llvm/tools/obj2yaml/elf2yaml.cpp b/llvm/tools/obj2yaml/elf2yaml.cpp --- a/llvm/tools/obj2yaml/elf2yaml.cpp +++ b/llvm/tools/obj2yaml/elf2yaml.cpp @@ -402,10 +402,10 @@ } llvm::erase_if(Chunks, [this, &Y](const std::unique_ptr &C) { - if (isa(*C.get())) + if (isa(*C)) return false; - const ELFYAML::Section &S = cast(*C.get()); + const ELFYAML::Section &S = cast(*C); return !shouldPrintSection(S, Sections[S.OriginalSecNdx], Y->DWARF); }); @@ -495,7 +495,7 @@ // It is not possible to have a non-Section chunk, because // obj2yaml does not create Fill chunks. for (const std::unique_ptr &C : Chunks) { - ELFYAML::Section &S = cast(*C.get()); + ELFYAML::Section &S = cast(*C); if (isInSegment(S, Sections[S.OriginalSecNdx], Phdr)) { if (!PH.FirstSec) PH.FirstSec = S.Name; @@ -530,13 +530,13 @@ cantFail(std::move(Err)); if (RawSec->Name == ".debug_aranges") - Err = dumpDebugARanges(*DWARFCtx.get(), DWARF); + Err = dumpDebugARanges(*DWARFCtx, DWARF); else if (RawSec->Name == ".debug_str") - Err = dumpDebugStrings(*DWARFCtx.get(), DWARF); + Err = dumpDebugStrings(*DWARFCtx, DWARF); else if (RawSec->Name == ".debug_ranges") - Err = dumpDebugRanges(*DWARFCtx.get(), DWARF); + Err = dumpDebugRanges(*DWARFCtx, DWARF); else if (RawSec->Name == ".debug_addr") - Err = dumpDebugAddr(*DWARFCtx.get(), DWARF); + Err = dumpDebugAddr(*DWARFCtx, DWARF); else continue; diff --git a/llvm/tools/obj2yaml/macho2yaml.cpp b/llvm/tools/obj2yaml/macho2yaml.cpp --- a/llvm/tools/obj2yaml/macho2yaml.cpp +++ b/llvm/tools/obj2yaml/macho2yaml.cpp @@ -192,7 +192,7 @@ if (SecName.startswith("__debug_")) { // If the DWARF section cannot be successfully parsed, emit raw content // instead of an entry in the DWARF section of the YAML. - if (Error Err = dumpDebugSection(SecName, *DWARFCtx.get(), Y.DWARF)) + if (Error Err = dumpDebugSection(SecName, *DWARFCtx, Y.DWARF)) consumeError(std::move(Err)); else S->content.reset(); @@ -326,8 +326,7 @@ if (Obj.isLittleEndian() != sys::IsLittleEndianHost) MachO::swapStruct(LC.Data.load_command_data); if (Expected ExpectedEndPtr = - processLoadCommandData(LC, LoadCmd, - *Y.get())) + processLoadCommandData(LC, LoadCmd, *Y)) EndPtr = *ExpectedEndPtr; else return ExpectedEndPtr.takeError();