Skip to content

Commit

Permalink
Revert "[Clang] Migrate llvm::make_unique to std::make_unique"
Browse files Browse the repository at this point in the history
This reverts commit 49a6b09.

Commit requires newer gcc than is used in our internal builds.
Revert until newer gcc is available.

Change-Id: Ia117ed41217e297fb3b5988057912bbfe20eb3b7
  • Loading branch information
searlmc1 committed Aug 16, 2019
1 parent b3a1d42 commit bf934d8
Show file tree
Hide file tree
Showing 259 changed files with 831 additions and 831 deletions.
2 changes: 1 addition & 1 deletion examples/AnnotateFunctions/AnnotateFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class AnnotateFunctionsAction : public PluginASTAction {
public:
std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
llvm::StringRef) override {
return std::make_unique<AnnotateFunctionsConsumer>();
return llvm::make_unique<AnnotateFunctionsConsumer>();
}

bool ParseArgs(const CompilerInstance &CI,
Expand Down
2 changes: 1 addition & 1 deletion examples/PrintFunctionNames/PrintFunctionNames.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class PrintFunctionNamesAction : public PluginASTAction {
protected:
std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
llvm::StringRef) override {
return std::make_unique<PrintFunctionsConsumer>(CI, ParsedTemplates);
return llvm::make_unique<PrintFunctionsConsumer>(CI, ParsedTemplates);
}

bool ParseArgs(const CompilerInstance &CI,
Expand Down
2 changes: 1 addition & 1 deletion examples/clang-interpreter/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class SimpleJIT {
IRCompileLayer CompileLayer{ES, ObjectLayer, SimpleCompiler(*TM)};

static std::unique_ptr<SectionMemoryManager> createMemMgr() {
return std::make_unique<SectionMemoryManager>();
return llvm::make_unique<SectionMemoryManager>();
}

SimpleJIT(
Expand Down
2 changes: 1 addition & 1 deletion include/clang/AST/ASTImporterSharedState.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ASTImporterSharedState {
ASTImporterSharedState() = default;

ASTImporterSharedState(TranslationUnitDecl &ToTU) {
LookupTable = std::make_unique<ASTImporterLookupTable>(ToTU);
LookupTable = llvm::make_unique<ASTImporterLookupTable>(ToTU);
}

ASTImporterLookupTable *getLookupTable() { return LookupTable.get(); }
Expand Down
2 changes: 1 addition & 1 deletion include/clang/Basic/SyncScope.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ AtomicScopeModel::create(AtomicScopeModelKind K) {
case AtomicScopeModelKind::None:
return std::unique_ptr<AtomicScopeModel>{};
case AtomicScopeModelKind::OpenCL:
return std::make_unique<AtomicScopeOpenCLModel>();
return llvm::make_unique<AtomicScopeOpenCLModel>();
}
llvm_unreachable("Invalid atomic scope model kind");
}
Expand Down
2 changes: 1 addition & 1 deletion include/clang/Frontend/ASTUnit.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ class ASTUnit {

CodeCompletionTUInfo &getCodeCompletionTUInfo() {
if (!CCTUInfo)
CCTUInfo = std::make_unique<CodeCompletionTUInfo>(
CCTUInfo = llvm::make_unique<CodeCompletionTUInfo>(
std::make_shared<GlobalCodeCompletionAllocator>());
return *CCTUInfo;
}
Expand Down
4 changes: 2 additions & 2 deletions include/clang/Lex/Preprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ class Preprocessor {
PPCallbacks *getPPCallbacks() const { return Callbacks.get(); }
void addPPCallbacks(std::unique_ptr<PPCallbacks> C) {
if (Callbacks)
C = std::make_unique<PPChainedCallbacks>(std::move(C),
C = llvm::make_unique<PPChainedCallbacks>(std::move(C),
std::move(Callbacks));
Callbacks = std::move(C);
}
Expand Down Expand Up @@ -1471,7 +1471,7 @@ class Preprocessor {
if (LexLevel) {
// It's not correct in general to enter caching lex mode while in the
// middle of a nested lexing action.
auto TokCopy = std::make_unique<Token[]>(1);
auto TokCopy = llvm::make_unique<Token[]>(1);
TokCopy[0] = Tok;
EnterTokenStream(std::move(TokCopy), 1, true, IsReinject);
} else {
Expand Down
2 changes: 1 addition & 1 deletion include/clang/Sema/SemaInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class TypoCorrectionConsumer : public VisibleDeclConsumer {
bool EnteringContext)
: Typo(TypoName.getName().getAsIdentifierInfo()), CurrentTCIndex(0),
SavedTCIndex(0), SemaRef(SemaRef), S(S),
SS(SS ? std::make_unique<CXXScopeSpec>(*SS) : nullptr),
SS(SS ? llvm::make_unique<CXXScopeSpec>(*SS) : nullptr),
CorrectionValidator(std::move(CCC)), MemberContext(MemberContext),
Result(SemaRef, TypoName, LookupKind),
Namespaces(SemaRef.Context, SemaRef.CurContext, SS),
Expand Down
8 changes: 4 additions & 4 deletions include/clang/Sema/TypoCorrection.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ class DefaultFilterCCC final : public CorrectionCandidateCallback {
: CorrectionCandidateCallback(Typo, TypoNNS) {}

std::unique_ptr<CorrectionCandidateCallback> clone() override {
return std::make_unique<DefaultFilterCCC>(*this);
return llvm::make_unique<DefaultFilterCCC>(*this);
}
};

Expand All @@ -369,7 +369,7 @@ class DeclFilterCCC final : public CorrectionCandidateCallback {
return candidate.getCorrectionDeclAs<C>();
}
std::unique_ptr<CorrectionCandidateCallback> clone() override {
return std::make_unique<DeclFilterCCC>(*this);
return llvm::make_unique<DeclFilterCCC>(*this);
}
};

Expand All @@ -384,7 +384,7 @@ class FunctionCallFilterCCC : public CorrectionCandidateCallback {

bool ValidateCandidate(const TypoCorrection &candidate) override;
std::unique_ptr<CorrectionCandidateCallback> clone() override {
return std::make_unique<FunctionCallFilterCCC>(*this);
return llvm::make_unique<FunctionCallFilterCCC>(*this);
}

private:
Expand All @@ -409,7 +409,7 @@ class NoTypoCorrectionCCC final : public CorrectionCandidateCallback {
return false;
}
std::unique_ptr<CorrectionCandidateCallback> clone() override {
return std::make_unique<NoTypoCorrectionCCC>(*this);
return llvm::make_unique<NoTypoCorrectionCCC>(*this);
}
};

Expand Down
4 changes: 2 additions & 2 deletions include/clang/Serialization/ASTReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -1578,7 +1578,7 @@ class ASTReader
/// Takes ownership of \p L.
void addListener(std::unique_ptr<ASTReaderListener> L) {
if (Listener)
L = std::make_unique<ChainedASTReaderListener>(std::move(L),
L = llvm::make_unique<ChainedASTReaderListener>(std::move(L),
std::move(Listener));
Listener = std::move(L);
}
Expand All @@ -1594,7 +1594,7 @@ class ASTReader
auto Old = Reader.takeListener();
if (Old) {
Chained = true;
L = std::make_unique<ChainedASTReaderListener>(std::move(L),
L = llvm::make_unique<ChainedASTReaderListener>(std::move(L),
std::move(Old));
}
Reader.setListener(std::move(L));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ class NoteTag : public ProgramPointTag {

public:
const NoteTag *makeNoteTag(Callback &&Cb, bool IsPrunable = false) {
// We cannot use std::make_unique because we cannot access the private
// We cannot use make_unique because we cannot access the private
// constructor from inside it.
std::unique_ptr<NoteTag> T(new NoteTag(std::move(Cb), IsPrunable));
Tags.push_back(std::move(T));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ class ExplodedGraph {
bool IsSink = false);

std::unique_ptr<ExplodedGraph> MakeEmptyGraph() const {
return std::make_unique<ExplodedGraph>();
return llvm::make_unique<ExplodedGraph>();
}

/// addRoot - Add an untyped node to the set of roots.
Expand Down
2 changes: 1 addition & 1 deletion include/clang/Tooling/ASTDiff/ASTDiff.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class SyntaxTree {
/// Constructs a tree from any AST node.
template <class T>
SyntaxTree(T *Node, ASTContext &AST)
: TreeImpl(std::make_unique<Impl>(this, Node, AST)) {}
: TreeImpl(llvm::make_unique<Impl>(this, Node, AST)) {}
SyntaxTree(SyntaxTree &&Other) = default;
~SyntaxTree();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ createRefactoringActionRule(const RequirementTypes &... Requirements) {
std::tuple<RequirementTypes...> Requirements;
};

return std::make_unique<Rule>(std::make_tuple(Requirements...));
return llvm::make_unique<Rule>(std::make_tuple(Requirements...));
}

} // end namespace tooling
Expand Down
4 changes: 2 additions & 2 deletions lib/ARCMigrate/ARCMT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,8 @@ class ARCMTMacroTrackerAction : public ASTFrontendAction {
std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
StringRef InFile) override {
CI.getPreprocessor().addPPCallbacks(
std::make_unique<ARCMTMacroTrackerPPCallbacks>(ARCMTMacroLocs));
return std::make_unique<ASTConsumer>();
llvm::make_unique<ARCMTMacroTrackerPPCallbacks>(ARCMTMacroLocs));
return llvm::make_unique<ASTConsumer>();
}
};

Expand Down
6 changes: 3 additions & 3 deletions lib/ARCMigrate/ObjCMT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ ObjCMigrateAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
CI.getPreprocessor().addPPCallbacks(std::unique_ptr<PPCallbacks>(PPRec));
std::vector<std::unique_ptr<ASTConsumer>> Consumers;
Consumers.push_back(WrapperFrontendAction::CreateASTConsumer(CI, InFile));
Consumers.push_back(std::make_unique<ObjCMigrateASTConsumer>(
Consumers.push_back(llvm::make_unique<ObjCMigrateASTConsumer>(
MigrateDir, ObjCMigAction, Remapper, CompInst->getFileManager(), PPRec,
CompInst->getPreprocessor(), false, None));
return std::make_unique<MultiplexConsumer>(std::move(Consumers));
return llvm::make_unique<MultiplexConsumer>(std::move(Consumers));
}

bool ObjCMigrateAction::BeginInvocation(CompilerInstance &CI) {
Expand Down Expand Up @@ -2034,7 +2034,7 @@ MigrateSourceAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
CI.getPreprocessor().addPPCallbacks(std::unique_ptr<PPCallbacks>(PPRec));
std::vector<std::string> WhiteList =
getWhiteListFilenames(CI.getFrontendOpts().ObjCMTWhiteListPath);
return std::make_unique<ObjCMigrateASTConsumer>(
return llvm::make_unique<ObjCMigrateASTConsumer>(
CI.getFrontendOpts().OutputFile, ObjCMTAction, Remapper,
CI.getFileManager(), PPRec, CI.getPreprocessor(),
/*isOutputFile=*/true, WhiteList);
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/ASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10473,7 +10473,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 = std::make_unique<ParentMap>(*this);
Parents = llvm::make_unique<ParentMap>(*this);
return Parents->getParents(Node);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/AST/CXXInheritance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void CXXBasePaths::ComputeDeclsFound() {
Decls.insert(Path->Decls.front());

NumDeclsFound = Decls.size();
DeclsFound = std::make_unique<NamedDecl *[]>(NumDeclsFound);
DeclsFound = llvm::make_unique<NamedDecl *[]>(NumDeclsFound);
std::copy(Decls.begin(), Decls.end(), DeclsFound.get());
}

Expand Down
2 changes: 1 addition & 1 deletion lib/AST/ExternalASTMerger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ ExternalASTMerger::ExternalASTMerger(const ImporterTarget &Target,
void ExternalASTMerger::AddSources(llvm::ArrayRef<ImporterSource> Sources) {
for (const ImporterSource &S : Sources) {
assert(&S.AST != &Target.AST);
Importers.push_back(std::make_unique<LazyASTImporter>(
Importers.push_back(llvm::make_unique<LazyASTImporter>(
*this, Target.AST, Target.FM, S.AST, S.FM, S.OM));
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/ItaniumCXXABI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ class ItaniumCXXABI : public CXXABI {

std::unique_ptr<MangleNumberingContext>
createMangleNumberingContext() const override {
return std::make_unique<ItaniumNumberingContext>();
return llvm::make_unique<ItaniumNumberingContext>();
}
};
}
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/Mangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ class ASTNameGenerator::Implementation {
};

ASTNameGenerator::ASTNameGenerator(ASTContext &Ctx)
: Impl(std::make_unique<Implementation>(Ctx)) {}
: Impl(llvm::make_unique<Implementation>(Ctx)) {}

ASTNameGenerator::~ASTNameGenerator() {}

Expand Down
2 changes: 1 addition & 1 deletion lib/AST/MicrosoftCXXABI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class MicrosoftCXXABI : public CXXABI {

std::unique_ptr<MangleNumberingContext>
createMangleNumberingContext() const override {
return std::make_unique<MicrosoftNumberingContext>();
return llvm::make_unique<MicrosoftNumberingContext>();
}
};
}
Expand Down
12 changes: 6 additions & 6 deletions lib/AST/VTableBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2268,7 +2268,7 @@ CreateVTableLayout(const ItaniumVTableBuilder &Builder) {
SmallVector<VTableLayout::VTableThunkTy, 1>
VTableThunks(Builder.vtable_thunks_begin(), Builder.vtable_thunks_end());

return std::make_unique<VTableLayout>(
return llvm::make_unique<VTableLayout>(
Builder.VTableIndices, Builder.vtable_components(), VTableThunks,
Builder.getAddressPoints());
}
Expand Down Expand Up @@ -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(std::make_unique<VPtrInfo>(RD));
Paths.push_back(llvm::make_unique<VPtrInfo>(RD));

// Recursive case: get all the vbtables from our bases and remove anything
// that shares a virtual base.
Expand All @@ -3276,7 +3276,7 @@ void MicrosoftVTableContext::computeVTablePaths(bool ForVBTables,
continue;

// Copy the path and adjust it as necessary.
auto P = std::make_unique<VPtrInfo>(*BaseInfo);
auto P = llvm::make_unique<VPtrInfo>(*BaseInfo);

// We mangle Base into the path if the path would've been ambiguous and it
// wasn't already extended with Base.
Expand Down Expand Up @@ -3562,7 +3562,7 @@ void MicrosoftVTableContext::computeVTableRelatedInformation(
const VTableLayout::AddressPointsMapTy EmptyAddressPointsMap;

{
auto VFPtrs = std::make_unique<VPtrInfoVector>();
auto VFPtrs = llvm::make_unique<VPtrInfoVector>();
computeVTablePaths(/*ForVBTables=*/false, RD, *VFPtrs);
computeFullPathsForVFTables(Context, RD, *VFPtrs);
VFPtrLocations[RD] = std::move(VFPtrs);
Expand All @@ -3576,7 +3576,7 @@ void MicrosoftVTableContext::computeVTableRelatedInformation(
assert(VFTableLayouts.count(id) == 0);
SmallVector<VTableLayout::VTableThunkTy, 1> VTableThunks(
Builder.vtable_thunks_begin(), Builder.vtable_thunks_end());
VFTableLayouts[id] = std::make_unique<VTableLayout>(
VFTableLayouts[id] = llvm::make_unique<VTableLayout>(
ArrayRef<size_t>{0}, Builder.vtable_components(), VTableThunks,
EmptyAddressPointsMap);
Thunks.insert(Builder.thunks_begin(), Builder.thunks_end());
Expand Down Expand Up @@ -3668,7 +3668,7 @@ const VirtualBaseInfo &MicrosoftVTableContext::computeVBTableRelatedInformation(
std::unique_ptr<VirtualBaseInfo> &Entry = VBaseInfo[RD];
if (Entry)
return *Entry;
Entry = std::make_unique<VirtualBaseInfo>();
Entry = llvm::make_unique<VirtualBaseInfo>();
VBI = Entry.get();
}

Expand Down
2 changes: 1 addition & 1 deletion lib/ASTMatchers/ASTMatchFinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ bool MatchFinder::addDynamicMatcher(const internal::DynTypedMatcher &NodeMatch,
}

std::unique_ptr<ASTConsumer> MatchFinder::newASTConsumer() {
return std::make_unique<internal::MatchASTConsumer>(this, ParsingDone);
return llvm::make_unique<internal::MatchASTConsumer>(this, ParsingDone);
}

void MatchFinder::match(const clang::ast_type_traits::DynTypedNode &Node,
Expand Down
14 changes: 7 additions & 7 deletions lib/ASTMatchers/Dynamic/Marshallers.h
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ std::unique_ptr<MatcherDescriptor>
makeMatcherAutoMarshall(ReturnType (*Func)(), StringRef MatcherName) {
std::vector<ast_type_traits::ASTNodeKind> RetTypes;
BuildReturnTypeVector<ReturnType>::build(RetTypes);
return std::make_unique<FixedArgCountMatcherDescriptor>(
return llvm::make_unique<FixedArgCountMatcherDescriptor>(
matcherMarshall0<ReturnType>, reinterpret_cast<void (*)()>(Func),
MatcherName, RetTypes, None);
}
Expand All @@ -741,7 +741,7 @@ makeMatcherAutoMarshall(ReturnType (*Func)(ArgType1), StringRef MatcherName) {
std::vector<ast_type_traits::ASTNodeKind> RetTypes;
BuildReturnTypeVector<ReturnType>::build(RetTypes);
ArgKind AK = ArgTypeTraits<ArgType1>::getKind();
return std::make_unique<FixedArgCountMatcherDescriptor>(
return llvm::make_unique<FixedArgCountMatcherDescriptor>(
matcherMarshall1<ReturnType, ArgType1>,
reinterpret_cast<void (*)()>(Func), MatcherName, RetTypes, AK);
}
Expand All @@ -755,7 +755,7 @@ makeMatcherAutoMarshall(ReturnType (*Func)(ArgType1, ArgType2),
BuildReturnTypeVector<ReturnType>::build(RetTypes);
ArgKind AKs[] = { ArgTypeTraits<ArgType1>::getKind(),
ArgTypeTraits<ArgType2>::getKind() };
return std::make_unique<FixedArgCountMatcherDescriptor>(
return llvm::make_unique<FixedArgCountMatcherDescriptor>(
matcherMarshall2<ReturnType, ArgType1, ArgType2>,
reinterpret_cast<void (*)()>(Func), MatcherName, RetTypes, AKs);
}
Expand All @@ -766,7 +766,7 @@ template <typename ResultT, typename ArgT,
std::unique_ptr<MatcherDescriptor> makeMatcherAutoMarshall(
ast_matchers::internal::VariadicFunction<ResultT, ArgT, Func> VarFunc,
StringRef MatcherName) {
return std::make_unique<VariadicFuncMatcherDescriptor>(VarFunc, MatcherName);
return llvm::make_unique<VariadicFuncMatcherDescriptor>(VarFunc, MatcherName);
}

/// Overload for VariadicDynCastAllOfMatchers.
Expand All @@ -778,7 +778,7 @@ std::unique_ptr<MatcherDescriptor> makeMatcherAutoMarshall(
ast_matchers::internal::VariadicDynCastAllOfMatcher<BaseT, DerivedT>
VarFunc,
StringRef MatcherName) {
return std::make_unique<DynCastAllOfMatcherDescriptor>(VarFunc, MatcherName);
return llvm::make_unique<DynCastAllOfMatcherDescriptor>(VarFunc, MatcherName);
}

/// Argument adaptative overload.
Expand All @@ -791,7 +791,7 @@ std::unique_ptr<MatcherDescriptor> makeMatcherAutoMarshall(
std::vector<std::unique_ptr<MatcherDescriptor>> Overloads;
AdaptativeOverloadCollector<ArgumentAdapterT, FromTypes, ToTypes>(MatcherName,
Overloads);
return std::make_unique<OverloadedMatcherDescriptor>(Overloads);
return llvm::make_unique<OverloadedMatcherDescriptor>(Overloads);
}

template <template <typename ToArg, typename FromArg> class ArgumentAdapterT,
Expand All @@ -810,7 +810,7 @@ std::unique_ptr<MatcherDescriptor> makeMatcherAutoMarshall(
ast_matchers::internal::VariadicOperatorMatcherFunc<MinCount, MaxCount>
Func,
StringRef MatcherName) {
return std::make_unique<VariadicOperatorMatcherDescriptor>(
return llvm::make_unique<VariadicOperatorMatcherDescriptor>(
MinCount, MaxCount, Func.Op, MatcherName);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/ASTMatchers/Dynamic/Registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void RegistryMaps::registerMatcher(

#define REGISTER_MATCHER_OVERLOAD(name) \
registerMatcher(#name, \
std::make_unique<internal::OverloadedMatcherDescriptor>(name##Callbacks))
llvm::make_unique<internal::OverloadedMatcherDescriptor>(name##Callbacks))

#define SPECIFIC_MATCHER_OVERLOAD(name, Id) \
static_cast<::clang::ast_matchers::name##_Type##Id>( \
Expand Down
Loading

0 comments on commit bf934d8

Please sign in to comment.