Index: examples/analyzer-plugin/MainCallChecker.cpp =================================================================== --- examples/analyzer-plugin/MainCallChecker.cpp +++ examples/analyzer-plugin/MainCallChecker.cpp @@ -35,7 +35,7 @@ return; if (!BT) - BT.reset(new BugType(this, "call to main", "example analyzer plugin")); + BT = llvm::make_unique(this, "call to main", "example analyzer plugin"); std::unique_ptr report = llvm::make_unique(*BT, BT->getName(), N); Index: lib/ARCMigrate/ARCMT.cpp =================================================================== --- lib/ARCMigrate/ARCMT.cpp +++ lib/ARCMigrate/ARCMT.cpp @@ -174,7 +174,7 @@ createInvocationForMigration(CompilerInvocation &origCI, const PCHContainerReader &PCHContainerRdr) { std::unique_ptr CInvok; - CInvok.reset(new CompilerInvocation(origCI)); + CInvok = llvm::make_unique(origCI); PreprocessorOptions &PPOpts = CInvok->getPreprocessorOpts(); if (!PPOpts.ImplicitPCHInclude.empty()) { // We can't use a PCH because it was likely built in non-ARC mode and we @@ -544,7 +544,7 @@ Diags->setClient(&errRec, /*ShouldOwnClient=*/false); std::unique_ptr ASTAction; - ASTAction.reset(new ARCMTMacroTrackerAction(ARCMTMacroLocs)); + ASTAction = llvm::make_unique(ARCMTMacroLocs); std::unique_ptr Unit(ASTUnit::LoadFromCompilerInvocationAction( std::move(CInvok), PCHContainerOps, Diags, ASTAction.get())); Index: lib/ARCMigrate/FileRemapper.cpp =================================================================== --- lib/ARCMigrate/FileRemapper.cpp +++ lib/ARCMigrate/FileRemapper.cpp @@ -21,7 +21,7 @@ using namespace arcmt; FileRemapper::FileRemapper() { - FileMgr.reset(new FileManager(FileSystemOptions())); + FileMgr = llvm::make_unique(FileSystemOptions()); } FileRemapper::~FileRemapper() { Index: lib/ARCMigrate/ObjCMT.cpp =================================================================== --- lib/ARCMigrate/ObjCMT.cpp +++ lib/ARCMigrate/ObjCMT.cpp @@ -125,10 +125,10 @@ protected: void Initialize(ASTContext &Context) override { - NSAPIObj.reset(new NSAPI(Context)); - Editor.reset(new edit::EditedSource(Context.getSourceManager(), + NSAPIObj = llvm::make_unique(Context); + Editor = llvm::make_unique(Context.getSourceManager(), Context.getLangOpts(), - PPRec)); + PPRec); } bool HandleTopLevelDecl(DeclGroupRef DG) override { @@ -364,7 +364,7 @@ bool shouldWalkTypesOfTypeLocs() const { return false; } bool TraverseStmt(Stmt *S) { - PMap.reset(new ParentMap(S)); + PMap = llvm::make_unique(S); ObjCMigrator(Consumer, *PMap).TraverseStmt(S); return true; } Index: lib/ARCMigrate/TransRetainReleaseDealloc.cpp =================================================================== --- lib/ARCMigrate/TransRetainReleaseDealloc.cpp +++ lib/ARCMigrate/TransRetainReleaseDealloc.cpp @@ -54,7 +54,7 @@ void transformBody(Stmt *body, Decl *ParentD) { Body = body; collectRemovables(body, Removables); - StmtMap.reset(new ParentMap(body)); + StmtMap = llvm::make_unique(body); TraverseStmt(body); } Index: lib/ARCMigrate/TransUnbridgedCasts.cpp =================================================================== --- lib/ARCMigrate/TransUnbridgedCasts.cpp +++ lib/ARCMigrate/TransUnbridgedCasts.cpp @@ -74,7 +74,7 @@ void transformBody(Stmt *body, Decl *ParentD) { this->ParentD = ParentD; Body = body; - StmtMap.reset(new ParentMap(body)); + StmtMap = llvm::make_unique(body); TraverseStmt(body); } @@ -323,7 +323,7 @@ bool tryRemoving(Expr *E) const { if (!Removables) { - Removables.reset(new ExprSet); + Removables = llvm::make_unique(); collectRemovables(Body, *Removables); } Index: lib/AST/ASTContext.cpp =================================================================== --- lib/AST/ASTContext.cpp +++ lib/AST/ASTContext.cpp @@ -9136,9 +9136,9 @@ VTableContextBase *ASTContext::getVTableContext() { if (!VTContext.get()) { if (Target->getCXXABI().isMicrosoft()) - VTContext.reset(new MicrosoftVTableContext(*this)); + VTContext = llvm::make_unique(*this); else - VTContext.reset(new ItaniumVTableContext(*this)); + VTContext = llvm::make_unique(*this); } return VTContext.get(); } Index: lib/Analysis/AnalysisDeclContext.cpp =================================================================== --- lib/Analysis/AnalysisDeclContext.cpp +++ lib/Analysis/AnalysisDeclContext.cpp @@ -266,7 +266,7 @@ return CFA.get(); if (CFG *c = getCFG()) { - CFA.reset(new CFGReverseBlockReachabilityAnalysis(*c)); + CFA = llvm::make_unique(*c); return CFA.get(); } @@ -279,7 +279,7 @@ ParentMap &AnalysisDeclContext::getParentMap() { if (!PM) { - PM.reset(new ParentMap(getBody())); + PM = llvm::make_unique(getBody()); if (const CXXConstructorDecl *C = dyn_cast(getDecl())) { for (const auto *I : C->inits()) { PM->addStmt(I->getInit()); @@ -295,7 +295,7 @@ PseudoConstantAnalysis *AnalysisDeclContext::getPseudoConstantAnalysis() { if (!PCA) - PCA.reset(new PseudoConstantAnalysis(getBody())); + PCA = llvm::make_unique(getBody()); return PCA.get(); } Index: lib/Analysis/ThreadSafety.cpp =================================================================== --- lib/Analysis/ThreadSafety.cpp +++ lib/Analysis/ThreadSafety.cpp @@ -971,7 +971,7 @@ // reference becomes invalid. std::unique_ptr &InfoPtr = BMap[Vd]; if (!InfoPtr) - InfoPtr.reset(new BeforeInfo()); + InfoPtr = llvm::make_unique(); Info = InfoPtr.get(); } Index: lib/CodeGen/BackendUtil.cpp =================================================================== --- lib/CodeGen/BackendUtil.cpp +++ lib/CodeGen/BackendUtil.cpp @@ -741,9 +741,9 @@ if (CodeGenOpts.EmitSummaryIndex) { if (!CodeGenOpts.ThinLinkBitcodeFile.empty()) { std::error_code EC; - ThinLinkOS.reset(new llvm::raw_fd_ostream( + ThinLinkOS = llvm::make_unique( CodeGenOpts.ThinLinkBitcodeFile, EC, - llvm::sys::fs::F_None)); + llvm::sys::fs::F_None); if (EC) { Diags.Report(diag::err_fe_unable_to_open_output) << CodeGenOpts.ThinLinkBitcodeFile << EC.message(); Index: lib/CodeGen/CGCleanup.cpp =================================================================== --- lib/CodeGen/CGCleanup.cpp +++ lib/CodeGen/CGCleanup.cpp @@ -745,7 +745,7 @@ memcpy(CleanupBufferStack.buffer, CleanupSource, CleanupSize); Fn = reinterpret_cast(CleanupBufferStack.buffer); } else { - CleanupBufferHeap.reset(new char[CleanupSize]); + CleanupBufferHeap = llvm::make_unique(CleanupSize); memcpy(CleanupBufferHeap.get(), CleanupSource, CleanupSize); Fn = reinterpret_cast(CleanupBufferHeap.get()); } Index: lib/CodeGen/CGCoroutine.cpp =================================================================== --- lib/CodeGen/CGCoroutine.cpp +++ lib/CodeGen/CGCoroutine.cpp @@ -95,7 +95,7 @@ return; } - CurCoro.Data = std::unique_ptr(new CGCoroData); + CurCoro.Data = llvm::make_unique(); CurCoro.Data->CoroId = CoroId; CurCoro.Data->CoroIdExpr = CoroIdExpr; } Index: lib/CodeGen/CodeGenModule.cpp =================================================================== --- lib/CodeGen/CodeGenModule.cpp +++ lib/CodeGen/CodeGenModule.cpp @@ -131,19 +131,19 @@ // Enable TBAA unless it's suppressed. ThreadSanitizer needs TBAA even at O0. if (LangOpts.Sanitize.has(SanitizerKind::Thread) || (!CodeGenOpts.RelaxedAliasing && CodeGenOpts.OptimizationLevel > 0)) - TBAA.reset(new CodeGenTBAA(Context, VMContext, CodeGenOpts, getLangOpts(), - getCXXABI().getMangleContext())); + TBAA = llvm::make_unique(Context, VMContext, CodeGenOpts, getLangOpts(), + getCXXABI().getMangleContext()); // If debug info or coverage generation is enabled, create the CGDebugInfo // object. if (CodeGenOpts.getDebugInfo() != codegenoptions::NoDebugInfo || CodeGenOpts.EmitGcovArcs || CodeGenOpts.EmitGcovNotes) - DebugInfo.reset(new CGDebugInfo(*this)); + DebugInfo = llvm::make_unique(*this); Block.GlobalUniqueCount = 0; if (C.getLangOpts().ObjC1) - ObjCData.reset(new ObjCEntrypoints()); + ObjCData = llvm::make_unique(); if (CodeGenOpts.hasProfileClangUse()) { auto ReaderOrErr = llvm::IndexedInstrProfReader::create( @@ -162,7 +162,7 @@ // If coverage mapping generation is enabled, create the // CoverageMappingModuleGen object. if (CodeGenOpts.CoverageMapping) - CoverageMapping.reset(new CoverageMappingModuleGen(*this, *CoverageInfo)); + CoverageMapping = llvm::make_unique(*this, *CoverageInfo); } CodeGenModule::~CodeGenModule() {} @@ -188,7 +188,7 @@ } void CodeGenModule::createOpenCLRuntime() { - OpenCLRuntime.reset(new CGOpenCLRuntime(*this)); + OpenCLRuntime = llvm::make_unique(*this); } void CodeGenModule::createOpenMPRuntime() { @@ -199,10 +199,10 @@ case llvm::Triple::nvptx64: assert(getLangOpts().OpenMPIsDevice && "OpenMP NVPTX is only prepared to deal with device code."); - OpenMPRuntime.reset(new CGOpenMPRuntimeNVPTX(*this)); + OpenMPRuntime = llvm::make_unique(*this); break; default: - OpenMPRuntime.reset(new CGOpenMPRuntime(*this)); + OpenMPRuntime = llvm::make_unique(*this); break; } } Index: lib/CodeGen/CodeGenPGO.cpp =================================================================== --- lib/CodeGen/CodeGenPGO.cpp +++ lib/CodeGen/CodeGenPGO.cpp @@ -650,7 +650,7 @@ } void CodeGenPGO::mapRegionCounters(const Decl *D) { - RegionCounterMap.reset(new llvm::DenseMap); + RegionCounterMap = llvm::make_unique>(); MapRegionCounters Walker(*RegionCounterMap); if (const FunctionDecl *FD = dyn_cast_or_null(D)) Walker.TraverseDecl(const_cast(FD)); @@ -717,7 +717,7 @@ } void CodeGenPGO::computeRegionCounts(const Decl *D) { - StmtCountMap.reset(new llvm::DenseMap); + StmtCountMap = llvm::make_unique>(); ComputeRegionCounts Walker(*StmtCountMap, *this); if (const FunctionDecl *FD = dyn_cast_or_null(D)) Walker.VisitFunctionDecl(FD); Index: lib/CodeGen/ModuleBuilder.cpp =================================================================== --- lib/CodeGen/ModuleBuilder.cpp +++ lib/CodeGen/ModuleBuilder.cpp @@ -124,9 +124,9 @@ M->setTargetTriple(Ctx->getTargetInfo().getTriple().getTriple()); M->setDataLayout(Ctx->getTargetInfo().getDataLayout()); - Builder.reset(new CodeGen::CodeGenModule(Context, HeaderSearchOpts, + Builder = llvm::make_unique(Context, HeaderSearchOpts, PreprocessorOpts, CodeGenOpts, - *M, Diags, CoverageInfo)); + *M, Diags, CoverageInfo); for (auto &&Lib : CodeGenOpts.DependentLibraries) Builder->AddDependentLib(Lib); Index: lib/CodeGen/ObjectFilePCHContainerOperations.cpp =================================================================== --- lib/CodeGen/ObjectFilePCHContainerOperations.cpp +++ lib/CodeGen/ObjectFilePCHContainerOperations.cpp @@ -162,11 +162,11 @@ assert(!Ctx && "initialized multiple times"); Ctx = &Context; - VMContext.reset(new llvm::LLVMContext()); - M.reset(new llvm::Module(MainFileName, *VMContext)); + VMContext = llvm::make_unique(); + M = llvm::make_unique(MainFileName, *VMContext); M->setDataLayout(Ctx->getTargetInfo().getDataLayout()); - Builder.reset(new CodeGen::CodeGenModule( - *Ctx, HeaderSearchOpts, PreprocessorOpts, CodeGenOpts, *M, Diags)); + Builder = llvm::make_unique( + *Ctx, HeaderSearchOpts, PreprocessorOpts, CodeGenOpts, *M, Diags); // Prepare CGDebugInfo to emit debug info for a clang module. auto *DI = Builder->getModuleDebugInfo(); Index: lib/Driver/ToolChain.cpp =================================================================== --- lib/Driver/ToolChain.cpp +++ lib/Driver/ToolChain.cpp @@ -97,13 +97,13 @@ const SanitizerArgs& ToolChain::getSanitizerArgs() const { if (!SanitizerArguments.get()) - SanitizerArguments.reset(new SanitizerArgs(*this, Args)); + SanitizerArguments = llvm::make_unique(*this, Args); return *SanitizerArguments.get(); } const XRayArgs& ToolChain::getXRayArgs() const { if (!XRayArguments.get()) - XRayArguments.reset(new XRayArgs(*this, Args)); + XRayArguments = llvm::make_unique(*this, Args); return *XRayArguments.get(); } @@ -223,7 +223,7 @@ Tool *ToolChain::getClang() const { if (!Clang) - Clang.reset(new tools::Clang(*this)); + Clang = llvm::make_unique(*this); return Clang.get(); } @@ -243,7 +243,7 @@ Tool *ToolChain::getClangAs() const { if (!Assemble) - Assemble.reset(new tools::ClangAs(*this)); + Assemble = llvm::make_unique(*this); return Assemble.get(); } @@ -255,7 +255,7 @@ Tool *ToolChain::getOffloadBundler() const { if (!OffloadBundler) - OffloadBundler.reset(new tools::OffloadBundler(*this)); + OffloadBundler = llvm::make_unique(*this); return OffloadBundler.get(); } Index: lib/Driver/ToolChains/Clang.cpp =================================================================== --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -4852,7 +4852,7 @@ visualstudio::Compiler *Clang::getCLFallback() const { if (!CLFallback) - CLFallback.reset(new visualstudio::Compiler(getToolChain())); + CLFallback = llvm::make_unique(getToolChain()); return CLFallback.get(); } Index: lib/Driver/ToolChains/Darwin.cpp =================================================================== --- lib/Driver/ToolChains/Darwin.cpp +++ lib/Driver/ToolChains/Darwin.cpp @@ -811,15 +811,15 @@ switch (AC) { case Action::LipoJobClass: if (!Lipo) - Lipo.reset(new tools::darwin::Lipo(*this)); + Lipo = llvm::make_unique(*this); return Lipo.get(); case Action::DsymutilJobClass: if (!Dsymutil) - Dsymutil.reset(new tools::darwin::Dsymutil(*this)); + Dsymutil = llvm::make_unique(*this); return Dsymutil.get(); case Action::VerifyDebugInfoJobClass: if (!VerifyDebug) - VerifyDebug.reset(new tools::darwin::VerifyDebug(*this)); + VerifyDebug = llvm::make_unique(*this); return VerifyDebug.get(); default: return ToolChain::getTool(AC); Index: lib/Driver/ToolChains/Gnu.cpp =================================================================== --- lib/Driver/ToolChains/Gnu.cpp +++ lib/Driver/ToolChains/Gnu.cpp @@ -2249,11 +2249,11 @@ switch (AC) { case Action::PreprocessJobClass: if (!Preprocess) - Preprocess.reset(new clang::driver::tools::gcc::Preprocessor(*this)); + Preprocess = llvm::make_unique(*this); return Preprocess.get(); case Action::CompileJobClass: if (!Compile) - Compile.reset(new tools::gcc::Compiler(*this)); + Compile = llvm::make_unique(*this); return Compile.get(); default: return ToolChain::getTool(AC); Index: lib/Driver/ToolChains/MinGW.cpp =================================================================== --- lib/Driver/ToolChains/MinGW.cpp +++ lib/Driver/ToolChains/MinGW.cpp @@ -328,11 +328,11 @@ switch (AC) { case Action::PreprocessJobClass: if (!Preprocessor) - Preprocessor.reset(new tools::gcc::Preprocessor(*this)); + Preprocessor = llvm::make_unique(*this); return Preprocessor.get(); case Action::CompileJobClass: if (!Compiler) - Compiler.reset(new tools::gcc::Compiler(*this)); + Compiler = llvm::make_unique(*this); return Compiler.get(); default: return ToolChain::getTool(AC); Index: lib/Driver/ToolChains/Myriad.cpp =================================================================== --- lib/Driver/ToolChains/Myriad.cpp +++ lib/Driver/ToolChains/Myriad.cpp @@ -269,11 +269,11 @@ case Action::PreprocessJobClass: case Action::CompileJobClass: if (!Compiler) - Compiler.reset(new tools::SHAVE::Compiler(*this)); + Compiler = llvm::make_unique(*this); return Compiler.get(); case Action::AssembleJobClass: if (!Assembler) - Assembler.reset(new tools::SHAVE::Assembler(*this)); + Assembler = llvm::make_unique(*this); return Assembler.get(); default: return ToolChain::getTool(JA.getKind()); Index: lib/Format/ContinuationIndenter.cpp =================================================================== --- lib/Format/ContinuationIndenter.cpp +++ lib/Format/ContinuationIndenter.cpp @@ -1241,9 +1241,9 @@ Text.startswith(Prefix = "u8\"") || Text.startswith(Prefix = "L\""))) || (Text.startswith(Prefix = "_T(\"") && Text.endswith(Postfix = "\")"))) { - Token.reset(new BreakableStringLiteral(Current, StartColumn, Prefix, + Token = llvm::make_unique(Current, StartColumn, Prefix, Postfix, State.Line->InPPDirective, - Encoding, Style)); + Encoding, Style); } else { return 0; } @@ -1254,9 +1254,9 @@ // but we may still want to adjust its indentation. switchesFormatting(Current)) return addMultilineToken(Current, State); - Token.reset(new BreakableBlockComment( + Token = llvm::make_unique( Current, StartColumn, Current.OriginalColumn, !Current.Previous, - State.Line->InPPDirective, Encoding, Style)); + State.Line->InPPDirective, Encoding, Style); } else if (Current.is(TT_LineComment) && (Current.Previous == nullptr || Current.Previous->isNot(TT_ImplicitStringLiteral))) { @@ -1264,9 +1264,9 @@ CommentPragmasRegex.match(Current.TokenText.substr(2)) || switchesFormatting(Current)) return 0; - Token.reset(new BreakableLineCommentSection( + Token = llvm::make_unique( Current, StartColumn, Current.OriginalColumn, !Current.Previous, - /*InPPDirective=*/false, Encoding, Style)); + /*InPPDirective=*/false, Encoding, Style); // We don't insert backslashes when breaking line comments. ColumnLimit = Style.ColumnLimit; } else { Index: lib/Format/FormatTokenLexer.cpp =================================================================== --- lib/Format/FormatTokenLexer.cpp +++ lib/Format/FormatTokenLexer.cpp @@ -32,8 +32,8 @@ Keywords(IdentTable), Encoding(Encoding), FirstInLineIndex(0), FormattingDisabled(false), MacroBlockBeginRegex(Style.MacroBlockBegin), MacroBlockEndRegex(Style.MacroBlockEnd) { - Lex.reset(new Lexer(ID, SourceMgr.getBuffer(ID), SourceMgr, - getFormattingLangOpts(Style))); + Lex = llvm::make_unique(ID, SourceMgr.getBuffer(ID), SourceMgr, + getFormattingLangOpts(Style)); Lex->SetKeepWhitespaceMode(true); for (const std::string &ForEachMacro : Style.ForEachMacros) @@ -659,9 +659,9 @@ void FormatTokenLexer::resetLexer(unsigned Offset) { StringRef Buffer = SourceMgr.getBufferData(ID); - Lex.reset(new Lexer(SourceMgr.getLocForStartOfFile(ID), + Lex = llvm::make_unique(SourceMgr.getLocForStartOfFile(ID), getFormattingLangOpts(Style), Buffer.begin(), - Buffer.begin() + Offset, Buffer.end())); + Buffer.begin() + Offset, Buffer.end()); Lex->SetKeepWhitespaceMode(true); TrailingWhitespace = 0; } Index: lib/Format/TokenAnnotator.cpp =================================================================== --- lib/Format/TokenAnnotator.cpp +++ lib/Format/TokenAnnotator.cpp @@ -463,7 +463,7 @@ if (Current->is(tok::comma)) { ++Left->ParameterCount; if (!Left->Role) - Left->Role.reset(new CommaSeparatedList(Style)); + Left->Role = llvm::make_unique(Style); Left->Role->CommaFound(Current); } else if (Left->ParameterCount == 0 && Current->isNot(tok::comment)) { Left->ParameterCount = 1; Index: lib/Format/UnwrappedLineParser.cpp =================================================================== --- lib/Format/UnwrappedLineParser.cpp +++ lib/Format/UnwrappedLineParser.cpp @@ -235,7 +235,7 @@ void UnwrappedLineParser::reset() { PPBranchLevel = -1; - Line.reset(new UnwrappedLine); + Line = llvm::make_unique(); CommentsBeforeNextToken.clear(); FormatTok = nullptr; MustBreakBeforeNextToken = false; Index: lib/Frontend/ASTUnit.cpp =================================================================== --- lib/Frontend/ASTUnit.cpp +++ lib/Frontend/ASTUnit.cpp @@ -699,11 +699,11 @@ AST->PCMCache = new MemoryBufferCache; AST->HSOpts = std::make_shared(); AST->HSOpts->ModuleFormat = PCHContainerRdr.getFormat(); - AST->HeaderInfo.reset(new HeaderSearch(AST->HSOpts, + AST->HeaderInfo = llvm::make_unique(AST->HSOpts, AST->getSourceManager(), AST->getDiagnostics(), AST->getLangOpts(), - /*Target=*/nullptr)); + /*Target=*/nullptr); AST->PPOpts = std::make_shared(); for (const auto &RemappedFile : RemappedFiles) @@ -765,10 +765,10 @@ PP.setCounterValue(Counter); // Create an AST consumer, even though it isn't used. - AST->Consumer.reset(new ASTConsumer); + AST->Consumer = llvm::make_unique(); // Create a semantic analysis object and tell the AST reader about it. - AST->TheSema.reset(new Sema(PP, Context, *AST->Consumer)); + AST->TheSema = llvm::make_unique(PP, Context, *AST->Consumer); AST->TheSema->Initialize(); AST->Reader->InitializeSema(*AST->TheSema); @@ -1605,7 +1605,7 @@ Clang->addDependencyCollector(PreambleDepCollector); std::unique_ptr Act; - Act.reset(new PrecompilePreambleAction(*this)); + Act = llvm::make_unique(*this); if (!Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0])) { llvm::sys::fs::remove(FrontendOpts.OutputFile); Preamble.clear(); @@ -1857,7 +1857,7 @@ std::unique_ptr TrackerAct; if (!Act) { - TrackerAct.reset(new TopLevelDeclTrackerAction(*AST)); + TrackerAct = llvm::make_unique(*AST); Act = TrackerAct.get(); } @@ -2047,7 +2047,7 @@ AST->StoredDiagnostics.swap(StoredDiagnostics); AST->Invocation = CI; if (ForSerialization) - AST->WriterData.reset(new ASTWriterData(*AST->PCMCache)); + AST->WriterData = llvm::make_unique(*AST->PCMCache); // Zero out now to ease cleanup during crash recovery. CI = nullptr; Diags = nullptr; @@ -2525,7 +2525,7 @@ PreprocessorOpts.DetailedRecord = false; std::unique_ptr Act; - Act.reset(new SyntaxOnlyAction); + Act = llvm::make_unique(); if (Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0])) { Act->Execute(); Act->EndSourceFile(); Index: lib/Frontend/CompilerInstance.cpp =================================================================== --- lib/Frontend/CompilerInstance.cpp +++ lib/Frontend/CompilerInstance.cpp @@ -606,11 +606,11 @@ } void CompilerInstance::createFrontendTimer() { - FrontendTimerGroup.reset( - new llvm::TimerGroup("frontend", "Clang front-end time report")); - FrontendTimer.reset( - new llvm::Timer("frontend", "Clang front-end timer", - *FrontendTimerGroup)); + FrontendTimerGroup = llvm::make_unique( + "frontend", "Clang front-end time report"); + FrontendTimer = llvm::make_unique( + "frontend", "Clang front-end timer", + *FrontendTimerGroup); } CodeCompleteConsumer * @@ -629,8 +629,8 @@ void CompilerInstance::createSema(TranslationUnitKind TUKind, CodeCompleteConsumer *CompletionConsumer) { - TheSema.reset(new Sema(getPreprocessor(), getASTContext(), getASTConsumer(), - TUKind, CompletionConsumer)); + TheSema = llvm::make_unique(getPreprocessor(), getASTContext(), getASTConsumer(), + TUKind, CompletionConsumer); // Attach the external sema source if there is any. if (ExternalSemaSrc) { TheSema->addExternalSource(ExternalSemaSrc.get()); @@ -775,7 +775,7 @@ } if (!EC) { - OS.reset(new llvm::raw_fd_ostream(fd, /*shouldClose=*/true)); + OS = llvm::make_unique(fd, /*shouldClose=*/true); OSFile = TempFile = TempPath.str(); } // If we failed to create the temporary, fallback to writing to the file @@ -785,9 +785,9 @@ if (!OS) { OSFile = OutFile; - OS.reset(new llvm::raw_fd_ostream( + OS = llvm::make_unique( OSFile, Error, - (Binary ? llvm::sys::fs::F_None : llvm::sys::fs::F_Text))); + (Binary ? llvm::sys::fs::F_None : llvm::sys::fs::F_Text)); if (Error) return nullptr; } Index: lib/Frontend/FrontendActions.cpp =================================================================== --- lib/Frontend/FrontendActions.cpp +++ lib/Frontend/FrontendActions.cpp @@ -407,8 +407,8 @@ StringRef OutputFileName = getCompilerInstance().getFrontendOpts().OutputFile; if (!OutputFileName.empty() && OutputFileName != "-") { std::error_code EC; - OutFile.reset(new llvm::raw_fd_ostream(OutputFileName.str(), EC, - llvm::sys::fs::F_Text)); + OutFile = llvm::make_unique(OutputFileName.str(), EC, + llvm::sys::fs::F_Text); } llvm::raw_ostream &Out = OutFile.get()? *OutFile.get() : llvm::outs(); Index: lib/Frontend/Rewrite/FixItRewriter.cpp =================================================================== --- lib/Frontend/Rewrite/FixItRewriter.cpp +++ lib/Frontend/Rewrite/FixItRewriter.cpp @@ -95,9 +95,9 @@ std::error_code EC; std::unique_ptr OS; if (fd != -1) { - OS.reset(new llvm::raw_fd_ostream(fd, /*shouldClose=*/true)); + OS = llvm::make_unique(fd, /*shouldClose=*/true); } else { - OS.reset(new llvm::raw_fd_ostream(Filename, EC, llvm::sys::fs::F_None)); + OS = llvm::make_unique(Filename, EC, llvm::sys::fs::F_None); } if (EC) { Diags.Report(clang::diag::err_fe_unable_to_open_output) << Filename Index: lib/Frontend/Rewrite/FrontendActions.cpp =================================================================== --- lib/Frontend/Rewrite/FrontendActions.cpp +++ lib/Frontend/Rewrite/FrontendActions.cpp @@ -94,14 +94,14 @@ bool FixItAction::BeginSourceFileAction(CompilerInstance &CI) { const FrontendOptions &FEOpts = getCompilerInstance().getFrontendOpts(); if (!FEOpts.FixItSuffix.empty()) { - FixItOpts.reset(new FixItActionSuffixInserter(FEOpts.FixItSuffix, - FEOpts.FixWhatYouCan)); + FixItOpts = llvm::make_unique(FEOpts.FixItSuffix, + FEOpts.FixWhatYouCan); } else { - FixItOpts.reset(new FixItRewriteInPlace); + FixItOpts = llvm::make_unique(); FixItOpts->FixWhatYouCan = FEOpts.FixWhatYouCan; } - Rewriter.reset(new FixItRewriter(CI.getDiagnostics(), CI.getSourceManager(), - CI.getLangOpts(), FixItOpts.get())); + Rewriter = llvm::make_unique(CI.getDiagnostics(), CI.getSourceManager(), + CI.getLangOpts(), FixItOpts.get()); return true; } @@ -120,9 +120,9 @@ if (FixAction->BeginSourceFile(CI, FEOpts.Inputs[0])) { std::unique_ptr FixItOpts; if (FEOpts.FixToTemporaries) - FixItOpts.reset(new FixItRewriteToTemp()); + FixItOpts = llvm::make_unique(); else - FixItOpts.reset(new FixItRewriteInPlace()); + FixItOpts = llvm::make_unique(); FixItOpts->Silent = true; FixItOpts->FixWhatYouCan = FEOpts.FixWhatYouCan; FixItOpts->FixOnlyWarnings = FEOpts.FixOnlyWarnings; Index: lib/Frontend/TextDiagnosticPrinter.cpp =================================================================== --- lib/Frontend/TextDiagnosticPrinter.cpp +++ lib/Frontend/TextDiagnosticPrinter.cpp @@ -37,7 +37,7 @@ void TextDiagnosticPrinter::BeginSourceFile(const LangOptions &LO, const Preprocessor *PP) { // Build the TextDiagnostic utility. - TextDiag.reset(new TextDiagnostic(OS, LO, &*DiagOpts)); + TextDiag = llvm::make_unique(OS, LO, &*DiagOpts); } void TextDiagnosticPrinter::EndSourceFile() { Index: lib/Frontend/VerifyDiagnosticConsumer.cpp =================================================================== --- lib/Frontend/VerifyDiagnosticConsumer.cpp +++ lib/Frontend/VerifyDiagnosticConsumer.cpp @@ -881,7 +881,7 @@ Diags.setClient(CurClient, Owner.release() != nullptr); // Reset the buffer, we have processed all the diagnostics in it. - Buffer.reset(new TextDiagnosticBuffer()); + Buffer = llvm::make_unique(); ED.Reset(); } Index: lib/Parse/ParseDecl.cpp =================================================================== --- lib/Parse/ParseDecl.cpp +++ lib/Parse/ParseDecl.cpp @@ -6302,7 +6302,7 @@ // If we're inside a class definition, cache the tokens // corresponding to the default argument. We'll actually parse // them when we see the end of the class definition. - DefArgToks.reset(new CachedTokens); + DefArgToks = llvm::make_unique(); SourceLocation ArgStartLoc = NextToken().getLocation(); if (!ConsumeAndStoreInitializer(*DefArgToks, CIK_DefaultArgument)) { Index: lib/Parse/ParsePragma.cpp =================================================================== --- lib/Parse/ParsePragma.cpp +++ lib/Parse/ParsePragma.cpp @@ -206,100 +206,100 @@ } // end namespace void Parser::initializePragmaHandlers() { - AlignHandler.reset(new PragmaAlignHandler()); + AlignHandler = llvm::make_unique(); PP.AddPragmaHandler(AlignHandler.get()); - GCCVisibilityHandler.reset(new PragmaGCCVisibilityHandler()); + GCCVisibilityHandler = llvm::make_unique(); PP.AddPragmaHandler("GCC", GCCVisibilityHandler.get()); - OptionsHandler.reset(new PragmaOptionsHandler()); + OptionsHandler = llvm::make_unique(); PP.AddPragmaHandler(OptionsHandler.get()); - PackHandler.reset(new PragmaPackHandler()); + PackHandler = llvm::make_unique(); PP.AddPragmaHandler(PackHandler.get()); - MSStructHandler.reset(new PragmaMSStructHandler()); + MSStructHandler = llvm::make_unique(); PP.AddPragmaHandler(MSStructHandler.get()); - UnusedHandler.reset(new PragmaUnusedHandler()); + UnusedHandler = llvm::make_unique(); PP.AddPragmaHandler(UnusedHandler.get()); - WeakHandler.reset(new PragmaWeakHandler()); + WeakHandler = llvm::make_unique(); PP.AddPragmaHandler(WeakHandler.get()); - RedefineExtnameHandler.reset(new PragmaRedefineExtnameHandler()); + RedefineExtnameHandler = llvm::make_unique(); PP.AddPragmaHandler(RedefineExtnameHandler.get()); - FPContractHandler.reset(new PragmaFPContractHandler()); + FPContractHandler = llvm::make_unique(); PP.AddPragmaHandler("STDC", FPContractHandler.get()); - PCSectionHandler.reset(new PragmaClangSectionHandler(Actions)); + PCSectionHandler = llvm::make_unique(Actions); PP.AddPragmaHandler("clang", PCSectionHandler.get()); if (getLangOpts().OpenCL) { - OpenCLExtensionHandler.reset(new PragmaOpenCLExtensionHandler()); + OpenCLExtensionHandler = llvm::make_unique(); PP.AddPragmaHandler("OPENCL", OpenCLExtensionHandler.get()); PP.AddPragmaHandler("OPENCL", FPContractHandler.get()); } if (getLangOpts().OpenMP) - OpenMPHandler.reset(new PragmaOpenMPHandler()); + OpenMPHandler = llvm::make_unique(); else - OpenMPHandler.reset(new PragmaNoOpenMPHandler()); + OpenMPHandler = llvm::make_unique(); PP.AddPragmaHandler(OpenMPHandler.get()); if (getLangOpts().MicrosoftExt || getTargetInfo().getTriple().isPS4()) { - MSCommentHandler.reset(new PragmaCommentHandler(Actions)); + MSCommentHandler = llvm::make_unique(Actions); PP.AddPragmaHandler(MSCommentHandler.get()); } if (getLangOpts().MicrosoftExt) { - MSDetectMismatchHandler.reset(new PragmaDetectMismatchHandler(Actions)); + MSDetectMismatchHandler = llvm::make_unique(Actions); PP.AddPragmaHandler(MSDetectMismatchHandler.get()); - MSPointersToMembers.reset(new PragmaMSPointersToMembers()); + MSPointersToMembers = llvm::make_unique(); PP.AddPragmaHandler(MSPointersToMembers.get()); - MSVtorDisp.reset(new PragmaMSVtorDisp()); + MSVtorDisp = llvm::make_unique(); PP.AddPragmaHandler(MSVtorDisp.get()); - MSInitSeg.reset(new PragmaMSPragma("init_seg")); + MSInitSeg = llvm::make_unique("init_seg"); PP.AddPragmaHandler(MSInitSeg.get()); - MSDataSeg.reset(new PragmaMSPragma("data_seg")); + MSDataSeg = llvm::make_unique("data_seg"); PP.AddPragmaHandler(MSDataSeg.get()); - MSBSSSeg.reset(new PragmaMSPragma("bss_seg")); + MSBSSSeg = llvm::make_unique("bss_seg"); PP.AddPragmaHandler(MSBSSSeg.get()); - MSConstSeg.reset(new PragmaMSPragma("const_seg")); + MSConstSeg = llvm::make_unique("const_seg"); PP.AddPragmaHandler(MSConstSeg.get()); - MSCodeSeg.reset(new PragmaMSPragma("code_seg")); + MSCodeSeg = llvm::make_unique("code_seg"); PP.AddPragmaHandler(MSCodeSeg.get()); - MSSection.reset(new PragmaMSPragma("section")); + MSSection = llvm::make_unique("section"); PP.AddPragmaHandler(MSSection.get()); - MSRuntimeChecks.reset(new PragmaMSRuntimeChecksHandler()); + MSRuntimeChecks = llvm::make_unique(); PP.AddPragmaHandler(MSRuntimeChecks.get()); - MSIntrinsic.reset(new PragmaMSIntrinsicHandler()); + MSIntrinsic = llvm::make_unique(); PP.AddPragmaHandler(MSIntrinsic.get()); } if (getLangOpts().CUDA) { - CUDAForceHostDeviceHandler.reset( - new PragmaForceCUDAHostDeviceHandler(Actions)); + CUDAForceHostDeviceHandler = llvm::make_unique( + Actions); PP.AddPragmaHandler("clang", CUDAForceHostDeviceHandler.get()); } - OptimizeHandler.reset(new PragmaOptimizeHandler(Actions)); + OptimizeHandler = llvm::make_unique(Actions); PP.AddPragmaHandler("clang", OptimizeHandler.get()); - LoopHintHandler.reset(new PragmaLoopHintHandler()); + LoopHintHandler = llvm::make_unique(); PP.AddPragmaHandler("clang", LoopHintHandler.get()); - UnrollHintHandler.reset(new PragmaUnrollHintHandler("unroll")); + UnrollHintHandler = llvm::make_unique("unroll"); PP.AddPragmaHandler(UnrollHintHandler.get()); - NoUnrollHintHandler.reset(new PragmaUnrollHintHandler("nounroll")); + NoUnrollHintHandler = llvm::make_unique("nounroll"); PP.AddPragmaHandler(NoUnrollHintHandler.get()); - FPHandler.reset(new PragmaFPHandler()); + FPHandler = llvm::make_unique(); PP.AddPragmaHandler("clang", FPHandler.get()); - AttributePragmaHandler.reset(new PragmaAttributeHandler(AttrFactory)); + AttributePragmaHandler = llvm::make_unique(AttrFactory); PP.AddPragmaHandler("clang", AttributePragmaHandler.get()); } Index: lib/Parse/Parser.cpp =================================================================== --- lib/Parse/Parser.cpp +++ lib/Parse/Parser.cpp @@ -63,7 +63,7 @@ // destructor. initializePragmaHandlers(); - CommentSemaHandler.reset(new ActionCommentHandler(actions)); + CommentSemaHandler = llvm::make_unique(actions); PP.addCommentHandler(CommentSemaHandler.get()); PP.setCodeCompletionHandler(*this); Index: lib/Rewrite/Rewriter.cpp =================================================================== --- lib/Rewrite/Rewriter.cpp +++ lib/Rewrite/Rewriter.cpp @@ -412,7 +412,7 @@ Diagnostics.Report(clang::diag::err_unable_to_make_temp) << TempFilename; } else { - FileStream.reset(new llvm::raw_fd_ostream(FD, /*shouldClose=*/true)); + FileStream = llvm::make_unique(FD, /*shouldClose=*/true); } } Index: lib/Rewrite/TokenRewriter.cpp =================================================================== --- lib/Rewrite/TokenRewriter.cpp +++ lib/Rewrite/TokenRewriter.cpp @@ -20,7 +20,7 @@ TokenRewriter::TokenRewriter(FileID FID, SourceManager &SM, const LangOptions &LangOpts) { - ScratchBuf.reset(new ScratchBuffer(SM)); + ScratchBuf = llvm::make_unique(SM); // Create a lexer to lex all the tokens of the main file in raw mode. const llvm::MemoryBuffer *FromFile = SM.getBuffer(FID); Index: lib/Sema/AnalysisBasedWarnings.cpp =================================================================== --- lib/Sema/AnalysisBasedWarnings.cpp +++ lib/Sema/AnalysisBasedWarnings.cpp @@ -1988,7 +1988,7 @@ std::unique_ptr LEH; if (!Diags.isIgnored(diag::warn_tautological_overlap_comparison, D->getLocStart())) { - LEH.reset(new LogicalErrorHandler(S)); + LEH = llvm::make_unique(S); AC.getCFGBuildOptions().Observer = LEH.get(); } Index: lib/Sema/Sema.cpp =================================================================== --- lib/Sema/Sema.cpp +++ lib/Sema/Sema.cpp @@ -106,10 +106,10 @@ NSNumberLiteralMethods[I] = nullptr; if (getLangOpts().ObjC1) - NSAPIObj.reset(new NSAPI(Context)); + NSAPIObj = llvm::make_unique(Context); if (getLangOpts().CPlusPlus) - FieldCollector.reset(new CXXFieldCollector()); + FieldCollector = llvm::make_unique(); // Tell diagnostics how to render things from the AST library. Diags.SetArgToStringFn(&FormatASTNodeDiagnosticArgument, &Context); Index: lib/Sema/SemaChecking.cpp =================================================================== --- lib/Sema/SemaChecking.cpp +++ lib/Sema/SemaChecking.cpp @@ -11905,8 +11905,8 @@ bool LayoutCompatible, bool MustBeNull) { if (!TypeTagForDatatypeMagicValues) - TypeTagForDatatypeMagicValues.reset( - new llvm::DenseMap); + TypeTagForDatatypeMagicValues = llvm::make_unique>( + ); TypeTagMagicValue Magic(ArgumentKind, MagicValue); (*TypeTagForDatatypeMagicValues)[Magic] = Index: lib/Sema/SemaDeclCXX.cpp =================================================================== --- lib/Sema/SemaDeclCXX.cpp +++ lib/Sema/SemaDeclCXX.cpp @@ -5259,7 +5259,7 @@ } if (!PureVirtualClassDiagSet) - PureVirtualClassDiagSet.reset(new RecordDeclSetTy); + PureVirtualClassDiagSet = llvm::make_unique(); PureVirtualClassDiagSet->insert(RD); } Index: lib/Sema/SemaDeclObjC.cpp =================================================================== --- lib/Sema/SemaDeclObjC.cpp +++ lib/Sema/SemaDeclObjC.cpp @@ -2629,7 +2629,7 @@ // protocols for now for controlled evaluation. if (PDecl->hasAttr()) { if (!ProtocolsExplictImpl) { - ProtocolsExplictImpl.reset(new ProtocolNameSet); + ProtocolsExplictImpl = llvm::make_unique(); findProtocolsWithExplicitImpls(Super, *ProtocolsExplictImpl); } if (ProtocolsExplictImpl->find(PDecl->getIdentifier()) != Index: lib/Sema/SemaObjCProperty.cpp =================================================================== --- lib/Sema/SemaObjCProperty.cpp +++ lib/Sema/SemaObjCProperty.cpp @@ -1859,7 +1859,7 @@ // analyzing the @implementation. if (!LazyMap) { ObjCContainerDecl::PropertyMap NoNeedToImplPropMap; - LazyMap.reset(new ObjCContainerDecl::PropertyMap()); + LazyMap = llvm::make_unique(); CollectImmediateProperties(CDecl, *LazyMap, NoNeedToImplPropMap, /* CollectClassPropsOnly */ false, /* IncludeProtocols */ false); Index: lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp +++ lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp @@ -67,9 +67,9 @@ return; if (!BT) - BT.reset(new BuiltinBug( + BT = llvm::make_unique( this, "Out-of-bound array access", - "Access out-of-bound array element (buffer overflow)")); + "Access out-of-bound array element (buffer overflow)"); // FIXME: It would be nice to eventually make this diagnostic more clear, // e.g., by referencing the original declaration or by saying *why* this Index: lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp +++ lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp @@ -235,7 +235,7 @@ return; if (!BT) - BT.reset(new BuiltinBug(this, "Out-of-bound access")); + BT = llvm::make_unique(this, "Out-of-bound access"); // FIXME: This diagnostics are preliminary. We should get far better // diagnostics for explaining buffer overruns. Index: lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp +++ lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp @@ -204,7 +204,7 @@ const Expr *E, CheckerContext &C) const { if (!BT) - BT.reset(new APIMisuse(this, "nil argument")); + BT = llvm::make_unique(this, "nil argument"); auto R = llvm::make_unique(*BT, Msg, N); R->addRange(Range); @@ -514,7 +514,7 @@ << (isCreate ? "lost." : "garbage."); if (!BT) - BT.reset(new APIMisuse(this, "Bad use of CFNumber APIs")); + BT = llvm::make_unique(this, "Bad use of CFNumber APIs"); auto report = llvm::make_unique(*BT, os.str(), N); report->addRange(CE->getArg(2)->getSourceRange()); @@ -556,8 +556,8 @@ Release = &Ctx.Idents.get("CFRelease"); MakeCollectable = &Ctx.Idents.get("CFMakeCollectable"); Autorelease = &Ctx.Idents.get("CFAutorelease"); - BT.reset(new APIMisuse( - this, "null passed to CF memory management function")); + BT = llvm::make_unique( + this, "null passed to CF memory management function"); } // Check if we called CFRetain/CFRelease/CFMakeCollectable/CFAutorelease. @@ -636,8 +636,8 @@ void ClassReleaseChecker::checkPreObjCMessage(const ObjCMethodCall &msg, CheckerContext &C) const { if (!BT) { - BT.reset(new APIMisuse( - this, "message incorrectly sent to class instead of class instance")); + BT = llvm::make_unique( + this, "message incorrectly sent to class instead of class instance"); ASTContext &Ctx = C.getASTContext(); releaseS = GetNullarySelector("release", Ctx); @@ -744,9 +744,9 @@ void VariadicMethodTypeChecker::checkPreObjCMessage(const ObjCMethodCall &msg, CheckerContext &C) const { if (!BT) { - BT.reset(new APIMisuse(this, + BT = llvm::make_unique(this, "Arguments passed to variadic method aren't all " - "Objective-C pointer types")); + "Objective-C pointer types"); ASTContext &Ctx = C.getASTContext(); arrayWithObjectsS = GetUnarySelector("arrayWithObjects", Ctx); Index: lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp +++ lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp @@ -70,9 +70,9 @@ MtxTryLock("mtx_trylock"), MtxUnlock("mtx_unlock") { // Initialize the bug type. - BlockInCritSectionBugType.reset( - new BugType(this, "Call to blocking function in critical section", - "Blocking Error")); + BlockInCritSectionBugType = llvm::make_unique( + this, "Call to blocking function in critical section", + "Blocking Error"); } bool BlockInCriticalSectionChecker::isBlockingFunction(const CallEvent &Call) const { Index: lib/StaticAnalyzer/Checkers/BoolAssignmentChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/BoolAssignmentChecker.cpp +++ lib/StaticAnalyzer/Checkers/BoolAssignmentChecker.cpp @@ -34,7 +34,7 @@ CheckerContext &C) const { if (ExplodedNode *N = C.generateNonFatalErrorNode(state)) { if (!BT) - BT.reset(new BuiltinBug(this, "Assignment of a non-Boolean value")); + BT = llvm::make_unique(this, "Assignment of a non-Boolean value"); C.emitReport(llvm::make_unique(*BT, BT->getDescription(), N)); } } Index: lib/StaticAnalyzer/Checkers/CStringChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/CStringChecker.cpp +++ lib/StaticAnalyzer/Checkers/CStringChecker.cpp @@ -246,9 +246,9 @@ return nullptr; if (!BT_Null) - BT_Null.reset(new BuiltinBug( + BT_Null = llvm::make_unique( Filter.CheckNameCStringNullArg, categories::UnixAPI, - "Null pointer argument in call to byte string function")); + "Null pointer argument in call to byte string function"); SmallString<80> buf; llvm::raw_svector_ostream os(buf); @@ -309,9 +309,9 @@ return nullptr; if (!BT_Bounds) { - BT_Bounds.reset(new BuiltinBug( + BT_Bounds = llvm::make_unique( Filter.CheckNameCStringOutOfBounds, "Out-of-bound array access", - "Byte string function accesses out-of-bound array element")); + "Byte string function accesses out-of-bound array element"); } BuiltinBug *BT = static_cast(BT_Bounds.get()); @@ -542,8 +542,8 @@ return; if (!BT_Overlap) - BT_Overlap.reset(new BugType(Filter.CheckNameCStringBufferOverlap, - categories::UnixAPI, "Improper arguments")); + BT_Overlap = llvm::make_unique(Filter.CheckNameCStringBufferOverlap, + categories::UnixAPI, "Improper arguments"); // Generate a report for this bug. auto report = llvm::make_unique( @@ -602,9 +602,9 @@ return nullptr; if (!BT_AdditionOverflow) - BT_AdditionOverflow.reset( - new BuiltinBug(Filter.CheckNameCStringOutOfBounds, "API", - "Sum of expressions causes overflow")); + BT_AdditionOverflow = llvm::make_unique( + Filter.CheckNameCStringOutOfBounds, "API", + "Sum of expressions causes overflow"); // This isn't a great error message, but this should never occur in real // code anyway -- you'd have to create a buffer longer than a size_t can @@ -721,9 +721,9 @@ if (ExplodedNode *N = C.generateNonFatalErrorNode(state)) { if (!BT_NotCString) - BT_NotCString.reset(new BuiltinBug( + BT_NotCString = llvm::make_unique( Filter.CheckNameCStringNotNullTerm, categories::UnixAPI, - "Argument is not a null-terminated string.")); + "Argument is not a null-terminated string."); SmallString<120> buf; llvm::raw_svector_ostream os(buf); @@ -781,9 +781,9 @@ if (ExplodedNode *N = C.generateNonFatalErrorNode(state)) { if (!BT_NotCString) - BT_NotCString.reset(new BuiltinBug( + BT_NotCString = llvm::make_unique( Filter.CheckNameCStringNotNullTerm, categories::UnixAPI, - "Argument is not a null-terminated string.")); + "Argument is not a null-terminated string."); SmallString<120> buf; llvm::raw_svector_ostream os(buf); Index: lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp +++ lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp @@ -87,7 +87,7 @@ void LazyInit_BT(const char *desc, std::unique_ptr &BT) const { if (!BT) - BT.reset(new BuiltinBug(this, desc)); + BT = llvm::make_unique(this, desc); } bool uninitRefOrPointer(CheckerContext &C, const SVal &V, SourceRange ArgRange, const Expr *ArgEx, @@ -326,8 +326,8 @@ if (L.isUndef()) { if (!BT_call_undef) - BT_call_undef.reset(new BuiltinBug( - this, "Called function pointer is an uninitialized pointer value")); + BT_call_undef = llvm::make_unique( + this, "Called function pointer is an uninitialized pointer value"); emitBadCall(BT_call_undef.get(), C, Callee); return; } @@ -337,8 +337,8 @@ if (StNull && !StNonNull) { if (!BT_call_null) - BT_call_null.reset(new BuiltinBug( - this, "Called function pointer is null (null dereference)")); + BT_call_null = llvm::make_unique( + this, "Called function pointer is null (null dereference)"); emitBadCall(BT_call_null.get(), C, Callee); return; } @@ -356,8 +356,8 @@ if (!N) return; if (!BT_cxx_delete_undef) - BT_cxx_delete_undef.reset( - new BuiltinBug(this, "Uninitialized argument value")); + BT_cxx_delete_undef = llvm::make_unique( + this, "Uninitialized argument value"); if (DE->isArrayFormAsWritten()) Desc = "Argument to 'delete[]' is uninitialized"; else @@ -380,8 +380,8 @@ SVal V = CC->getCXXThisVal(); if (V.isUndef()) { if (!BT_cxx_call_undef) - BT_cxx_call_undef.reset( - new BuiltinBug(this, "Called C++ object pointer is uninitialized")); + BT_cxx_call_undef = llvm::make_unique( + this, "Called C++ object pointer is uninitialized"); emitBadCall(BT_cxx_call_undef.get(), C, CC->getCXXThisExpr()); return; } @@ -392,8 +392,8 @@ if (StNull && !StNonNull) { if (!BT_cxx_call_null) - BT_cxx_call_null.reset( - new BuiltinBug(this, "Called C++ object pointer is null")); + BT_cxx_call_null = llvm::make_unique( + this, "Called C++ object pointer is null"); emitBadCall(BT_cxx_call_null.get(), C, CC->getCXXThisExpr()); return; } @@ -467,21 +467,21 @@ switch (msg.getMessageKind()) { case OCM_Message: if (!BT_msg_undef) - BT_msg_undef.reset(new BuiltinBug(this, + BT_msg_undef = llvm::make_unique(this, "Receiver in message expression " - "is an uninitialized value")); + "is an uninitialized value"); BT = BT_msg_undef.get(); break; case OCM_PropertyAccess: if (!BT_objc_prop_undef) - BT_objc_prop_undef.reset(new BuiltinBug( - this, "Property access on an uninitialized object pointer")); + BT_objc_prop_undef = llvm::make_unique( + this, "Property access on an uninitialized object pointer"); BT = BT_objc_prop_undef.get(); break; case OCM_Subscript: if (!BT_objc_subscript_undef) - BT_objc_subscript_undef.reset(new BuiltinBug( - this, "Subscript access on an uninitialized object pointer")); + BT_objc_subscript_undef = llvm::make_unique( + this, "Subscript access on an uninitialized object pointer"); BT = BT_objc_subscript_undef.get(); break; } @@ -510,8 +510,8 @@ ExplodedNode *N) const { if (!BT_msg_ret) - BT_msg_ret.reset( - new BuiltinBug(this, "Receiver in message expression is 'nil'")); + BT_msg_ret = llvm::make_unique( + this, "Receiver in message expression is 'nil'"); const ObjCMessageExpr *ME = msg.getOriginExpr(); Index: lib/StaticAnalyzer/Checkers/CastSizeChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/CastSizeChecker.cpp +++ lib/StaticAnalyzer/Checkers/CastSizeChecker.cpp @@ -130,9 +130,9 @@ if (ExplodedNode *errorNode = C.generateErrorNode()) { if (!BT) - BT.reset(new BuiltinBug(this, "Cast region with wrong size.", + BT = llvm::make_unique(this, "Cast region with wrong size.", "Cast a region whose size is not a multiple" - " of the destination type size.")); + " of the destination type size."); auto R = llvm::make_unique(*BT, BT->getDescription(), errorNode); R->addRange(CE->getSourceRange()); C.emitReport(std::move(R)); Index: lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp +++ lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp @@ -759,17 +759,17 @@ : NSObjectII(nullptr), SenTestCaseII(nullptr), XCTestCaseII(nullptr), CIFilterII(nullptr) { - MissingReleaseBugType.reset( - new BugType(this, "Missing ivar release (leak)", - categories::MemoryCoreFoundationObjectiveC)); + MissingReleaseBugType = llvm::make_unique( + this, "Missing ivar release (leak)", + categories::MemoryCoreFoundationObjectiveC); - ExtraReleaseBugType.reset( - new BugType(this, "Extra ivar release", - categories::MemoryCoreFoundationObjectiveC)); + ExtraReleaseBugType = llvm::make_unique( + this, "Extra ivar release", + categories::MemoryCoreFoundationObjectiveC); - MistakenDeallocBugType.reset( - new BugType(this, "Mistaken dealloc", - categories::MemoryCoreFoundationObjectiveC)); + MistakenDeallocBugType = llvm::make_unique( + this, "Mistaken dealloc", + categories::MemoryCoreFoundationObjectiveC); } void ObjCDeallocChecker::initIdentifierInfoAndSelectors( Index: lib/StaticAnalyzer/Checkers/ChrootChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/ChrootChecker.cpp +++ lib/StaticAnalyzer/Checkers/ChrootChecker.cpp @@ -142,9 +142,9 @@ if (isRootChanged((intptr_t) *k)) if (ExplodedNode *N = C.generateNonFatalErrorNode()) { if (!BT_BreakJail) - BT_BreakJail.reset(new BuiltinBug( + BT_BreakJail = llvm::make_unique( this, "Break out of jail", "No call of chdir(\"/\") immediately " - "after chroot")); + "after chroot"); C.emitReport(llvm::make_unique( *BT_BreakJail, BT_BreakJail->getDescription(), N)); } Index: lib/StaticAnalyzer/Checkers/CloneChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/CloneChecker.cpp +++ lib/StaticAnalyzer/Checkers/CloneChecker.cpp @@ -112,7 +112,7 @@ std::vector &CloneGroups) const { if (!BT_Exact) - BT_Exact.reset(new BugType(this, "Exact code clone", "Code clone")); + BT_Exact = llvm::make_unique(this, "Exact code clone", "Code clone"); for (const CloneDetector::CloneGroup &Group : CloneGroups) { // We group the clones by printing the first as a warning and all others @@ -158,8 +158,8 @@ } if (!BT_Suspicious) - BT_Suspicious.reset( - new BugType(this, "Suspicious code clone", "Code clone")); + BT_Suspicious = llvm::make_unique( + this, "Suspicious code clone", "Code clone"); ASTContext &ACtx = BR.getContext(); SourceManager &SM = ACtx.getSourceManager(); Index: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/ConversionChecker.cpp +++ lib/StaticAnalyzer/Checkers/ConversionChecker.cpp @@ -115,8 +115,8 @@ void ConversionChecker::reportBug(ExplodedNode *N, CheckerContext &C, const char Msg[]) const { if (!BT) - BT.reset( - new BuiltinBug(this, "Conversion", "Possible loss of sign/precision.")); + BT = llvm::make_unique( + this, "Conversion", "Possible loss of sign/precision."); // Generate a report for this bug. auto R = llvm::make_unique(*BT, Msg, N); Index: lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp +++ lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp @@ -150,7 +150,7 @@ // Lazily construct the set that records which VarDecls are in // EH code. if (!InEH.get()) { - InEH.reset(new llvm::DenseSet()); + InEH = llvm::make_unique>(); EHCodeVisitor V(*InEH.get()); V.TraverseStmt(AC->getBody()); } @@ -169,7 +169,7 @@ // Compute reachable blocks within the CFG for trivial cases // where a bogus dead store can be reported because itself is unreachable. if (!reachableCode.get()) { - reachableCode.reset(new ReachableCode(cfg)); + reachableCode = llvm::make_unique(cfg); reachableCode->computeReachableBlocks(); } Index: lib/StaticAnalyzer/Checkers/DebugCheckers.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/DebugCheckers.cpp +++ lib/StaticAnalyzer/Checkers/DebugCheckers.cpp @@ -224,7 +224,7 @@ void checkPostStmt(const Stmt *S, CheckerContext &C) const { if (!BT) - BT.reset(new BugType(this, "Dump hash components", "debug")); + BT = llvm::make_unique(this, "Dump hash components", "debug"); ExplodedNode *N = C.generateNonFatalErrorNode(); if (!N) Index: lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp +++ lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp @@ -121,7 +121,7 @@ // We know that 'location' cannot be non-null. This is what // we call an "explicit" null dereference. if (!BT_null) - BT_null.reset(new BuiltinBug(this, "Dereference of null pointer")); + BT_null = llvm::make_unique(this, "Dereference of null pointer"); SmallString<100> buf; llvm::raw_svector_ostream os(buf); @@ -192,8 +192,8 @@ if (l.isUndef()) { if (ExplodedNode *N = C.generateErrorNode()) { if (!BT_undef) - BT_undef.reset( - new BuiltinBug(this, "Dereference of undefined pointer value")); + BT_undef = llvm::make_unique( + this, "Dereference of undefined pointer value"); auto report = llvm::make_unique(*BT_undef, BT_undef->getDescription(), N); Index: lib/StaticAnalyzer/Checkers/DivZeroChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/DivZeroChecker.cpp +++ lib/StaticAnalyzer/Checkers/DivZeroChecker.cpp @@ -37,7 +37,7 @@ CheckerContext &C) const { if (ExplodedNode *N = C.generateErrorNode(StateZero)) { if (!BT) - BT.reset(new BuiltinBug(this, "Division by zero")); + BT = llvm::make_unique(this, "Division by zero"); auto R = llvm::make_unique(*BT, Msg, N); bugreporter::trackNullOrUndefValue(N, bugreporter::GetDenomExpr(N), *R); Index: lib/StaticAnalyzer/Checkers/DynamicTypeChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/DynamicTypeChecker.cpp +++ lib/StaticAnalyzer/Checkers/DynamicTypeChecker.cpp @@ -34,8 +34,8 @@ mutable std::unique_ptr BT; void initBugType() const { if (!BT) - BT.reset( - new BugType(this, "Dynamic and static type mismatch", "Type Error")); + BT = llvm::make_unique( + this, "Dynamic and static type mismatch", "Type Error"); } class DynamicTypeBugVisitor Index: lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp +++ lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp @@ -69,8 +69,8 @@ mutable std::unique_ptr ObjCGenericsBugType; void initBugType() const { if (!ObjCGenericsBugType) - ObjCGenericsBugType.reset( - new BugType(this, "Generics", categories::CoreFoundationObjectiveC)); + ObjCGenericsBugType = llvm::make_unique( + this, "Generics", categories::CoreFoundationObjectiveC); } class GenericsBugVisitor : public BugReporterVisitorImpl { Index: lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp +++ lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp @@ -134,7 +134,7 @@ return nullptr; if (!BT) - BT.reset(new BugType(this, "Checking analyzer assumptions", "debug")); + BT = llvm::make_unique(this, "Checking analyzer assumptions", "debug"); BR.emitReport(llvm::make_unique(*BT, Msg, N)); return N; Index: lib/StaticAnalyzer/Checkers/FixedAddressChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/FixedAddressChecker.cpp +++ lib/StaticAnalyzer/Checkers/FixedAddressChecker.cpp @@ -52,11 +52,11 @@ if (ExplodedNode *N = C.generateNonFatalErrorNode()) { if (!BT) - BT.reset( - new BuiltinBug(this, "Use fixed address", + BT = llvm::make_unique( + this, "Use fixed address", "Using a fixed address is not portable because that " "address will probably not be valid in all " - "environments or platforms.")); + "environments or platforms."); auto R = llvm::make_unique(*BT, BT->getDescription(), N); R->addRange(B->getRHS()->getSourceRange()); C.emitReport(std::move(R)); Index: lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp +++ lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp @@ -45,7 +45,7 @@ mutable std::unique_ptr BT; inline void initBugType() const { if (!BT) - BT.reset(new BugType(this, "Use of Untrusted Data", "Untrusted Data")); + BT = llvm::make_unique(this, "Use of Untrusted Data", "Untrusted Data"); } /// \brief Catch taint related bugs. Check if tainted data is passed to a Index: lib/StaticAnalyzer/Checkers/IteratorChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/IteratorChecker.cpp +++ lib/StaticAnalyzer/Checkers/IteratorChecker.cpp @@ -258,8 +258,8 @@ } // namespace IteratorChecker::IteratorChecker() { - OutOfRangeBugType.reset( - new BugType(this, "Iterator out of range", "Misuse of STL APIs")); + OutOfRangeBugType = llvm::make_unique( + this, "Iterator out of range", "Misuse of STL APIs"); OutOfRangeBugType->setSuppressOnSink(true); } Index: lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp +++ lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp @@ -106,8 +106,8 @@ LocalizedState) NonLocalizedStringChecker::NonLocalizedStringChecker() { - BT.reset(new BugType(this, "Unlocalizable string", - "Localizability Issue (Apple)")); + BT = llvm::make_unique(this, "Unlocalizable string", + "Localizability Issue (Apple)"); } namespace { Index: lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp +++ lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp @@ -96,8 +96,8 @@ inline void initBugType() const { if (!BT) - BT.reset(new BugType(this, "Improper use of SecKeychain API", - "API Misuse (Apple)")); + BT = llvm::make_unique(this, "Improper use of SecKeychain API", + "API Misuse (Apple)"); } void generateDeallocatorMismatchReport(const AllocationPair &AP, Index: lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp +++ lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp @@ -137,8 +137,8 @@ return; if (!BT_dispatchOnce) - BT_dispatchOnce.reset(new BugType(this, "Improper use of 'dispatch_once'", - "API Misuse (Apple)")); + BT_dispatchOnce = llvm::make_unique(this, "Improper use of 'dispatch_once'", + "API Misuse (Apple)"); auto report = llvm::make_unique(*BT_dispatchOnce, os.str(), N); report->addRange(CE->getArg(0)->getSourceRange()); Index: lib/StaticAnalyzer/Checkers/MallocChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/MallocChecker.cpp +++ lib/StaticAnalyzer/Checkers/MallocChecker.cpp @@ -1754,8 +1754,8 @@ if (ExplodedNode *N = C.generateErrorNode()) { if (!BT_BadFree[*CheckKind]) - BT_BadFree[*CheckKind].reset(new BugType( - CheckNames[*CheckKind], "Bad free", categories::MemoryError)); + BT_BadFree[*CheckKind] = llvm::make_unique( + CheckNames[*CheckKind], "Bad free", categories::MemoryError); SmallString<100> buf; llvm::raw_svector_ostream os(buf); @@ -1799,8 +1799,8 @@ if (ExplodedNode *N = C.generateErrorNode()) { if (!BT_FreeAlloca[*CheckKind]) - BT_FreeAlloca[*CheckKind].reset(new BugType( - CheckNames[*CheckKind], "Free alloca()", categories::MemoryError)); + BT_FreeAlloca[*CheckKind] = llvm::make_unique( + CheckNames[*CheckKind], "Free alloca()", categories::MemoryError); auto R = llvm::make_unique( *BT_FreeAlloca[*CheckKind], @@ -1823,9 +1823,9 @@ if (ExplodedNode *N = C.generateErrorNode()) { if (!BT_MismatchedDealloc) - BT_MismatchedDealloc.reset( - new BugType(CheckNames[CK_MismatchedDeallocatorChecker], - "Bad deallocator", categories::MemoryError)); + BT_MismatchedDealloc = llvm::make_unique( + CheckNames[CK_MismatchedDeallocatorChecker], + "Bad deallocator", categories::MemoryError); SmallString<100> buf; llvm::raw_svector_ostream os(buf); @@ -1885,8 +1885,8 @@ return; if (!BT_OffsetFree[*CheckKind]) - BT_OffsetFree[*CheckKind].reset(new BugType( - CheckNames[*CheckKind], "Offset free", categories::MemoryError)); + BT_OffsetFree[*CheckKind] = llvm::make_unique( + CheckNames[*CheckKind], "Offset free", categories::MemoryError); SmallString<100> buf; llvm::raw_svector_ostream os(buf); @@ -1936,8 +1936,8 @@ if (ExplodedNode *N = C.generateErrorNode()) { if (!BT_UseFree[*CheckKind]) - BT_UseFree[*CheckKind].reset(new BugType( - CheckNames[*CheckKind], "Use-after-free", categories::MemoryError)); + BT_UseFree[*CheckKind] = llvm::make_unique( + CheckNames[*CheckKind], "Use-after-free", categories::MemoryError); auto R = llvm::make_unique(*BT_UseFree[*CheckKind], "Use of memory after it is freed", N); @@ -1963,8 +1963,8 @@ if (ExplodedNode *N = C.generateErrorNode()) { if (!BT_DoubleFree[*CheckKind]) - BT_DoubleFree[*CheckKind].reset(new BugType( - CheckNames[*CheckKind], "Double free", categories::MemoryError)); + BT_DoubleFree[*CheckKind] = llvm::make_unique( + CheckNames[*CheckKind], "Double free", categories::MemoryError); auto R = llvm::make_unique( *BT_DoubleFree[*CheckKind], @@ -1991,9 +1991,9 @@ if (ExplodedNode *N = C.generateErrorNode()) { if (!BT_DoubleDelete) - BT_DoubleDelete.reset(new BugType(CheckNames[CK_NewDeleteChecker], + BT_DoubleDelete = llvm::make_unique(CheckNames[CK_NewDeleteChecker], "Double delete", - categories::MemoryError)); + categories::MemoryError); auto R = llvm::make_unique( *BT_DoubleDelete, "Attempt to delete released memory", N); @@ -2019,9 +2019,9 @@ if (ExplodedNode *N = C.generateErrorNode()) { if (!BT_UseZerroAllocated[*CheckKind]) - BT_UseZerroAllocated[*CheckKind].reset( - new BugType(CheckNames[*CheckKind], "Use of zero allocated", - categories::MemoryError)); + BT_UseZerroAllocated[*CheckKind] = llvm::make_unique( + CheckNames[*CheckKind], "Use of zero allocated", + categories::MemoryError); auto R = llvm::make_unique(*BT_UseZerroAllocated[*CheckKind], "Use of zero-allocated memory", N); @@ -2047,8 +2047,8 @@ if (ExplodedNode *N = C.generateErrorNode()) { if (!BT_BadFree[*CheckKind]) - BT_BadFree[*CheckKind].reset( - new BugType(CheckNames[*CheckKind], "Bad free", "Memory Error")); + BT_BadFree[*CheckKind] = llvm::make_unique( + CheckNames[*CheckKind], "Bad free", "Memory Error"); SmallString<100> Buf; llvm::raw_svector_ostream Os(Buf); @@ -2256,8 +2256,8 @@ assert(N); if (!BT_Leak[*CheckKind]) { - BT_Leak[*CheckKind].reset(new BugType(CheckNames[*CheckKind], "Memory leak", - categories::MemoryError)); + BT_Leak[*CheckKind] = llvm::make_unique(CheckNames[*CheckKind], "Memory leak", + categories::MemoryError); // Leaks should not be reported if they are post-dominated by a sink: // (1) Sinks are higher importance bugs. // (2) NoReturnFunctionChecker uses sink nodes to represent paths ending Index: lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp +++ lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp @@ -180,8 +180,8 @@ bool isCopy = false) const { if (ExplodedNode *N = C.generateNonFatalErrorNode()) { if (!BT) - BT.reset(new BugType(this, "Usage of a 'moved-from' object", - "C++ move semantics")); + BT = llvm::make_unique(this, "Usage of a 'moved-from' object", + "C++ move semantics"); // Uniqueing report to the same object. PathDiagnosticLocation LocUsedForUniqueing; Index: lib/StaticAnalyzer/Checkers/NSAutoreleasePoolChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/NSAutoreleasePoolChecker.cpp +++ lib/StaticAnalyzer/Checkers/NSAutoreleasePoolChecker.cpp @@ -59,8 +59,8 @@ return; if (!BT) - BT.reset(new BugType(this, "Use -drain instead of -release", - "API Upgrade (Apple)")); + BT = llvm::make_unique(this, "Use -drain instead of -release", + "API Upgrade (Apple)"); ExplodedNode *N = C.generateNonFatalErrorNode(); if (!N) { Index: lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp +++ lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp @@ -267,12 +267,12 @@ BugType *bug = nullptr; if (isNSError) { if (!NSBT) - NSBT.reset(new NSErrorDerefBug(this)); + NSBT = llvm::make_unique(this); bug = NSBT.get(); } else { if (!CFBT) - CFBT.reset(new CFErrorDerefBug(this)); + CFBT = llvm::make_unique(this); bug = CFBT.get(); } BR.emitReport(llvm::make_unique(*bug, os.str(), event.SinkNode)); Index: lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp +++ lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp @@ -187,8 +187,8 @@ // created. Ownership is transferred to the BugReporter object once // the BugReport is passed to 'EmitWarning'. if (!BTAttrNonNull) - BTAttrNonNull.reset(new BugType( - this, "Argument with 'nonnull' attribute passed null", "API")); + BTAttrNonNull = llvm::make_unique( + this, "Argument with 'nonnull' attribute passed null", "API"); auto R = llvm::make_unique( *BTAttrNonNull, @@ -202,7 +202,7 @@ std::unique_ptr NonNullParamChecker::genReportReferenceToNullPointer( const ExplodedNode *ErrorNode, const Expr *ArgE) const { if (!BTNullRefArg) - BTNullRefArg.reset(new BuiltinBug(this, "Dereference of null pointer")); + BTNullRefArg = llvm::make_unique(this, "Dereference of null pointer"); auto R = llvm::make_unique( *BTNullRefArg, "Forming reference to null pointer", ErrorNode); Index: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp +++ lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp @@ -178,7 +178,7 @@ const MemRegion *Region, BugReporter &BR, const Stmt *ValueExpr = nullptr) const { if (!BT) - BT.reset(new BugType(this, "Nullability", categories::MemoryError)); + BT = llvm::make_unique(this, "Nullability", categories::MemoryError); auto R = llvm::make_unique(*BT, Msg, N); if (Region) { Index: lib/StaticAnalyzer/Checkers/ObjCAtSyncChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/ObjCAtSyncChecker.cpp +++ lib/StaticAnalyzer/Checkers/ObjCAtSyncChecker.cpp @@ -45,8 +45,8 @@ if (V.getAs()) { if (ExplodedNode *N = C.generateErrorNode()) { if (!BT_undef) - BT_undef.reset(new BuiltinBug(this, "Uninitialized value used as mutex " - "for @synchronized")); + BT_undef = llvm::make_unique(this, "Uninitialized value used as mutex " + "for @synchronized"); auto report = llvm::make_unique(*BT_undef, BT_undef->getDescription(), N); bugreporter::trackNullOrUndefValue(N, Ex, *report); @@ -68,9 +68,9 @@ // a null mutex just means no synchronization occurs. if (ExplodedNode *N = C.generateNonFatalErrorNode(nullState)) { if (!BT_null) - BT_null.reset(new BuiltinBug( + BT_null = llvm::make_unique( this, "Nil value used as mutex for @synchronized() " - "(no synchronization will occur)")); + "(no synchronization will occur)"); auto report = llvm::make_unique(*BT_null, BT_null->getDescription(), N); bugreporter::trackNullOrUndefValue(N, Ex, *report); Index: lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp +++ lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp @@ -34,8 +34,8 @@ mutable std::unique_ptr BT; inline void initBugType() const { if (!BT) - BT.reset(new BugType(this, "CFArray API", - categories::CoreFoundationObjectiveC)); + BT = llvm::make_unique(this, "CFArray API", + categories::CoreFoundationObjectiveC); } inline SymbolRef getArraySym(const Expr *E, CheckerContext &C) const { Index: lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp +++ lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp @@ -158,8 +158,8 @@ return; if (!BT) - BT.reset(new BugType(this, "Missing \"self = [(super or self) init...]\"", - categories::CoreFoundationObjectiveC)); + BT = llvm::make_unique(this, "Missing \"self = [(super or self) init...]\"", + categories::CoreFoundationObjectiveC); C.emitReport(llvm::make_unique(*BT, errorStr, N)); } Index: lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp +++ lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp @@ -222,9 +222,9 @@ ObjCSuperDeallocChecker::ObjCSuperDeallocChecker() : IIdealloc(nullptr), IINSObject(nullptr) { - DoubleSuperDeallocBugType.reset( - new BugType(this, "[super dealloc] should not be called more than once", - categories::CoreFoundationObjectiveC)); + DoubleSuperDeallocBugType = llvm::make_unique( + this, "[super dealloc] should not be called more than once", + categories::CoreFoundationObjectiveC); } void Index: lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp +++ lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp @@ -171,10 +171,10 @@ return; if (ExplodedNode *N = C.generateNonFatalErrorNode()) { if (!BT_polyArray) - BT_polyArray.reset(new BuiltinBug( + BT_polyArray = llvm::make_unique( this, "Dangerous pointer arithmetic", "Pointer arithmetic on a pointer to base class is dangerous " - "because derived and base class may have different size.")); + "because derived and base class may have different size."); auto R = llvm::make_unique(*BT_polyArray, BT_polyArray->getDescription(), N); R->addRange(E->getSourceRange()); @@ -194,10 +194,10 @@ if (ExplodedNode *N = C.generateNonFatalErrorNode()) { if (!BT_pointerArith) - BT_pointerArith.reset(new BuiltinBug(this, "Dangerous pointer arithmetic", + BT_pointerArith = llvm::make_unique(this, "Dangerous pointer arithmetic", "Pointer arithmetic on non-array " "variables relies on memory layout, " - "which is dangerous.")); + "which is dangerous."); auto R = llvm::make_unique(*BT_pointerArith, BT_pointerArith->getDescription(), N); R->addRange(SR); Index: lib/StaticAnalyzer/Checkers/PointerSubChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/PointerSubChecker.cpp +++ lib/StaticAnalyzer/Checkers/PointerSubChecker.cpp @@ -62,10 +62,10 @@ if (ExplodedNode *N = C.generateNonFatalErrorNode()) { if (!BT) - BT.reset( - new BuiltinBug(this, "Pointer subtraction", + BT = llvm::make_unique( + this, "Pointer subtraction", "Subtraction of two pointers that do not point to " - "the same memory chunk may cause incorrect result.")); + "the same memory chunk may cause incorrect result."); auto R = llvm::make_unique(*BT, BT->getDescription(), N); R->addRange(B->getSourceRange()); C.emitReport(std::move(R)); Index: lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp +++ lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp @@ -206,8 +206,8 @@ if (const LockState *LState = state->get(lockR)) { if (LState->isLocked()) { if (!BT_doublelock) - BT_doublelock.reset(new BugType(this, "Double locking", - "Lock checker")); + BT_doublelock = llvm::make_unique(this, "Double locking", + "Lock checker"); ExplodedNode *N = C.generateErrorNode(); if (!N) return; @@ -271,8 +271,8 @@ if (const LockState *LState = state->get(lockR)) { if (LState->isUnlocked()) { if (!BT_doubleunlock) - BT_doubleunlock.reset(new BugType(this, "Double unlocking", - "Lock checker")); + BT_doubleunlock = llvm::make_unique(this, "Double unlocking", + "Lock checker"); ExplodedNode *N = C.generateErrorNode(); if (!N) return; @@ -295,7 +295,7 @@ const MemRegion *firstLockR = LS.getHead(); if (firstLockR != lockR) { if (!BT_lor) - BT_lor.reset(new BugType(this, "Lock order reversal", "Lock checker")); + BT_lor = llvm::make_unique(this, "Lock order reversal", "Lock checker"); ExplodedNode *N = C.generateErrorNode(); if (!N) return; @@ -365,8 +365,8 @@ } if (!BT_destroylock) - BT_destroylock.reset(new BugType(this, "Destroy invalid lock", - "Lock checker")); + BT_destroylock = llvm::make_unique(this, "Destroy invalid lock", + "Lock checker"); ExplodedNode *N = C.generateErrorNode(); if (!N) return; @@ -404,8 +404,8 @@ } if (!BT_initlock) - BT_initlock.reset(new BugType(this, "Init invalid lock", - "Lock checker")); + BT_initlock = llvm::make_unique(this, "Init invalid lock", + "Lock checker"); ExplodedNode *N = C.generateErrorNode(); if (!N) return; @@ -417,8 +417,8 @@ void PthreadLockChecker::reportUseDestroyedBug(CheckerContext &C, const CallExpr *CE) const { if (!BT_destroylock) - BT_destroylock.reset(new BugType(this, "Use destroyed lock", - "Lock checker")); + BT_destroylock = llvm::make_unique(this, "Use destroyed lock", + "Lock checker"); ExplodedNode *N = C.generateErrorNode(); if (!N) return; Index: lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp +++ lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp @@ -2560,18 +2560,18 @@ bool GCEnabled) const { if (GCEnabled) { if (!leakWithinFunctionGC) - leakWithinFunctionGC.reset(new Leak(this, "Leak of object when using " - "garbage collection")); + leakWithinFunctionGC = llvm::make_unique(this, "Leak of object when using " + "garbage collection"); return leakWithinFunctionGC.get(); } else { if (!leakWithinFunction) { if (LOpts.getGC() == LangOptions::HybridGC) { - leakWithinFunction.reset(new Leak(this, + leakWithinFunction = llvm::make_unique(this, "Leak of object when not using " "garbage collection (GC) in " - "dual GC/non-GC code")); + "dual GC/non-GC code"); } else { - leakWithinFunction.reset(new Leak(this, "Leak")); + leakWithinFunction = llvm::make_unique(this, "Leak"); } } return leakWithinFunction.get(); @@ -2581,19 +2581,19 @@ CFRefBug *getLeakAtReturnBug(const LangOptions &LOpts, bool GCEnabled) const { if (GCEnabled) { if (!leakAtReturnGC) - leakAtReturnGC.reset(new Leak(this, + leakAtReturnGC = llvm::make_unique(this, "Leak of returned object when using " - "garbage collection")); + "garbage collection"); return leakAtReturnGC.get(); } else { if (!leakAtReturn) { if (LOpts.getGC() == LangOptions::HybridGC) { - leakAtReturn.reset(new Leak(this, + leakAtReturn = llvm::make_unique(this, "Leak of returned object when not using " "garbage collection (GC) in dual " - "GC/non-GC code")); + "GC/non-GC code"); } else { - leakAtReturn.reset(new Leak(this, "Leak of returned object")); + leakAtReturn = llvm::make_unique(this, "Leak of returned object"); } } return leakAtReturn.get(); @@ -2607,13 +2607,13 @@ bool ARCEnabled = (bool)Ctx.getLangOpts().ObjCAutoRefCount; if (GCEnabled) { if (!SummariesGC) - SummariesGC.reset(new RetainSummaryManager(Ctx, true, ARCEnabled)); + SummariesGC = llvm::make_unique(Ctx, true, ARCEnabled); else assert(SummariesGC->isARCEnabled() == ARCEnabled); return *SummariesGC; } else { if (!Summaries) - Summaries.reset(new RetainSummaryManager(Ctx, false, ARCEnabled)); + Summaries = llvm::make_unique(Ctx, false, ARCEnabled); else assert(Summaries->isARCEnabled() == ARCEnabled); return *Summaries; @@ -3324,22 +3324,22 @@ llvm_unreachable("Unhandled error."); case RefVal::ErrorUseAfterRelease: if (!useAfterRelease) - useAfterRelease.reset(new UseAfterRelease(this)); + useAfterRelease = llvm::make_unique(this); BT = useAfterRelease.get(); break; case RefVal::ErrorReleaseNotOwned: if (!releaseNotOwned) - releaseNotOwned.reset(new BadRelease(this)); + releaseNotOwned = llvm::make_unique(this); BT = releaseNotOwned.get(); break; case RefVal::ErrorDeallocGC: if (!deallocGC) - deallocGC.reset(new DeallocGC(this)); + deallocGC = llvm::make_unique(this); BT = deallocGC.get(); break; case RefVal::ErrorDeallocNotOwned: if (!deallocNotOwned) - deallocNotOwned.reset(new DeallocNotOwned(this)); + deallocNotOwned = llvm::make_unique(this); BT = deallocNotOwned.get(); break; } @@ -3604,7 +3604,7 @@ ExplodedNode *N = C.addTransition(state, Pred, &ReturnNotOwnedTag); if (N) { if (!returnNotOwnedForOwned) - returnNotOwnedForOwned.reset(new ReturnedNotOwnedForOwned(this)); + returnNotOwnedForOwned = llvm::make_unique(this); C.emitReport(std::unique_ptr(new CFRefReport( *returnNotOwnedForOwned, C.getASTContext().getLangOpts(), @@ -3808,7 +3808,7 @@ os << "has a +" << V.getCount() << " retain count"; if (!overAutorelease) - overAutorelease.reset(new OverAutorelease(this)); + overAutorelease = llvm::make_unique(this); const LangOptions &LOpts = Ctx.getASTContext().getLangOpts(); Ctx.emitReport(std::unique_ptr( Index: lib/StaticAnalyzer/Checkers/ReturnPointerRangeChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/ReturnPointerRangeChecker.cpp +++ lib/StaticAnalyzer/Checkers/ReturnPointerRangeChecker.cpp @@ -70,10 +70,10 @@ // FIXME: This bug correspond to CWE-466. Eventually we should have bug // types explicitly reference such exploit categories (when applicable). if (!BT) - BT.reset(new BuiltinBug( + BT = llvm::make_unique( this, "Return of pointer value outside of expected range", "Returned pointer value points outside the original object " - "(potential buffer overflow)")); + "(potential buffer overflow)"); // FIXME: It would be nice to eventually make this diagnostic more clear, // e.g., by referencing the original declaration or by saying *why* this Index: lib/StaticAnalyzer/Checkers/ReturnUndefChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/ReturnUndefChecker.cpp +++ lib/StaticAnalyzer/Checkers/ReturnUndefChecker.cpp @@ -94,9 +94,9 @@ void ReturnUndefChecker::emitUndef(CheckerContext &C, const Expr *RetE) const { if (!BT_Undef) - BT_Undef.reset( - new BuiltinBug(this, "Garbage return value", - "Undefined or garbage value returned to caller")); + BT_Undef = llvm::make_unique( + this, "Garbage return value", + "Undefined or garbage value returned to caller"); emitBug(C, *BT_Undef, RetE); } @@ -113,7 +113,7 @@ // The return value is known to be null. Emit a bug report. if (!BT_NullReference) - BT_NullReference.reset(new BuiltinBug(this, "Returning null reference")); + BT_NullReference = llvm::make_unique(this, "Returning null reference"); emitBug(C, *BT_NullReference, RetE, bugreporter::getDerefExpr(RetE)); } Index: lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp +++ lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp @@ -106,11 +106,11 @@ SimpleStreamChecker::SimpleStreamChecker() : OpenFn("fopen"), CloseFn("fclose", 1) { // Initialize the bug types. - DoubleCloseBugType.reset( - new BugType(this, "Double fclose", "Unix Stream API Error")); + DoubleCloseBugType = llvm::make_unique( + this, "Double fclose", "Unix Stream API Error"); - LeakBugType.reset( - new BugType(this, "Resource Leak", "Unix Stream API Error")); + LeakBugType = llvm::make_unique( + this, "Resource Leak", "Unix Stream API Error"); // Sinks are higher importance bugs as well as calls to assert() or exit(0). LeakBugType->setSuppressOnSink(true); } Index: lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp +++ lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp @@ -100,8 +100,8 @@ return; if (!BT_returnstack) - BT_returnstack.reset( - new BuiltinBug(this, "Return of address to stack-allocated memory")); + BT_returnstack = llvm::make_unique( + this, "Return of address to stack-allocated memory"); // Generate a report for this bug. SmallString<512> buf; @@ -225,11 +225,11 @@ return; if (!BT_stackleak) - BT_stackleak.reset( - new BuiltinBug(this, "Stack address stored into global variable", + BT_stackleak = llvm::make_unique( + this, "Stack address stored into global variable", "Stack address was saved into a global variable. " "This is dangerous because the address will become " - "invalid after returning from the function")); + "invalid after returning from the function"); for (unsigned i = 0, e = cb.V.size(); i != e; ++i) { // Generate a report for this bug. Index: lib/StaticAnalyzer/Checkers/StreamChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/StreamChecker.cpp +++ lib/StaticAnalyzer/Checkers/StreamChecker.cpp @@ -272,10 +272,10 @@ if (ExplodedNode *N = C.generateNonFatalErrorNode(state)) { if (!BT_illegalwhence) - BT_illegalwhence.reset( - new BuiltinBug(this, "Illegal whence argument", + BT_illegalwhence = llvm::make_unique( + this, "Illegal whence argument", "The whence argument to fseek() should be " - "SEEK_SET, SEEK_END, or SEEK_CUR.")); + "SEEK_SET, SEEK_END, or SEEK_CUR."); C.emitReport(llvm::make_unique( *BT_illegalwhence, BT_illegalwhence->getDescription(), N)); } @@ -350,8 +350,8 @@ if (!stateNotNull && stateNull) { if (ExplodedNode *N = C.generateErrorNode(stateNull)) { if (!BT_nullfp) - BT_nullfp.reset(new BuiltinBug(this, "NULL stream pointer", - "Stream pointer might be NULL.")); + BT_nullfp = llvm::make_unique(this, "NULL stream pointer", + "Stream pointer might be NULL."); C.emitReport(llvm::make_unique( *BT_nullfp, BT_nullfp->getDescription(), N)); } @@ -380,9 +380,9 @@ ExplodedNode *N = C.generateErrorNode(); if (N) { if (!BT_doubleclose) - BT_doubleclose.reset(new BuiltinBug( + BT_doubleclose = llvm::make_unique( this, "Double fclose", "Try to close a file Descriptor already" - " closed. Cause undefined behaviour.")); + " closed. Cause undefined behaviour."); C.emitReport(llvm::make_unique( *BT_doubleclose, BT_doubleclose->getDescription(), N)); } @@ -408,9 +408,9 @@ ExplodedNode *N = C.generateErrorNode(); if (N) { if (!BT_ResourceLeak) - BT_ResourceLeak.reset(new BuiltinBug( + BT_ResourceLeak = llvm::make_unique( this, "Resource Leak", - "Opened File never closed. Potential Resource leak.")); + "Opened File never closed. Potential Resource leak."); C.emitReport(llvm::make_unique( *BT_ResourceLeak, BT_ResourceLeak->getDescription(), N)); } Index: lib/StaticAnalyzer/Checkers/TaintTesterChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/TaintTesterChecker.cpp +++ lib/StaticAnalyzer/Checkers/TaintTesterChecker.cpp @@ -38,7 +38,7 @@ inline void TaintTesterChecker::initBugType() const { if (!BT) - BT.reset(new BugType(this, "Tainted data", "General")); + BT = llvm::make_unique(this, "Tainted data", "General"); } void TaintTesterChecker::checkPostStmt(const Expr *E, Index: lib/StaticAnalyzer/Checkers/TestAfterDivZeroChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/TestAfterDivZeroChecker.cpp +++ lib/StaticAnalyzer/Checkers/TestAfterDivZeroChecker.cpp @@ -168,7 +168,7 @@ void TestAfterDivZeroChecker::reportBug(SVal Val, CheckerContext &C) const { if (ExplodedNode *N = C.generateErrorNode(C.getState())) { if (!DivZeroBug) - DivZeroBug.reset(new BuiltinBug(this, "Division by zero")); + DivZeroBug = llvm::make_unique(this, "Division by zero"); auto R = llvm::make_unique( *DivZeroBug, "Value being compared against zero has already been used " Index: lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp +++ lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp @@ -66,8 +66,8 @@ ExplodedNode *N = Ctx.generateErrorNode(); if (N) { if (!BT) - BT.reset(new BuiltinBug( - this, "Branch condition evaluates to a garbage value")); + BT = llvm::make_unique( + this, "Branch condition evaluates to a garbage value"); // What's going on here: we want to highlight the subexpression of the // condition that is the most likely source of the "uninitialized Index: lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp +++ lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp @@ -76,8 +76,8 @@ state->getSVal(I.getOriginalRegion()).getAs()) { if (ExplodedNode *N = C.generateErrorNode()) { if (!BT) - BT.reset( - new BuiltinBug(this, "uninitialized variable captured by block")); + BT = llvm::make_unique( + this, "uninitialized variable captured by block"); // Generate a bug report. SmallString<128> buf; Index: lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp +++ lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp @@ -79,8 +79,8 @@ return; if (!BT) - BT.reset( - new BuiltinBug(this, "Result of operation is garbage or undefined")); + BT = llvm::make_unique( + this, "Result of operation is garbage or undefined"); SmallString<256> sbuf; llvm::raw_svector_ostream OS(sbuf); Index: lib/StaticAnalyzer/Checkers/UndefinedArraySubscriptChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/UndefinedArraySubscriptChecker.cpp +++ lib/StaticAnalyzer/Checkers/UndefinedArraySubscriptChecker.cpp @@ -50,7 +50,7 @@ if (!N) return; if (!BT) - BT.reset(new BuiltinBug(this, "Array subscript is undefined")); + BT = llvm::make_unique(this, "Array subscript is undefined"); // Generate a report for this bug. auto R = llvm::make_unique(*BT, BT->getName(), N); Index: lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp +++ lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp @@ -54,7 +54,7 @@ const char *str = "Assigned value is garbage or undefined"; if (!BT) - BT.reset(new BuiltinBug(this, str)); + BT = llvm::make_unique(this, str); // Generate a report for this bug. const Expr *ex = nullptr; Index: lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp +++ lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp @@ -78,7 +78,7 @@ void LazyInitialize(std::unique_ptr &BT, const char *name) const { if (BT) return; - BT.reset(new BugType(this, name, categories::UnixAPI)); + BT = llvm::make_unique(this, name, categories::UnixAPI); } void ReportOpenBug(CheckerContext &C, ProgramStateRef State, Index: lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp +++ lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp @@ -51,8 +51,8 @@ return; if (!BT) - BT.reset(new BuiltinBug( - this, "Dangerous variable-length array (VLA) declaration")); + BT = llvm::make_unique( + this, "Dangerous variable-length array (VLA) declaration"); SmallString<256> buf; llvm::raw_svector_ostream os(buf); Index: lib/StaticAnalyzer/Checkers/ValistChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/ValistChecker.cpp +++ lib/StaticAnalyzer/Checkers/ValistChecker.cpp @@ -254,9 +254,9 @@ return; if (ExplodedNode *N = C.generateErrorNode()) { if (!BT_uninitaccess) - BT_uninitaccess.reset(new BugType(CheckNames[CK_Uninitialized], + BT_uninitaccess = llvm::make_unique(CheckNames[CK_Uninitialized], "Uninitialized va_list", - categories::MemoryError)); + categories::MemoryError); auto R = llvm::make_unique(*BT_uninitaccess, Msg, N); R->markInteresting(VAList); R->addVisitor(llvm::make_unique(VAList)); @@ -273,9 +273,9 @@ return; for (auto Reg : LeakedVALists) { if (!BT_leakedvalist) { - BT_leakedvalist.reset(new BugType(CheckNames[CK_Unterminated], + BT_leakedvalist = llvm::make_unique(CheckNames[CK_Unterminated], "Leaked va_list", - categories::MemoryError)); + categories::MemoryError); BT_leakedvalist->setSuppressOnSink(true); } Index: lib/StaticAnalyzer/Checkers/VforkChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/VforkChecker.cpp +++ lib/StaticAnalyzer/Checkers/VforkChecker.cpp @@ -122,8 +122,8 @@ const char *Details) const { if (ExplodedNode *N = C.generateErrorNode(C.getState())) { if (!BT) - BT.reset(new BuiltinBug(this, - "Dangerous construct in a vforked process")); + BT = llvm::make_unique(this, + "Dangerous construct in a vforked process"); SmallString<256> buf; llvm::raw_svector_ostream os(buf); Index: lib/Tooling/CommonOptionsParser.cpp =================================================================== --- lib/Tooling/CommonOptionsParser.cpp +++ lib/Tooling/CommonOptionsParser.cpp @@ -139,8 +139,8 @@ if (!Compilations) { llvm::errs() << "Error while trying to load a compilation database:\n" << ErrorMessage << "Running without flags.\n"; - Compilations.reset( - new FixedCompilationDatabase(".", std::vector())); + Compilations = llvm::make_unique( + ".", std::vector()); } } auto AdjustingCompilations = Index: lib/Tooling/CompilationDatabase.cpp =================================================================== --- lib/Tooling/CompilationDatabase.cpp +++ lib/Tooling/CompilationDatabase.cpp @@ -300,8 +300,8 @@ std::vector StrippedArgs; if (!stripPositionalArgs(CommandLine, StrippedArgs, ErrorMsg)) return nullptr; - return std::unique_ptr( - new FixedCompilationDatabase(Directory, StrippedArgs)); + return llvm::make_unique( + Directory, StrippedArgs); } FixedCompilationDatabase:: Index: tools/arcmt-test/arcmt-test.cpp =================================================================== --- tools/arcmt-test/arcmt-test.cpp +++ tools/arcmt-test/arcmt-test.cpp @@ -183,7 +183,7 @@ std::unique_ptr transformPrinter; if (OutputTransformations) - transformPrinter.reset(new PrintTransforms(llvm::outs())); + transformPrinter = llvm::make_unique(llvm::outs()); for (unsigned i=0, e = transforms.size(); i != e; ++i) { bool err = migration.applyTransform(transforms[i], transformPrinter.get()); Index: tools/c-index-test/core_main.cpp =================================================================== --- tools/c-index-test/core_main.cpp +++ tools/c-index-test/core_main.cpp @@ -83,7 +83,7 @@ } void initialize(ASTContext &Ctx) override { - CGNameGen.reset(new CodegenNameGenerator(Ctx)); + CGNameGen = llvm::make_unique(Ctx); } bool handleDeclOccurence(const Decl *D, SymbolRoleSet Roles, Index: tools/clang-check/ClangCheck.cpp =================================================================== --- tools/clang-check/ClangCheck.cpp +++ tools/clang-check/ClangCheck.cpp @@ -125,9 +125,9 @@ class FixItAction : public clang::FixItAction { public: bool BeginSourceFileAction(clang::CompilerInstance& CI) override { - FixItOpts.reset(new FixItOptions); - Rewriter.reset(new FixItRewriter(CI.getDiagnostics(), CI.getSourceManager(), - CI.getLangOpts(), FixItOpts.get())); + FixItOpts = llvm::make_unique(); + Rewriter = llvm::make_unique(CI.getDiagnostics(), CI.getSourceManager(), + CI.getLangOpts(), FixItOpts.get()); return true; } }; Index: unittests/ASTMatchers/Dynamic/RegistryTest.cpp =================================================================== --- unittests/ASTMatchers/Dynamic/RegistryTest.cpp +++ unittests/ASTMatchers/Dynamic/RegistryTest.cpp @@ -395,27 +395,27 @@ EXPECT_TRUE(constructMatcher("hasInitializer", Error.get()).isNull()); EXPECT_EQ("Incorrect argument count. (Expected = 1) != (Actual = 0)", Error->toString()); - Error.reset(new Diagnostics()); + Error = llvm::make_unique(); EXPECT_TRUE(constructMatcher("isArrow", StringRef(), Error.get()).isNull()); EXPECT_EQ("Incorrect argument count. (Expected = 0) != (Actual = 1)", Error->toString()); - Error.reset(new Diagnostics()); + Error = llvm::make_unique(); EXPECT_TRUE(constructMatcher("anyOf", Error.get()).isNull()); EXPECT_EQ("Incorrect argument count. (Expected = (2, )) != (Actual = 0)", Error->toString()); - Error.reset(new Diagnostics()); + Error = llvm::make_unique(); EXPECT_TRUE(constructMatcher("unless", StringRef(), StringRef(), Error.get()).isNull()); EXPECT_EQ("Incorrect argument count. (Expected = (1, 1)) != (Actual = 2)", Error->toString()); // Bad argument type - Error.reset(new Diagnostics()); + Error = llvm::make_unique(); EXPECT_TRUE(constructMatcher("ofClass", StringRef(), Error.get()).isNull()); EXPECT_EQ("Incorrect type for arg 1. (Expected = Matcher) != " "(Actual = String)", Error->toString()); - Error.reset(new Diagnostics()); + Error = llvm::make_unique(); EXPECT_TRUE( constructMatcher("cxxRecordDecl", constructMatcher("cxxRecordDecl"), constructMatcher("parameterCountIs", 3), Error.get()) @@ -425,13 +425,13 @@ Error->toString()); // Bad argument type with variadic. - Error.reset(new Diagnostics()); + Error = llvm::make_unique(); EXPECT_TRUE(constructMatcher("anyOf", StringRef(), StringRef(), Error.get()).isNull()); EXPECT_EQ( "Incorrect type for arg 1. (Expected = Matcher<>) != (Actual = String)", Error->toString()); - Error.reset(new Diagnostics()); + Error = llvm::make_unique(); EXPECT_TRUE(constructMatcher( "cxxRecordDecl", constructMatcher("allOf", Index: unittests/libclang/LibclangTest.cpp =================================================================== --- unittests/libclang/LibclangTest.cpp +++ unittests/libclang/LibclangTest.cpp @@ -398,8 +398,8 @@ Filename = Path.str(); } auto it = UnsavedFileContents.insert(std::make_pair( - fixed_addr_string(new std::string(Filename)), - fixed_addr_string(new std::string(Contents)))); + llvm::make_unique(Filename), + llvm::make_unique(Contents))); UnsavedFiles.push_back({ it.first->first->c_str(), // filename it.first->second->c_str(), // contents