From 49a6b091014f0033829e099ea7ac50bc7b6e9c32 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Wed, 14 Aug 2019 23:04:18 +0000 Subject: [PATCH] [Clang] Migrate llvm::make_unique to std::make_unique Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. Differential revision: https://reviews.llvm.org/D66259 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@368942 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../AnnotateFunctions/AnnotateFunctions.cpp | 2 +- .../PrintFunctionNames/PrintFunctionNames.cpp | 2 +- examples/clang-interpreter/main.cpp | 2 +- include/clang/AST/ASTImporterSharedState.h | 2 +- include/clang/Basic/SyncScope.h | 2 +- include/clang/Frontend/ASTUnit.h | 2 +- include/clang/Lex/Preprocessor.h | 4 +- include/clang/Sema/SemaInternal.h | 2 +- include/clang/Sema/TypoCorrection.h | 8 +- include/clang/Serialization/ASTReader.h | 4 +- .../Core/BugReporter/BugReporter.h | 2 +- .../Core/PathSensitive/ExplodedGraph.h | 2 +- include/clang/Tooling/ASTDiff/ASTDiff.h | 2 +- .../RefactoringActionRulesInternal.h | 2 +- lib/ARCMigrate/ARCMT.cpp | 4 +- lib/ARCMigrate/ObjCMT.cpp | 6 +- lib/AST/ASTContext.cpp | 2 +- lib/AST/CXXInheritance.cpp | 2 +- lib/AST/ExternalASTMerger.cpp | 2 +- lib/AST/ItaniumCXXABI.cpp | 2 +- lib/AST/Mangle.cpp | 2 +- lib/AST/MicrosoftCXXABI.cpp | 2 +- lib/AST/VTableBuilder.cpp | 12 +- lib/ASTMatchers/ASTMatchFinder.cpp | 2 +- lib/ASTMatchers/Dynamic/Marshallers.h | 14 +- lib/ASTMatchers/Dynamic/Registry.cpp | 2 +- lib/Analysis/AnalysisDeclContext.cpp | 2 +- lib/Analysis/CallGraph.cpp | 2 +- lib/Analysis/Consumed.cpp | 6 +- lib/Analysis/ThreadSafety.cpp | 30 ++-- .../SampleAnalyzer/MainCallChecker.cpp | 2 +- lib/Basic/FileManager.cpp | 4 +- lib/Basic/SourceManager.cpp | 10 +- lib/CodeGen/BackendUtil.cpp | 6 +- lib/CodeGen/CGCall.cpp | 8 +- lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp | 4 +- lib/CodeGen/CodeGenAction.cpp | 6 +- lib/CodeGen/CodeGenModule.cpp | 2 +- lib/CodeGen/CodeGenPGO.cpp | 2 +- .../ObjectFilePCHContainerOperations.cpp | 4 +- .../linux/DirectoryWatcher-linux.cpp | 4 +- .../mac/DirectoryWatcher-mac.cpp | 2 +- lib/Driver/Driver.cpp | 96 ++++++------- lib/Driver/DriverOptions.cpp | 2 +- lib/Driver/ToolChains/AMDGPU.cpp | 2 +- lib/Driver/ToolChains/AVR.cpp | 2 +- lib/Driver/ToolChains/Ananas.cpp | 4 +- lib/Driver/ToolChains/BareMetal.cpp | 2 +- lib/Driver/ToolChains/Clang.cpp | 16 +-- lib/Driver/ToolChains/CloudABI.cpp | 2 +- lib/Driver/ToolChains/CommonArgs.cpp | 4 +- lib/Driver/ToolChains/CrossWindows.cpp | 4 +- lib/Driver/ToolChains/Cuda.cpp | 6 +- lib/Driver/ToolChains/Darwin.cpp | 12 +- lib/Driver/ToolChains/DragonFly.cpp | 4 +- lib/Driver/ToolChains/FreeBSD.cpp | 4 +- lib/Driver/ToolChains/Fuchsia.cpp | 2 +- lib/Driver/ToolChains/Gnu.cpp | 6 +- lib/Driver/ToolChains/HIP.cpp | 10 +- lib/Driver/ToolChains/Hexagon.cpp | 4 +- lib/Driver/ToolChains/MSP430.cpp | 2 +- lib/Driver/ToolChains/MSVC.cpp | 4 +- lib/Driver/ToolChains/MinGW.cpp | 4 +- lib/Driver/ToolChains/Minix.cpp | 4 +- lib/Driver/ToolChains/Myriad.cpp | 6 +- lib/Driver/ToolChains/NaCl.cpp | 2 +- lib/Driver/ToolChains/NetBSD.cpp | 4 +- lib/Driver/ToolChains/OpenBSD.cpp | 4 +- lib/Driver/ToolChains/PS4CPU.cpp | 6 +- lib/Driver/ToolChains/RISCVToolchain.cpp | 2 +- lib/Driver/ToolChains/Solaris.cpp | 4 +- lib/Driver/ToolChains/WebAssembly.cpp | 2 +- lib/Driver/ToolChains/XCore.cpp | 4 +- lib/Format/ContinuationIndenter.cpp | 6 +- lib/Format/Format.cpp | 4 +- lib/Format/UnwrappedLineParser.cpp | 2 +- lib/Frontend/ASTConsumers.cpp | 8 +- lib/Frontend/ASTUnit.cpp | 14 +- lib/Frontend/ChainedIncludesSource.cpp | 2 +- lib/Frontend/CompilerInstance.cpp | 14 +- .../CreateInvocationFromCommandLine.cpp | 2 +- lib/Frontend/DependencyFile.cpp | 6 +- lib/Frontend/DependencyGraph.cpp | 2 +- lib/Frontend/FrontendAction.cpp | 2 +- lib/Frontend/FrontendActions.cpp | 20 +-- lib/Frontend/HeaderIncludeGen.cpp | 2 +- .../InterfaceStubFunctionsConsumer.cpp | 4 +- lib/Frontend/ModuleDependencyCollector.cpp | 6 +- lib/Frontend/MultiplexConsumer.cpp | 4 +- lib/Frontend/PrecompiledPreamble.cpp | 4 +- lib/Frontend/PrintPreprocessedOutput.cpp | 2 +- lib/Frontend/Rewrite/FrontendActions.cpp | 4 +- lib/Frontend/Rewrite/HTMLPrint.cpp | 2 +- lib/Frontend/Rewrite/RewriteModernObjC.cpp | 2 +- lib/Frontend/Rewrite/RewriteObjC.cpp | 2 +- lib/Frontend/SerializedDiagnosticPrinter.cpp | 6 +- lib/Frontend/VerifyDiagnosticConsumer.cpp | 6 +- .../ExecuteCompilerInvocation.cpp | 86 ++++++------ lib/Index/IndexingAction.cpp | 12 +- lib/Lex/PPDirectives.cpp | 4 +- lib/Lex/PPLexerChange.cpp | 4 +- lib/Lex/PPMacroExpansion.cpp | 2 +- lib/Lex/Pragma.cpp | 2 +- lib/Lex/Preprocessor.cpp | 4 +- lib/Parse/ParseCXXInlineMethods.cpp | 2 +- lib/Parse/ParseExpr.cpp | 2 +- lib/Parse/ParsePragma.cpp | 90 ++++++------ lib/Parse/ParseStmt.cpp | 2 +- lib/Parse/ParseTentative.cpp | 2 +- lib/Sema/Sema.cpp | 2 +- lib/Sema/SemaCXXScopeSpec.cpp | 2 +- lib/Sema/SemaDecl.cpp | 6 +- lib/Sema/SemaDeclCXX.cpp | 6 +- lib/Sema/SemaDeclObjC.cpp | 4 +- lib/Sema/SemaExpr.cpp | 2 +- lib/Sema/SemaExprMember.cpp | 2 +- lib/Sema/SemaExprObjC.cpp | 2 +- lib/Sema/SemaInit.cpp | 2 +- lib/Sema/SemaLookup.cpp | 2 +- lib/Sema/SemaOpenMP.cpp | 4 +- lib/Sema/SemaTemplate.cpp | 6 +- lib/Sema/SemaTemplateVariadic.cpp | 2 +- lib/Serialization/ASTReader.cpp | 2 +- lib/Serialization/ModuleManager.cpp | 2 +- lib/Serialization/PCHContainerOperations.cpp | 6 +- .../Checkers/ArrayBoundChecker.cpp | 2 +- .../Checkers/ArrayBoundCheckerV2.cpp | 4 +- .../Checkers/BasicObjCFoundationChecks.cpp | 10 +- .../BlockInCriticalSectionChecker.cpp | 2 +- .../Checkers/BoolAssignmentChecker.cpp | 2 +- .../Checkers/CStringChecker.cpp | 10 +- .../Checkers/CallAndMessageChecker.cpp | 16 +-- .../Checkers/CastSizeChecker.cpp | 2 +- lib/StaticAnalyzer/Checkers/ChrootChecker.cpp | 2 +- lib/StaticAnalyzer/Checkers/CloneChecker.cpp | 4 +- .../Checkers/ConversionChecker.cpp | 2 +- lib/StaticAnalyzer/Checkers/DebugCheckers.cpp | 2 +- .../DeleteWithNonVirtualDtorChecker.cpp | 4 +- .../Checkers/DereferenceChecker.cpp | 4 +- .../Checkers/DivZeroChecker.cpp | 4 +- .../Checkers/DynamicTypeChecker.cpp | 2 +- .../Checkers/DynamicTypePropagation.cpp | 2 +- .../Checkers/EnumCastOutOfRangeChecker.cpp | 2 +- .../Checkers/ExprInspectionChecker.cpp | 2 +- .../Checkers/FixedAddressChecker.cpp | 2 +- .../Checkers/GenericTaintChecker.cpp | 4 +- .../Checkers/InnerPointerChecker.cpp | 2 +- .../Checkers/IteratorChecker.cpp | 8 +- .../Checkers/LocalizationChecker.cpp | 2 +- lib/StaticAnalyzer/Checkers/MIGChecker.cpp | 2 +- .../Checkers/MPI-Checker/MPIBugReporter.cpp | 10 +- .../Checkers/MacOSKeychainAPIChecker.cpp | 14 +- .../Checkers/MacOSXAPIChecker.cpp | 2 +- lib/StaticAnalyzer/Checkers/MallocChecker.cpp | 32 ++--- .../Checkers/MmapWriteExecChecker.cpp | 2 +- lib/StaticAnalyzer/Checkers/MoveChecker.cpp | 4 +- .../Checkers/NSAutoreleasePoolChecker.cpp | 2 +- .../Checkers/NSErrorChecker.cpp | 2 +- .../Checkers/NonNullParamChecker.cpp | 4 +- .../Checkers/NullabilityChecker.cpp | 4 +- .../Checkers/ObjCAtSyncChecker.cpp | 4 +- .../Checkers/ObjCContainersChecker.cpp | 2 +- .../Checkers/ObjCSelfInitChecker.cpp | 2 +- .../Checkers/ObjCSuperDeallocChecker.cpp | 2 +- .../Checkers/PaddingChecker.cpp | 4 +- .../Checkers/PointerArithChecker.cpp | 4 +- .../Checkers/PointerSubChecker.cpp | 2 +- .../Checkers/PthreadLockChecker.cpp | 12 +- .../RetainCountChecker/RetainCountChecker.cpp | 10 +- .../RetainCountDiagnostics.cpp | 6 +- .../Checkers/ReturnPointerRangeChecker.cpp | 2 +- .../Checkers/ReturnUndefChecker.cpp | 2 +- .../Checkers/SimpleStreamChecker.cpp | 4 +- .../Checkers/StackAddrEscapeChecker.cpp | 16 +-- lib/StaticAnalyzer/Checkers/StreamChecker.cpp | 8 +- .../Checkers/TaintTesterChecker.cpp | 2 +- .../Checkers/TestAfterDivZeroChecker.cpp | 4 +- .../Checkers/UndefBranchChecker.cpp | 2 +- .../Checkers/UndefCapturedBlockVarChecker.cpp | 4 +- .../Checkers/UndefResultChecker.cpp | 2 +- .../UndefinedArraySubscriptChecker.cpp | 2 +- .../Checkers/UndefinedAssignmentChecker.cpp | 2 +- .../UninitializedObjectChecker.cpp | 4 +- .../Checkers/UnixAPIChecker.cpp | 6 +- .../Checkers/VLASizeChecker.cpp | 4 +- lib/StaticAnalyzer/Checkers/ValistChecker.cpp | 8 +- lib/StaticAnalyzer/Checkers/VforkChecker.cpp | 2 +- .../Checkers/VirtualCallChecker.cpp | 4 +- lib/StaticAnalyzer/Core/BugReporter.cpp | 26 ++-- .../Core/BugReporterVisitors.cpp | 28 ++-- .../Core/RangeConstraintManager.cpp | 2 +- lib/StaticAnalyzer/Core/RegionStore.cpp | 4 +- .../Core/SMTConstraintManager.cpp | 2 +- lib/StaticAnalyzer/Core/WorkList.cpp | 12 +- .../Frontend/AnalysisConsumer.cpp | 12 +- .../Frontend/CheckerRegistration.cpp | 2 +- .../Frontend/FrontendActions.cpp | 2 +- lib/Tooling/ASTDiff/ASTDiff.cpp | 16 +-- lib/Tooling/AllTUsExecution.cpp | 2 +- lib/Tooling/CommonOptionsParser.cpp | 2 +- lib/Tooling/CompilationDatabase.cpp | 4 +- .../DependencyScanningFilesystem.cpp | 4 +- .../DependencyScanningWorker.cpp | 4 +- .../GuessTargetAndModeCompilationDatabase.cpp | 2 +- .../InterpolatingCompilationDatabase.cpp | 2 +- .../Refactoring/ASTSelectionRequirements.cpp | 2 +- .../Refactoring/RefactoringActions.cpp | 4 +- .../Refactoring/Rename/RenamingAction.cpp | 4 +- .../Refactoring/Rename/SymbolOccurrences.cpp | 2 +- .../Refactoring/Rename/USRFindingAction.cpp | 2 +- lib/Tooling/RefactoringCallbacks.cpp | 2 +- lib/Tooling/StandaloneExecution.cpp | 2 +- lib/Tooling/Syntax/Tokens.cpp | 2 +- tools/c-index-test/core_main.cpp | 2 +- tools/clang-check/ClangCheck.cpp | 2 +- tools/clang-diff/ClangDiff.cpp | 4 +- .../ClangExtDefMapGen.cpp | 2 +- .../clang-fuzzer/handle-llvm/handle_llvm.cpp | 2 +- tools/clang-import-test/clang-import-test.cpp | 22 +-- tools/clang-refactor/ClangRefactor.cpp | 12 +- tools/clang-refactor/TestSupport.cpp | 2 +- tools/clang-scan-deps/ClangScanDeps.cpp | 4 +- tools/driver/cc1_main.cpp | 4 +- tools/driver/cc1as_main.cpp | 8 +- tools/libclang/CIndex.cpp | 2 +- tools/libclang/CIndexDiagnostic.cpp | 6 +- tools/libclang/CIndexer.cpp | 2 +- tools/libclang/CXLoadedDiagnostic.cpp | 4 +- tools/libclang/Indexing.cpp | 8 +- unittests/AST/EvaluateAsRValueTest.cpp | 2 +- unittests/AST/ExternalASTSourceTest.cpp | 2 +- unittests/AST/RecursiveASTVisitorTest.cpp | 2 +- .../ASTMatchers/ASTMatchersInternalTest.cpp | 12 +- .../ASTMatchers/ASTMatchersNarrowingTest.cpp | 26 ++-- unittests/ASTMatchers/ASTMatchersNodeTest.cpp | 10 +- .../ASTMatchers/ASTMatchersTraversalTest.cpp | 130 +++++++++--------- unittests/ASTMatchers/Dynamic/ParserTest.cpp | 8 +- unittests/Basic/FileManagerTest.cpp | 22 +-- unittests/Basic/SourceManagerTest.cpp | 2 +- .../CrossTU/CrossTranslationUnitTest.cpp | 2 +- unittests/Frontend/ASTUnitTest.cpp | 2 +- unittests/Frontend/CompilerInstanceTest.cpp | 2 +- unittests/Frontend/FrontendActionTest.cpp | 2 +- unittests/Index/IndexTests.cpp | 2 +- unittests/Lex/LexerTest.cpp | 2 +- unittests/Sema/CodeCompleteTest.cpp | 2 +- unittests/Sema/ExternalSemaSourceTest.cpp | 2 +- .../StaticAnalyzer/CallDescriptionTest.cpp | 2 +- unittests/StaticAnalyzer/StoreTest.cpp | 2 +- unittests/StaticAnalyzer/SymbolReaperTest.cpp | 2 +- unittests/Tooling/CompilationDatabaseTest.cpp | 6 +- unittests/Tooling/ExecutionTest.cpp | 2 +- unittests/Tooling/RefactoringTest.cpp | 2 +- unittests/Tooling/Syntax/TokensTest.cpp | 2 +- unittests/Tooling/Syntax/TreeTest.cpp | 6 +- unittests/Tooling/TestVisitor.h | 2 +- unittests/Tooling/ToolingTest.cpp | 16 +-- utils/TableGen/ClangAttrEmitter.cpp | 44 +++--- utils/TableGen/NeonEmitter.cpp | 8 +- 259 files changed, 831 insertions(+), 831 deletions(-) diff --git a/examples/AnnotateFunctions/AnnotateFunctions.cpp b/examples/AnnotateFunctions/AnnotateFunctions.cpp index 96eb78eb17..d201bf3df8 100644 --- a/examples/AnnotateFunctions/AnnotateFunctions.cpp +++ b/examples/AnnotateFunctions/AnnotateFunctions.cpp @@ -41,7 +41,7 @@ class AnnotateFunctionsAction : public PluginASTAction { public: std::unique_ptr CreateASTConsumer(CompilerInstance &CI, llvm::StringRef) override { - return llvm::make_unique(); + return std::make_unique(); } bool ParseArgs(const CompilerInstance &CI, diff --git a/examples/PrintFunctionNames/PrintFunctionNames.cpp b/examples/PrintFunctionNames/PrintFunctionNames.cpp index e573ac93eb..6509a6440e 100644 --- a/examples/PrintFunctionNames/PrintFunctionNames.cpp +++ b/examples/PrintFunctionNames/PrintFunctionNames.cpp @@ -81,7 +81,7 @@ class PrintFunctionNamesAction : public PluginASTAction { protected: std::unique_ptr CreateASTConsumer(CompilerInstance &CI, llvm::StringRef) override { - return llvm::make_unique(CI, ParsedTemplates); + return std::make_unique(CI, ParsedTemplates); } bool ParseArgs(const CompilerInstance &CI, diff --git a/examples/clang-interpreter/main.cpp b/examples/clang-interpreter/main.cpp index b81b7ebbb6..134d70774f 100644 --- a/examples/clang-interpreter/main.cpp +++ b/examples/clang-interpreter/main.cpp @@ -58,7 +58,7 @@ private: IRCompileLayer CompileLayer{ES, ObjectLayer, SimpleCompiler(*TM)}; static std::unique_ptr createMemMgr() { - return llvm::make_unique(); + return std::make_unique(); } SimpleJIT( diff --git a/include/clang/AST/ASTImporterSharedState.h b/include/clang/AST/ASTImporterSharedState.h index 3635a62dee..829eb1c611 100644 --- a/include/clang/AST/ASTImporterSharedState.h +++ b/include/clang/AST/ASTImporterSharedState.h @@ -47,7 +47,7 @@ public: ASTImporterSharedState() = default; ASTImporterSharedState(TranslationUnitDecl &ToTU) { - LookupTable = llvm::make_unique(ToTU); + LookupTable = std::make_unique(ToTU); } ASTImporterLookupTable *getLookupTable() { return LookupTable.get(); } diff --git a/include/clang/Basic/SyncScope.h b/include/clang/Basic/SyncScope.h index 15af02d83c..ce8fb9cbed 100644 --- a/include/clang/Basic/SyncScope.h +++ b/include/clang/Basic/SyncScope.h @@ -144,7 +144,7 @@ AtomicScopeModel::create(AtomicScopeModelKind K) { case AtomicScopeModelKind::None: return std::unique_ptr{}; case AtomicScopeModelKind::OpenCL: - return llvm::make_unique(); + return std::make_unique(); } llvm_unreachable("Invalid atomic scope model kind"); } diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h index 4491bf298c..08cc91946e 100644 --- a/include/clang/Frontend/ASTUnit.h +++ b/include/clang/Frontend/ASTUnit.h @@ -315,7 +315,7 @@ public: CodeCompletionTUInfo &getCodeCompletionTUInfo() { if (!CCTUInfo) - CCTUInfo = llvm::make_unique( + CCTUInfo = std::make_unique( std::make_shared()); return *CCTUInfo; } diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h index f65b0cda46..fdf4bebd87 100644 --- a/include/clang/Lex/Preprocessor.h +++ b/include/clang/Lex/Preprocessor.h @@ -994,7 +994,7 @@ public: PPCallbacks *getPPCallbacks() const { return Callbacks.get(); } void addPPCallbacks(std::unique_ptr C) { if (Callbacks) - C = llvm::make_unique(std::move(C), + C = std::make_unique(std::move(C), std::move(Callbacks)); Callbacks = std::move(C); } @@ -1471,7 +1471,7 @@ public: if (LexLevel) { // It's not correct in general to enter caching lex mode while in the // middle of a nested lexing action. - auto TokCopy = llvm::make_unique(1); + auto TokCopy = std::make_unique(1); TokCopy[0] = Tok; EnterTokenStream(std::move(TokCopy), 1, true, IsReinject); } else { diff --git a/include/clang/Sema/SemaInternal.h b/include/clang/Sema/SemaInternal.h index dfb34daa14..cdaf7b70a9 100644 --- a/include/clang/Sema/SemaInternal.h +++ b/include/clang/Sema/SemaInternal.h @@ -97,7 +97,7 @@ public: bool EnteringContext) : Typo(TypoName.getName().getAsIdentifierInfo()), CurrentTCIndex(0), SavedTCIndex(0), SemaRef(SemaRef), S(S), - SS(SS ? llvm::make_unique(*SS) : nullptr), + SS(SS ? std::make_unique(*SS) : nullptr), CorrectionValidator(std::move(CCC)), MemberContext(MemberContext), Result(SemaRef, TypoName, LookupKind), Namespaces(SemaRef.Context, SemaRef.CurContext, SS), diff --git a/include/clang/Sema/TypoCorrection.h b/include/clang/Sema/TypoCorrection.h index b49a96c0b9..e0f8d152db 100644 --- a/include/clang/Sema/TypoCorrection.h +++ b/include/clang/Sema/TypoCorrection.h @@ -356,7 +356,7 @@ public: : CorrectionCandidateCallback(Typo, TypoNNS) {} std::unique_ptr clone() override { - return llvm::make_unique(*this); + return std::make_unique(*this); } }; @@ -369,7 +369,7 @@ public: return candidate.getCorrectionDeclAs(); } std::unique_ptr clone() override { - return llvm::make_unique(*this); + return std::make_unique(*this); } }; @@ -384,7 +384,7 @@ public: bool ValidateCandidate(const TypoCorrection &candidate) override; std::unique_ptr clone() override { - return llvm::make_unique(*this); + return std::make_unique(*this); } private: @@ -409,7 +409,7 @@ public: return false; } std::unique_ptr clone() override { - return llvm::make_unique(*this); + return std::make_unique(*this); } }; diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h index 37bea48d88..13d16539cc 100644 --- a/include/clang/Serialization/ASTReader.h +++ b/include/clang/Serialization/ASTReader.h @@ -1578,7 +1578,7 @@ public: /// Takes ownership of \p L. void addListener(std::unique_ptr L) { if (Listener) - L = llvm::make_unique(std::move(L), + L = std::make_unique(std::move(L), std::move(Listener)); Listener = std::move(L); } @@ -1594,7 +1594,7 @@ public: auto Old = Reader.takeListener(); if (Old) { Chained = true; - L = llvm::make_unique(std::move(L), + L = std::make_unique(std::move(L), std::move(Old)); } Reader.setListener(std::move(L)); diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h index c3d7ba3120..f68e231a1f 100644 --- a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h +++ b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h @@ -646,7 +646,7 @@ public: public: const NoteTag *makeNoteTag(Callback &&Cb, bool IsPrunable = false) { - // We cannot use make_unique because we cannot access the private + // We cannot use std::make_unique because we cannot access the private // constructor from inside it. std::unique_ptr T(new NoteTag(std::move(Cb), IsPrunable)); Tags.push_back(std::move(T)); diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h index bccdcf2d92..07fb937e39 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h @@ -337,7 +337,7 @@ public: bool IsSink = false); std::unique_ptr MakeEmptyGraph() const { - return llvm::make_unique(); + return std::make_unique(); } /// addRoot - Add an untyped node to the set of roots. diff --git a/include/clang/Tooling/ASTDiff/ASTDiff.h b/include/clang/Tooling/ASTDiff/ASTDiff.h index d6cbc09dce..c1cc124e1e 100644 --- a/include/clang/Tooling/ASTDiff/ASTDiff.h +++ b/include/clang/Tooling/ASTDiff/ASTDiff.h @@ -71,7 +71,7 @@ public: /// Constructs a tree from any AST node. template SyntaxTree(T *Node, ASTContext &AST) - : TreeImpl(llvm::make_unique(this, Node, AST)) {} + : TreeImpl(std::make_unique(this, Node, AST)) {} SyntaxTree(SyntaxTree &&Other) = default; ~SyntaxTree(); diff --git a/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h b/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h index cc6ae83202..aaa9e50faa 100644 --- a/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h +++ b/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h @@ -148,7 +148,7 @@ createRefactoringActionRule(const RequirementTypes &... Requirements) { std::tuple Requirements; }; - return llvm::make_unique(std::make_tuple(Requirements...)); + return std::make_unique(std::make_tuple(Requirements...)); } } // end namespace tooling diff --git a/lib/ARCMigrate/ARCMT.cpp b/lib/ARCMigrate/ARCMT.cpp index 568e06f21f..27e2d584e9 100644 --- a/lib/ARCMigrate/ARCMT.cpp +++ b/lib/ARCMigrate/ARCMT.cpp @@ -453,8 +453,8 @@ public: std::unique_ptr CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override { CI.getPreprocessor().addPPCallbacks( - llvm::make_unique(ARCMTMacroLocs)); - return llvm::make_unique(); + std::make_unique(ARCMTMacroLocs)); + return std::make_unique(); } }; diff --git a/lib/ARCMigrate/ObjCMT.cpp b/lib/ARCMigrate/ObjCMT.cpp index b0ffdda8b2..4abb04fef5 100644 --- a/lib/ARCMigrate/ObjCMT.cpp +++ b/lib/ARCMigrate/ObjCMT.cpp @@ -208,10 +208,10 @@ ObjCMigrateAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) { CI.getPreprocessor().addPPCallbacks(std::unique_ptr(PPRec)); std::vector> Consumers; Consumers.push_back(WrapperFrontendAction::CreateASTConsumer(CI, InFile)); - Consumers.push_back(llvm::make_unique( + Consumers.push_back(std::make_unique( MigrateDir, ObjCMigAction, Remapper, CompInst->getFileManager(), PPRec, CompInst->getPreprocessor(), false, None)); - return llvm::make_unique(std::move(Consumers)); + return std::make_unique(std::move(Consumers)); } bool ObjCMigrateAction::BeginInvocation(CompilerInstance &CI) { @@ -2034,7 +2034,7 @@ MigrateSourceAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) { CI.getPreprocessor().addPPCallbacks(std::unique_ptr(PPRec)); std::vector WhiteList = getWhiteListFilenames(CI.getFrontendOpts().ObjCMTWhiteListPath); - return llvm::make_unique( + return std::make_unique( CI.getFrontendOpts().OutputFile, ObjCMTAction, Remapper, CI.getFileManager(), PPRec, CI.getPreprocessor(), /*isOutputFile=*/true, WhiteList); diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 24392321f9..03683ced0f 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -10472,7 +10472,7 @@ ASTContext::getParents(const ast_type_traits::DynTypedNode &Node) { if (!Parents) // We build the parent map for the traversal scope (usually whole TU), as // hasAncestor can escape any subtree. - Parents = llvm::make_unique(*this); + Parents = std::make_unique(*this); return Parents->getParents(Node); } diff --git a/lib/AST/CXXInheritance.cpp b/lib/AST/CXXInheritance.cpp index ecf451b175..a3a3794b2e 100644 --- a/lib/AST/CXXInheritance.cpp +++ b/lib/AST/CXXInheritance.cpp @@ -44,7 +44,7 @@ void CXXBasePaths::ComputeDeclsFound() { Decls.insert(Path->Decls.front()); NumDeclsFound = Decls.size(); - DeclsFound = llvm::make_unique(NumDeclsFound); + DeclsFound = std::make_unique(NumDeclsFound); std::copy(Decls.begin(), Decls.end(), DeclsFound.get()); } diff --git a/lib/AST/ExternalASTMerger.cpp b/lib/AST/ExternalASTMerger.cpp index 61e657da7c..4dc89f0f31 100644 --- a/lib/AST/ExternalASTMerger.cpp +++ b/lib/AST/ExternalASTMerger.cpp @@ -320,7 +320,7 @@ ExternalASTMerger::ExternalASTMerger(const ImporterTarget &Target, void ExternalASTMerger::AddSources(llvm::ArrayRef Sources) { for (const ImporterSource &S : Sources) { assert(&S.AST != &Target.AST); - Importers.push_back(llvm::make_unique( + Importers.push_back(std::make_unique( *this, Target.AST, Target.FM, S.AST, S.FM, S.OM)); } } diff --git a/lib/AST/ItaniumCXXABI.cpp b/lib/AST/ItaniumCXXABI.cpp index 77fb5a1d33..67f874b7b9 100644 --- a/lib/AST/ItaniumCXXABI.cpp +++ b/lib/AST/ItaniumCXXABI.cpp @@ -218,7 +218,7 @@ public: std::unique_ptr createMangleNumberingContext() const override { - return llvm::make_unique(); + return std::make_unique(); } }; } diff --git a/lib/AST/Mangle.cpp b/lib/AST/Mangle.cpp index 625282368a..28de87fde9 100644 --- a/lib/AST/Mangle.cpp +++ b/lib/AST/Mangle.cpp @@ -470,7 +470,7 @@ private: }; ASTNameGenerator::ASTNameGenerator(ASTContext &Ctx) - : Impl(llvm::make_unique(Ctx)) {} + : Impl(std::make_unique(Ctx)) {} ASTNameGenerator::~ASTNameGenerator() {} diff --git a/lib/AST/MicrosoftCXXABI.cpp b/lib/AST/MicrosoftCXXABI.cpp index 444e55f777..074abba3d4 100644 --- a/lib/AST/MicrosoftCXXABI.cpp +++ b/lib/AST/MicrosoftCXXABI.cpp @@ -132,7 +132,7 @@ public: std::unique_ptr createMangleNumberingContext() const override { - return llvm::make_unique(); + return std::make_unique(); } }; } diff --git a/lib/AST/VTableBuilder.cpp b/lib/AST/VTableBuilder.cpp index 0c69957155..5688042dad 100644 --- a/lib/AST/VTableBuilder.cpp +++ b/lib/AST/VTableBuilder.cpp @@ -2268,7 +2268,7 @@ CreateVTableLayout(const ItaniumVTableBuilder &Builder) { SmallVector VTableThunks(Builder.vtable_thunks_begin(), Builder.vtable_thunks_end()); - return llvm::make_unique( + return std::make_unique( Builder.VTableIndices, Builder.vtable_components(), VTableThunks, Builder.getAddressPoints()); } @@ -3253,7 +3253,7 @@ void MicrosoftVTableContext::computeVTablePaths(bool ForVBTables, // Base case: this subobject has its own vptr. if (ForVBTables ? Layout.hasOwnVBPtr() : Layout.hasOwnVFPtr()) - Paths.push_back(llvm::make_unique(RD)); + Paths.push_back(std::make_unique(RD)); // Recursive case: get all the vbtables from our bases and remove anything // that shares a virtual base. @@ -3276,7 +3276,7 @@ void MicrosoftVTableContext::computeVTablePaths(bool ForVBTables, continue; // Copy the path and adjust it as necessary. - auto P = llvm::make_unique(*BaseInfo); + auto P = std::make_unique(*BaseInfo); // We mangle Base into the path if the path would've been ambiguous and it // wasn't already extended with Base. @@ -3562,7 +3562,7 @@ void MicrosoftVTableContext::computeVTableRelatedInformation( const VTableLayout::AddressPointsMapTy EmptyAddressPointsMap; { - auto VFPtrs = llvm::make_unique(); + auto VFPtrs = std::make_unique(); computeVTablePaths(/*ForVBTables=*/false, RD, *VFPtrs); computeFullPathsForVFTables(Context, RD, *VFPtrs); VFPtrLocations[RD] = std::move(VFPtrs); @@ -3576,7 +3576,7 @@ void MicrosoftVTableContext::computeVTableRelatedInformation( assert(VFTableLayouts.count(id) == 0); SmallVector VTableThunks( Builder.vtable_thunks_begin(), Builder.vtable_thunks_end()); - VFTableLayouts[id] = llvm::make_unique( + VFTableLayouts[id] = std::make_unique( ArrayRef{0}, Builder.vtable_components(), VTableThunks, EmptyAddressPointsMap); Thunks.insert(Builder.thunks_begin(), Builder.thunks_end()); @@ -3668,7 +3668,7 @@ const VirtualBaseInfo &MicrosoftVTableContext::computeVBTableRelatedInformation( std::unique_ptr &Entry = VBaseInfo[RD]; if (Entry) return *Entry; - Entry = llvm::make_unique(); + Entry = std::make_unique(); VBI = Entry.get(); } diff --git a/lib/ASTMatchers/ASTMatchFinder.cpp b/lib/ASTMatchers/ASTMatchFinder.cpp index 6eb4a2c426..c51fd630e6 100644 --- a/lib/ASTMatchers/ASTMatchFinder.cpp +++ b/lib/ASTMatchers/ASTMatchFinder.cpp @@ -1078,7 +1078,7 @@ bool MatchFinder::addDynamicMatcher(const internal::DynTypedMatcher &NodeMatch, } std::unique_ptr MatchFinder::newASTConsumer() { - return llvm::make_unique(this, ParsingDone); + return std::make_unique(this, ParsingDone); } void MatchFinder::match(const clang::ast_type_traits::DynTypedNode &Node, diff --git a/lib/ASTMatchers/Dynamic/Marshallers.h b/lib/ASTMatchers/Dynamic/Marshallers.h index fac2fc98e0..9f46108d18 100644 --- a/lib/ASTMatchers/Dynamic/Marshallers.h +++ b/lib/ASTMatchers/Dynamic/Marshallers.h @@ -729,7 +729,7 @@ std::unique_ptr makeMatcherAutoMarshall(ReturnType (*Func)(), StringRef MatcherName) { std::vector RetTypes; BuildReturnTypeVector::build(RetTypes); - return llvm::make_unique( + return std::make_unique( matcherMarshall0, reinterpret_cast(Func), MatcherName, RetTypes, None); } @@ -741,7 +741,7 @@ makeMatcherAutoMarshall(ReturnType (*Func)(ArgType1), StringRef MatcherName) { std::vector RetTypes; BuildReturnTypeVector::build(RetTypes); ArgKind AK = ArgTypeTraits::getKind(); - return llvm::make_unique( + return std::make_unique( matcherMarshall1, reinterpret_cast(Func), MatcherName, RetTypes, AK); } @@ -755,7 +755,7 @@ makeMatcherAutoMarshall(ReturnType (*Func)(ArgType1, ArgType2), BuildReturnTypeVector::build(RetTypes); ArgKind AKs[] = { ArgTypeTraits::getKind(), ArgTypeTraits::getKind() }; - return llvm::make_unique( + return std::make_unique( matcherMarshall2, reinterpret_cast(Func), MatcherName, RetTypes, AKs); } @@ -766,7 +766,7 @@ template makeMatcherAutoMarshall( ast_matchers::internal::VariadicFunction VarFunc, StringRef MatcherName) { - return llvm::make_unique(VarFunc, MatcherName); + return std::make_unique(VarFunc, MatcherName); } /// Overload for VariadicDynCastAllOfMatchers. @@ -778,7 +778,7 @@ std::unique_ptr makeMatcherAutoMarshall( ast_matchers::internal::VariadicDynCastAllOfMatcher VarFunc, StringRef MatcherName) { - return llvm::make_unique(VarFunc, MatcherName); + return std::make_unique(VarFunc, MatcherName); } /// Argument adaptative overload. @@ -791,7 +791,7 @@ std::unique_ptr makeMatcherAutoMarshall( std::vector> Overloads; AdaptativeOverloadCollector(MatcherName, Overloads); - return llvm::make_unique(Overloads); + return std::make_unique(Overloads); } template