diff options
Diffstat (limited to 'clang/unittests')
28 files changed, 137 insertions, 137 deletions
diff --git a/clang/unittests/AST/EvaluateAsRValueTest.cpp b/clang/unittests/AST/EvaluateAsRValueTest.cpp index e737507..4eabb2c 100644 --- a/clang/unittests/AST/EvaluateAsRValueTest.cpp +++ b/clang/unittests/AST/EvaluateAsRValueTest.cpp @@ -59,7 +59,7 @@ class EvaluateConstantInitializersAction : public clang::ASTFrontendAction { std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(clang::CompilerInstance &Compiler, llvm::StringRef FilePath) override { - return llvm::make_unique<Consumer>(); + return std::make_unique<Consumer>(); } private: diff --git a/clang/unittests/AST/ExternalASTSourceTest.cpp b/clang/unittests/AST/ExternalASTSourceTest.cpp index 3a0fe01..ba8a8cd 100644 --- a/clang/unittests/AST/ExternalASTSourceTest.cpp +++ b/clang/unittests/AST/ExternalASTSourceTest.cpp @@ -37,7 +37,7 @@ private: std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override { - return llvm::make_unique<ASTConsumer>(); + return std::make_unique<ASTConsumer>(); } IntrusiveRefCntPtr<ExternalASTSource> Source; diff --git a/clang/unittests/AST/RecursiveASTVisitorTest.cpp b/clang/unittests/AST/RecursiveASTVisitorTest.cpp index 861b994..988a8ce 100644 --- a/clang/unittests/AST/RecursiveASTVisitorTest.cpp +++ b/clang/unittests/AST/RecursiveASTVisitorTest.cpp @@ -42,7 +42,7 @@ public: llvm::function_ref<void(ASTContext &CTx)> Process; }; - return llvm::make_unique<Consumer>(Process); + return std::make_unique<Consumer>(Process); } private: diff --git a/clang/unittests/ASTMatchers/ASTMatchersInternalTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersInternalTest.cpp index 5fcf236..06e9ac0 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersInternalTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersInternalTest.cpp @@ -55,13 +55,13 @@ TEST(AstMatcherPMacro, Works) { DeclarationMatcher HasClassB = just(has(recordDecl(hasName("B")).bind("b"))); EXPECT_TRUE(matchAndVerifyResultTrue("class A { class B {}; };", - HasClassB, llvm::make_unique<VerifyIdIsBoundTo<Decl>>("b"))); + HasClassB, std::make_unique<VerifyIdIsBoundTo<Decl>>("b"))); EXPECT_TRUE(matchAndVerifyResultFalse("class A { class B {}; };", - HasClassB, llvm::make_unique<VerifyIdIsBoundTo<Decl>>("a"))); + HasClassB, std::make_unique<VerifyIdIsBoundTo<Decl>>("a"))); EXPECT_TRUE(matchAndVerifyResultFalse("class A { class C {}; };", - HasClassB, llvm::make_unique<VerifyIdIsBoundTo<Decl>>("b"))); + HasClassB, std::make_unique<VerifyIdIsBoundTo<Decl>>("b"))); } AST_POLYMORPHIC_MATCHER_P(polymorphicHas, @@ -78,13 +78,13 @@ TEST(AstPolymorphicMatcherPMacro, Works) { polymorphicHas(recordDecl(hasName("B")).bind("b")); EXPECT_TRUE(matchAndVerifyResultTrue("class A { class B {}; };", - HasClassB, llvm::make_unique<VerifyIdIsBoundTo<Decl>>("b"))); + HasClassB, std::make_unique<VerifyIdIsBoundTo<Decl>>("b"))); EXPECT_TRUE(matchAndVerifyResultFalse("class A { class B {}; };", - HasClassB, llvm::make_unique<VerifyIdIsBoundTo<Decl>>("a"))); + HasClassB, std::make_unique<VerifyIdIsBoundTo<Decl>>("a"))); EXPECT_TRUE(matchAndVerifyResultFalse("class A { class C {}; };", - HasClassB, llvm::make_unique<VerifyIdIsBoundTo<Decl>>("b"))); + HasClassB, std::make_unique<VerifyIdIsBoundTo<Decl>>("b"))); StatementMatcher StatementHasClassB = polymorphicHas(recordDecl(hasName("B"))); diff --git a/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp index 52cd042..ea2d952 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp @@ -688,24 +688,24 @@ TEST(Matcher, BindMatchedNodes) { DeclarationMatcher ClassX = has(recordDecl(hasName("::X")).bind("x")); EXPECT_TRUE(matchAndVerifyResultTrue("class X {};", - ClassX, llvm::make_unique<VerifyIdIsBoundTo<CXXRecordDecl>>("x"))); + ClassX, std::make_unique<VerifyIdIsBoundTo<CXXRecordDecl>>("x"))); EXPECT_TRUE(matchAndVerifyResultFalse("class X {};", - ClassX, llvm::make_unique<VerifyIdIsBoundTo<CXXRecordDecl>>("other-id"))); + ClassX, std::make_unique<VerifyIdIsBoundTo<CXXRecordDecl>>("other-id"))); TypeMatcher TypeAHasClassB = hasDeclaration( recordDecl(hasName("A"), has(recordDecl(hasName("B")).bind("b")))); EXPECT_TRUE(matchAndVerifyResultTrue("class A { public: A *a; class B {}; };", TypeAHasClassB, - llvm::make_unique<VerifyIdIsBoundTo<Decl>>("b"))); + std::make_unique<VerifyIdIsBoundTo<Decl>>("b"))); StatementMatcher MethodX = callExpr(callee(cxxMethodDecl(hasName("x")))).bind("x"); EXPECT_TRUE(matchAndVerifyResultTrue("class A { void x() { x(); } };", MethodX, - llvm::make_unique<VerifyIdIsBoundTo<CXXMemberCallExpr>>("x"))); + std::make_unique<VerifyIdIsBoundTo<CXXMemberCallExpr>>("x"))); } TEST(Matcher, BindTheSameNameInAlternatives) { @@ -722,7 +722,7 @@ TEST(Matcher, BindTheSameNameInAlternatives) { // The second branch binds x to f() and succeeds. "int f() { return 0 + f(); }", matcher, - llvm::make_unique<VerifyIdIsBoundTo<CallExpr>>("x"))); + std::make_unique<VerifyIdIsBoundTo<CallExpr>>("x"))); } TEST(Matcher, BindsIDForMemoizedResults) { @@ -734,7 +734,7 @@ TEST(Matcher, BindsIDForMemoizedResults) { DeclarationMatcher(anyOf( recordDecl(hasName("A"), hasDescendant(ClassX)), recordDecl(hasName("B"), hasDescendant(ClassX)))), - llvm::make_unique<VerifyIdIsBoundTo<Decl>>("x", 2))); + std::make_unique<VerifyIdIsBoundTo<Decl>>("x", 2))); } TEST(HasType, MatchesAsString) { @@ -784,7 +784,7 @@ TEST(Matcher, NestedOverloadedOperatorCalls) { "Y& operator&&(Y& x, Y& y) { return x; }; " "Y a; Y b; Y c; Y d = a && b && c;", cxxOperatorCallExpr(hasOverloadedOperatorName("&&")).bind("x"), - llvm::make_unique<VerifyIdIsBoundTo<CXXOperatorCallExpr>>("x", 2))); + std::make_unique<VerifyIdIsBoundTo<CXXOperatorCallExpr>>("x", 2))); EXPECT_TRUE(matches("class Y { }; " "Y& operator&&(Y& x, Y& y) { return x; }; " "Y a; Y b; Y c; Y d = a && b && c;", @@ -1817,7 +1817,7 @@ TEST(EachOf, TriggersForEachMatch) { "class A { int a; int b; };", recordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")), has(fieldDecl(hasName("b")).bind("v")))), - llvm::make_unique<VerifyIdIsBoundTo<FieldDecl>>("v", 2))); + std::make_unique<VerifyIdIsBoundTo<FieldDecl>>("v", 2))); } TEST(EachOf, BehavesLikeAnyOfUnlessBothMatch) { @@ -1825,12 +1825,12 @@ TEST(EachOf, BehavesLikeAnyOfUnlessBothMatch) { "class A { int a; int c; };", recordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")), has(fieldDecl(hasName("b")).bind("v")))), - llvm::make_unique<VerifyIdIsBoundTo<FieldDecl>>("v", 1))); + std::make_unique<VerifyIdIsBoundTo<FieldDecl>>("v", 1))); EXPECT_TRUE(matchAndVerifyResultTrue( "class A { int c; int b; };", recordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")), has(fieldDecl(hasName("b")).bind("v")))), - llvm::make_unique<VerifyIdIsBoundTo<FieldDecl>>("v", 1))); + std::make_unique<VerifyIdIsBoundTo<FieldDecl>>("v", 1))); EXPECT_TRUE(notMatches( "class A { int c; int d; };", recordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")), @@ -2337,7 +2337,7 @@ TEST(EqualsBoundNodeMatcher, UsingForEachDescendant) { forEachDescendant(varDecl(hasType( qualType(equalsBoundNode("type")))).bind("decl"))), // Only i and j should match, not k. - llvm::make_unique<VerifyIdIsBoundTo<VarDecl>>("decl", 2))); + std::make_unique<VerifyIdIsBoundTo<VarDecl>>("decl", 2))); } TEST(EqualsBoundNodeMatcher, FiltersMatchedCombinations) { @@ -2350,7 +2350,7 @@ TEST(EqualsBoundNodeMatcher, FiltersMatchedCombinations) { functionDecl( hasName("f"), forEachDescendant(varDecl().bind("d")), forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d")))))), - llvm::make_unique<VerifyIdIsBoundTo<VarDecl>>("d", 5))); + std::make_unique<VerifyIdIsBoundTo<VarDecl>>("d", 5))); } TEST(EqualsBoundNodeMatcher, UnlessDescendantsOfAncestorsMatch) { @@ -2367,7 +2367,7 @@ TEST(EqualsBoundNodeMatcher, UnlessDescendantsOfAncestorsMatch) { callee(cxxMethodDecl(anyOf(hasName("size"), hasName("length")))), on(declRefExpr(to(varDecl(equalsBoundNode("var"))))))))))) .bind("data"), - llvm::make_unique<VerifyIdIsBoundTo<Expr>>("data", 1))); + std::make_unique<VerifyIdIsBoundTo<Expr>>("data", 1))); EXPECT_FALSE(matches( "struct StringRef { int size() const; const char* data() const; };" diff --git a/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp index 16e682a..4c557cf 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp @@ -1313,11 +1313,11 @@ TEST(TypeMatching, PointerTypes) { //EXPECT_TRUE(matchAndVerifyResultTrue( // "int* a;", // pointerTypeLoc(pointeeLoc(typeLoc().bind("loc"))), - // llvm::make_unique<VerifyIdIsBoundTo<TypeLoc>>("loc", 1))); + // std::make_unique<VerifyIdIsBoundTo<TypeLoc>>("loc", 1))); //EXPECT_TRUE(matchAndVerifyResultTrue( // "int* a;", // pointerTypeLoc().bind("loc"), - // llvm::make_unique<VerifyIdIsBoundTo<TypeLoc>>("loc", 1))); + // std::make_unique<VerifyIdIsBoundTo<TypeLoc>>("loc", 1))); EXPECT_TRUE(matches( "int** a;", loc(pointerType(pointee(qualType()))))); @@ -1576,14 +1576,14 @@ public: TEST(IsEqualTo, MatchesNodesByIdentity) { EXPECT_TRUE(matchAndVerifyResultTrue( "class X { class Y {}; };", recordDecl(hasName("::X::Y")).bind(""), - llvm::make_unique<VerifyAncestorHasChildIsEqual<CXXRecordDecl>>())); + std::make_unique<VerifyAncestorHasChildIsEqual<CXXRecordDecl>>())); EXPECT_TRUE(matchAndVerifyResultTrue( "void f() { if (true) if(true) {} }", ifStmt().bind(""), - llvm::make_unique<VerifyAncestorHasChildIsEqual<IfStmt>>())); + std::make_unique<VerifyAncestorHasChildIsEqual<IfStmt>>())); EXPECT_TRUE(matchAndVerifyResultTrue( "class X { class Y {} y; };", fieldDecl(hasName("y"), hasType(type().bind(""))).bind("decl"), - llvm::make_unique<VerifyAncestorHasChildIsEqual<Type>>())); + std::make_unique<VerifyAncestorHasChildIsEqual<Type>>())); } TEST(TypedefDeclMatcher, Match) { diff --git a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp index 495fd1f..6939629 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp @@ -80,7 +80,7 @@ TEST(HasDescendant, MatchesDescendantTypes) { "void f() { int a; float c; int d; int e; }", functionDecl(forEachDescendant( varDecl(hasDescendant(isInteger())).bind("x"))), - llvm::make_unique<VerifyIdIsBoundTo<Decl>>("x", 3))); + std::make_unique<VerifyIdIsBoundTo<Decl>>("x", 3))); } TEST(HasDescendant, MatchesDescendantsOfTypes) { @@ -95,7 +95,7 @@ TEST(HasDescendant, MatchesDescendantsOfTypes) { EXPECT_TRUE(matchAndVerifyResultTrue( "void f() { int*** i; }", qualType(asString("int ***"), forEachDescendant(pointerType().bind("x"))), - llvm::make_unique<VerifyIdIsBoundTo<Type>>("x", 2))); + std::make_unique<VerifyIdIsBoundTo<Type>>("x", 2))); } @@ -107,7 +107,7 @@ TEST(Has, MatchesChildrenOfTypes) { EXPECT_TRUE(matchAndVerifyResultTrue( "int (*f)(float, int);", qualType(functionType(), forEach(qualType(isInteger()).bind("x"))), - llvm::make_unique<VerifyIdIsBoundTo<QualType>>("x", 2))); + std::make_unique<VerifyIdIsBoundTo<QualType>>("x", 2))); } TEST(Has, MatchesChildTypes) { @@ -642,7 +642,7 @@ TEST(ForEachArgumentWithParam, MatchesCXXMemberCallExpr) { " int y = 1;" " S1[y];" "}", - CallExpr, llvm::make_unique<VerifyIdIsBoundTo<ParmVarDecl>>("param", 1))); + CallExpr, std::make_unique<VerifyIdIsBoundTo<ParmVarDecl>>("param", 1))); StatementMatcher CallExpr2 = callExpr(forEachArgumentWithParam(ArgumentY, IntParam)); @@ -654,7 +654,7 @@ TEST(ForEachArgumentWithParam, MatchesCXXMemberCallExpr) { " int y = 1;" " S::g(y);" "}", - CallExpr2, llvm::make_unique<VerifyIdIsBoundTo<ParmVarDecl>>("param", 1))); + CallExpr2, std::make_unique<VerifyIdIsBoundTo<ParmVarDecl>>("param", 1))); } TEST(ForEachArgumentWithParam, MatchesCallExpr) { @@ -666,19 +666,19 @@ TEST(ForEachArgumentWithParam, MatchesCallExpr) { EXPECT_TRUE( matchAndVerifyResultTrue("void f(int i) { int y; f(y); }", CallExpr, - llvm::make_unique<VerifyIdIsBoundTo<ParmVarDecl>>( + std::make_unique<VerifyIdIsBoundTo<ParmVarDecl>>( "param"))); EXPECT_TRUE( matchAndVerifyResultTrue("void f(int i) { int y; f(y); }", CallExpr, - llvm::make_unique<VerifyIdIsBoundTo<DeclRefExpr>>( + std::make_unique<VerifyIdIsBoundTo<DeclRefExpr>>( "arg"))); EXPECT_TRUE(matchAndVerifyResultTrue( "void f(int i, int j) { int y; f(y, y); }", CallExpr, - llvm::make_unique<VerifyIdIsBoundTo<ParmVarDecl>>("param", 2))); + std::make_unique<VerifyIdIsBoundTo<ParmVarDecl>>("param", 2))); EXPECT_TRUE(matchAndVerifyResultTrue( "void f(int i, int j) { int y; f(y, y); }", CallExpr, - llvm::make_unique<VerifyIdIsBoundTo<DeclRefExpr>>("arg", 2))); + std::make_unique<VerifyIdIsBoundTo<DeclRefExpr>>("arg", 2))); } TEST(ForEachArgumentWithParam, MatchesConstructExpr) { @@ -695,7 +695,7 @@ TEST(ForEachArgumentWithParam, MatchesConstructExpr) { "int y = 0;" "C Obj(y);", ConstructExpr, - llvm::make_unique<VerifyIdIsBoundTo<ParmVarDecl>>("param"))); + std::make_unique<VerifyIdIsBoundTo<ParmVarDecl>>("param"))); } TEST(ForEachArgumentWithParam, HandlesBoundNodesForNonMatches) { @@ -712,7 +712,7 @@ TEST(ForEachArgumentWithParam, HandlesBoundNodesForNonMatches) { forEachDescendant(varDecl().bind("v")), forEachDescendant(callExpr(forEachArgumentWithParam( declRefExpr(to(decl(equalsBoundNode("v")))), parmVarDecl())))), - llvm::make_unique<VerifyIdIsBoundTo<VarDecl>>("v", 4))); + std::make_unique<VerifyIdIsBoundTo<VarDecl>>("v", 4))); } TEST(QualType, hasCanonicalType) { @@ -1817,7 +1817,7 @@ TEST(SwitchCase, MatchesEachCase) { EXPECT_TRUE(matchAndVerifyResultTrue( "void x() { switch (42) { case 1: case 2: case 3: default:; } }", switchStmt(forEachSwitchCase(caseStmt().bind("x"))), - llvm::make_unique<VerifyIdIsBoundTo<CaseStmt>>("x", 3))); + std::make_unique<VerifyIdIsBoundTo<CaseStmt>>("x", 3))); } TEST(Declaration, HasExplicitSpecifier) { @@ -1894,13 +1894,13 @@ TEST(HasConditionVariableStatement, MatchesConditionVariables) { TEST(ForEach, BindsOneNode) { EXPECT_TRUE(matchAndVerifyResultTrue("class C { int x; };", recordDecl(hasName("C"), forEach(fieldDecl(hasName("x")).bind("x"))), - llvm::make_unique<VerifyIdIsBoundTo<FieldDecl>>("x", 1))); + std::make_unique<VerifyIdIsBoundTo<FieldDecl>>("x", 1))); } TEST(ForEach, BindsMultipleNodes) { EXPECT_TRUE(matchAndVerifyResultTrue("class C { int x; int y; int z; };", recordDecl(hasName("C"), forEach(fieldDecl().bind("f"))), - llvm::make_unique<VerifyIdIsBoundTo<FieldDecl>>("f", 3))); + std::make_unique<VerifyIdIsBoundTo<FieldDecl>>("f", 3))); } TEST(ForEach, BindsRecursiveCombinations) { @@ -1908,14 +1908,14 @@ TEST(ForEach, BindsRecursiveCombinations) { "class C { class D { int x; int y; }; class E { int y; int z; }; };", recordDecl(hasName("C"), forEach(recordDecl(forEach(fieldDecl().bind("f"))))), - llvm::make_unique<VerifyIdIsBoundTo<FieldDecl>>("f", 4))); + std::make_unique<VerifyIdIsBoundTo<FieldDecl>>("f", 4))); } TEST(ForEachDescendant, BindsOneNode) { EXPECT_TRUE(matchAndVerifyResultTrue("class C { class D { int x; }; };", recordDecl(hasName("C"), forEachDescendant(fieldDecl(hasName("x")).bind("x"))), - llvm::make_unique<VerifyIdIsBoundTo<FieldDecl>>("x", 1))); + std::make_unique<VerifyIdIsBoundTo<FieldDecl>>("x", 1))); } TEST(ForEachDescendant, NestedForEachDescendant) { @@ -1924,7 +1924,7 @@ TEST(ForEachDescendant, NestedForEachDescendant) { EXPECT_TRUE(matchAndVerifyResultTrue( "class A { class B { class C {}; }; };", recordDecl(hasName("A"), anyOf(m, forEachDescendant(m))), - llvm::make_unique<VerifyIdIsBoundTo<Decl>>("x", "C"))); + std::make_unique<VerifyIdIsBoundTo<Decl>>("x", "C"))); // Check that a partial match of 'm' that binds 'x' in the // first part of anyOf(m, anything()) will not overwrite the @@ -1932,7 +1932,7 @@ TEST(ForEachDescendant, NestedForEachDescendant) { EXPECT_TRUE(matchAndVerifyResultTrue( "class A { class B { class C {}; }; };", recordDecl(hasName("A"), allOf(hasDescendant(m), anyOf(m, anything()))), - llvm::make_unique<VerifyIdIsBoundTo<Decl>>("x", "C"))); + std::make_unique<VerifyIdIsBoundTo<Decl>>("x", "C"))); } TEST(ForEachDescendant, BindsMultipleNodes) { @@ -1940,7 +1940,7 @@ TEST(ForEachDescendant, BindsMultipleNodes) { "class C { class D { int x; int y; }; " " class E { class F { int y; int z; }; }; };", recordDecl(hasName("C"), forEachDescendant(fieldDecl().bind("f"))), - llvm::make_unique<VerifyIdIsBoundTo<FieldDecl>>("f", 4))); + std::make_unique<VerifyIdIsBoundTo<FieldDecl>>("f", 4))); } TEST(ForEachDescendant, BindsRecursiveCombinations) { @@ -1949,7 +1949,7 @@ TEST(ForEachDescendant, BindsRecursiveCombinations) { " class E { class F { class G { int y; int z; }; }; }; }; };", recordDecl(hasName("C"), forEachDescendant(recordDecl( forEachDescendant(fieldDecl().bind("f"))))), - llvm::make_unique<VerifyIdIsBoundTo<FieldDecl>>("f", 8))); + std::make_unique<VerifyIdIsBoundTo<FieldDecl>>("f", 8))); } TEST(ForEachDescendant, BindsCombinations) { @@ -1958,13 +1958,13 @@ TEST(ForEachDescendant, BindsCombinations) { "(true) {} }", compoundStmt(forEachDescendant(ifStmt().bind("if")), forEachDescendant(whileStmt().bind("while"))), - llvm::make_unique<VerifyIdIsBoundTo<IfStmt>>("if", 6))); + std::make_unique<VerifyIdIsBoundTo<IfStmt>>("if", 6))); } TEST(Has, DoesNotDeleteBindings) { EXPECT_TRUE(matchAndVerifyResultTrue( "class X { int a; };", recordDecl(decl().bind("x"), has(fieldDecl())), - llvm::make_unique<VerifyIdIsBoundTo<Decl>>("x", 1))); + std::make_unique<VerifyIdIsBoundTo<Decl>>("x", 1))); } TEST(LoopingMatchers, DoNotOverwritePreviousMatchResultOnFailure) { @@ -1992,100 +1992,100 @@ TEST(LoopingMatchers, DoNotOverwritePreviousMatchResultOnFailure) { recordDecl( recordDecl().bind("x"), hasName("::X"), anyOf(forEachDescendant(recordDecl(hasName("Y"))), anything())), - llvm::make_unique<VerifyIdIsBoundTo<CXXRecordDecl>>("x", 1))); + std::make_unique<VerifyIdIsBoundTo<CXXRecordDecl>>("x", 1))); EXPECT_TRUE(matchAndVerifyResultTrue( "class X {};", recordDecl(recordDecl().bind("x"), hasName("::X"), anyOf(unless(anything()), anything())), - llvm::make_unique<VerifyIdIsBoundTo<CXXRecordDecl>>("x", 1))); + std::make_unique<VerifyIdIsBoundTo<CXXRecordDecl>>("x", 1))); EXPECT_TRUE(matchAndVerifyResultTrue( "template<typename T1, typename T2> class X {}; X<float, int> x;", classTemplateSpecializationDecl( decl().bind("x"), hasAnyTemplateArgument(refersToType(asString("int")))), - llvm::make_unique<VerifyIdIsBoundTo<Decl>>("x", 1))); + std::make_unique<VerifyIdIsBoundTo<Decl>>("x", 1))); EXPECT_TRUE(matchAndVerifyResultTrue( "class X { void f(); void g(); };", cxxRecordDecl(decl().bind("x"), hasMethod(hasName("g"))), - llvm::make_unique<VerifyIdIsBoundTo<Decl>>("x", 1))); + std::make_unique<VerifyIdIsBoundTo<Decl>>("x", 1))); EXPECT_TRUE(matchAndVerifyResultTrue( "class X { X() : a(1), b(2) {} double a; int b; };", recordDecl(decl().bind("x"), has(cxxConstructorDecl( hasAnyConstructorInitializer(forField(hasName("b")))))), - llvm::make_unique<VerifyIdIsBoundTo<Decl>>("x", 1))); + std::make_unique<VerifyIdIsBoundTo<Decl>>("x", 1))); EXPECT_TRUE(matchAndVerifyResultTrue( "void x(int, int) { x(0, 42); }", callExpr(expr().bind("x"), hasAnyArgument(integerLiteral(equals(42)))), - llvm::make_unique<VerifyIdIsBoundTo<Expr>>("x", 1))); + std::make_unique<VerifyIdIsBoundTo<Expr>>("x", 1))); EXPECT_TRUE(matchAndVerifyResultTrue( "void x(int, int y) {}", functionDecl(decl().bind("x"), hasAnyParameter(hasName("y"))), - llvm::make_unique<VerifyIdIsBoundTo<Decl>>("x", 1))); + std::make_unique<VerifyIdIsBoundTo<Decl>>("x", 1))); EXPECT_TRUE(matchAndVerifyResultTrue( "void x() { return; if (true) {} }", functionDecl(decl().bind("x"), has(compoundStmt(hasAnySubstatement(ifStmt())))), - llvm::make_unique<VerifyIdIsBoundTo<Decl>>("x", 1))); + std::make_unique<VerifyIdIsBoundTo<Decl>>("x", 1))); EXPECT_TRUE(matchAndVerifyResultTrue( "namespace X { void b(int); void b(); }" "using X::b;", usingDecl(decl().bind("x"), hasAnyUsingShadowDecl(hasTargetDecl( functionDecl(parameterCountIs(1))))), - llvm::make_unique<VerifyIdIsBoundTo<Decl>>("x", 1))); + std::make_unique<VerifyIdIsBoundTo<Decl>>("x", 1))); EXPECT_TRUE(matchAndVerifyResultTrue( "class A{}; class B{}; class C : B, A {};", cxxRecordDecl(decl().bind("x"), isDerivedFrom("::A")), - llvm::make_unique<VerifyIdIsBoundTo<Decl>>("x", 1))); + std::make_unique<VerifyIdIsBoundTo<Decl>>("x", 1))); EXPECT_TRUE(matchAndVerifyResultTrue( "class A{}; typedef A B; typedef A C; typedef A D;" "class E : A {};", cxxRecordDecl(decl().bind("x"), isDerivedFrom("C")), - llvm::make_unique<VerifyIdIsBoundTo<Decl>>("x", 1))); + std::make_unique<VerifyIdIsBoundTo<Decl>>("x", 1))); EXPECT_TRUE(matchAndVerifyResultTrue( "class A { class B { void f() {} }; };", functionDecl(decl().bind("x"), hasAncestor(recordDecl(hasName("::A")))), - llvm::make_unique<VerifyIdIsBoundTo<Decl>>("x", 1))); + std::make_unique<VerifyIdIsBoundTo<Decl>>("x", 1))); EXPECT_TRUE(matchAndVerifyResultTrue( "template <typename T> struct A { struct B {" " void f() { if(true) {} }" "}; };" "void t() { A<int>::B b; b.f(); }", ifStmt(stmt().bind("x"), hasAncestor(recordDecl(hasName("::A")))), - llvm::make_unique<VerifyIdIsBoundTo<Stmt>>("x", 2))); + std::make_unique<VerifyIdIsBoundTo<Stmt>>("x", 2))); EXPECT_TRUE(matchAndVerifyResultTrue( "class A {};", recordDecl(hasName("::A"), decl().bind("x"), unless(hasName("fooble"))), - llvm::make_unique<VerifyIdIsBoundTo<Decl>>("x", 1))); + std::make_unique<VerifyIdIsBoundTo<Decl>>("x", 1))); EXPECT_TRUE(matchAndVerifyResultTrue( "class A { A() : s(), i(42) {} const char *s; int i; };", cxxConstructorDecl(hasName("::A::A"), decl().bind("x"), forEachConstructorInitializer(forField(hasName("i")))), - llvm::make_unique<VerifyIdIsBoundTo<Decl>>("x", 1))); + std::make_unique<VerifyIdIsBoundTo<Decl>>("x", 1))); } TEST(ForEachDescendant, BindsCorrectNodes) { EXPECT_TRUE(matchAndVerifyResultTrue( "class C { void f(); int i; };", recordDecl(hasName("C"), forEachDescendant(decl().bind("decl"))), - llvm::make_unique<VerifyIdIsBoundTo<FieldDecl>>("decl", 1))); + std::make_unique<VerifyIdIsBoundTo<FieldDecl>>("decl", 1))); EXPECT_TRUE(matchAndVerifyResultTrue( "class C { void f() {} int i; };", recordDecl(hasName("C"), forEachDescendant(decl().bind("decl"))), - llvm::make_unique<VerifyIdIsBoundTo<FunctionDecl>>("decl", 1))); + std::make_unique<VerifyIdIsBoundTo<FunctionDecl>>("decl", 1))); } TEST(FindAll, BindsNodeOnMatch) { EXPECT_TRUE(matchAndVerifyResultTrue( "class A {};", recordDecl(hasName("::A"), findAll(recordDecl(hasName("::A")).bind("v"))), - llvm::make_unique<VerifyIdIsBoundTo<CXXRecordDecl>>("v", 1))); + std::make_unique<VerifyIdIsBoundTo<CXXRecordDecl>>("v", 1))); } TEST(FindAll, BindsDescendantNodeOnMatch) { EXPECT_TRUE(matchAndVerifyResultTrue( "class A { int a; int b; };", recordDecl(hasName("::A"), findAll(fieldDecl().bind("v"))), - llvm::make_unique<VerifyIdIsBoundTo<FieldDecl>>("v", 2))); + std::make_unique<VerifyIdIsBoundTo<FieldDecl>>("v", 2))); } TEST(FindAll, BindsNodeAndDescendantNodesOnOneMatch) { @@ -2094,12 +2094,12 @@ TEST(FindAll, BindsNodeAndDescendantNodesOnOneMatch) { recordDecl(hasName("::A"), findAll(decl(anyOf(recordDecl(hasName("::A")).bind("v"), fieldDecl().bind("v"))))), - llvm::make_unique<VerifyIdIsBoundTo<Decl>>("v", 3))); + std::make_unique<VerifyIdIsBoundTo<Decl>>("v", 3))); EXPECT_TRUE(matchAndVerifyResultTrue( "class A { class B {}; class C {}; };", recordDecl(hasName("::A"), findAll(recordDecl(isDefinition()).bind("v"))), - llvm::make_unique<VerifyIdIsBoundTo<CXXRecordDecl>>("v", 3))); + std::make_unique<VerifyIdIsBoundTo<CXXRecordDecl>>("v", 3))); } TEST(HasAncenstor, MatchesDeclarationAncestors) { @@ -2137,7 +2137,7 @@ TEST(HasAncestor, BindsRecursiveCombinations) { EXPECT_TRUE(matchAndVerifyResultTrue( "class C { class D { class E { class F { int y; }; }; }; };", fieldDecl(hasAncestor(recordDecl(hasAncestor(recordDecl().bind("r"))))), - llvm::make_unique<VerifyIdIsBoundTo<CXXRecordDecl>>("r", 1))); + std::make_unique<VerifyIdIsBoundTo<CXXRecordDecl>>("r", 1))); } TEST(HasAncestor, BindsCombinationsWithHasDescendant) { @@ -2149,7 +2149,7 @@ TEST(HasAncestor, BindsCombinationsWithHasDescendant) { hasAncestor(recordDecl()))) ).bind("d") )), - llvm::make_unique<VerifyIdIsBoundTo<CXXRecordDecl>>("d", "E"))); + std::make_unique<VerifyIdIsBoundTo<CXXRecordDecl>>("d", "E"))); } TEST(HasAncestor, MatchesClosestAncestor) { @@ -2163,7 +2163,7 @@ TEST(HasAncestor, MatchesClosestAncestor) { varDecl(hasName("x"), hasAncestor(functionDecl(hasParameter( 0, varDecl(hasType(asString("int"))))).bind("f"))).bind("v"), - llvm::make_unique<VerifyIdIsBoundTo<FunctionDecl>>("f", "g", 2))); + std::make_unique<VerifyIdIsBoundTo<FunctionDecl>>("f", "g", 2))); } TEST(HasAncestor, MatchesInTemplateInstantiations) { @@ -2300,7 +2300,7 @@ TEST(HasParent, NoDuplicateParents) { EXPECT_FALSE(matchAndVerifyResultTrue( "template <typename T> int Foo() { return 1 + 2; }\n" "int x = Foo<int>() + Foo<unsigned>();", - stmt().bind("node"), llvm::make_unique<HasDuplicateParents>())); + stmt().bind("node"), std::make_unique<HasDuplicateParents>())); } TEST(TypeMatching, PointeeTypes) { @@ -2362,7 +2362,7 @@ TEST(NNS, BindsNestedNameSpecifiers) { EXPECT_TRUE(matchAndVerifyResultTrue( "namespace ns { struct E { struct B {}; }; } ns::E::B b;", nestedNameSpecifier(specifiesType(asString("struct ns::E"))).bind("nns"), - llvm::make_unique<VerifyIdIsBoundTo<NestedNameSpecifier>>( + std::make_unique<VerifyIdIsBoundTo<NestedNameSpecifier>>( "nns", "ns::struct E::"))); } @@ -2370,7 +2370,7 @@ TEST(NNS, BindsNestedNameSpecifierLocs) { EXPECT_TRUE(matchAndVerifyResultTrue( "namespace ns { struct B {}; } ns::B b;", loc(nestedNameSpecifier()).bind("loc"), - llvm::make_unique<VerifyIdIsBoundTo<NestedNameSpecifierLoc>>("loc", 1))); + std::make_unique<VerifyIdIsBoundTo<NestedNameSpecifierLoc>>("loc", 1))); } TEST(NNS, DescendantsOfNestedNameSpecifiers) { @@ -2399,7 +2399,7 @@ TEST(NNS, DescendantsOfNestedNameSpecifiers) { Fragment, nestedNameSpecifier(specifiesType(asString("struct a::A::B")), forEach(nestedNameSpecifier().bind("x"))), - llvm::make_unique<VerifyIdIsBoundTo<NestedNameSpecifier>>("x", 1))); + std::make_unique<VerifyIdIsBoundTo<NestedNameSpecifier>>("x", 1))); } TEST(NNS, NestedNameSpecifiersAsDescendants) { @@ -2415,7 +2415,7 @@ TEST(NNS, NestedNameSpecifiersAsDescendants) { functionDecl(hasName("f"), forEachDescendant(nestedNameSpecifier().bind("x"))), // Nested names: a, a::A and a::A::B. - llvm::make_unique<VerifyIdIsBoundTo<NestedNameSpecifier>>("x", 3))); + std::make_unique<VerifyIdIsBoundTo<NestedNameSpecifier>>("x", 3))); } TEST(NNSLoc, DescendantsOfNestedNameSpecifierLocs) { @@ -2442,7 +2442,7 @@ TEST(NNSLoc, DescendantsOfNestedNameSpecifierLocs) { Fragment, nestedNameSpecifierLoc(loc(specifiesType(asString("struct a::A::B"))), forEach(nestedNameSpecifierLoc().bind("x"))), - llvm::make_unique<VerifyIdIsBoundTo<NestedNameSpecifierLoc>>("x", 1))); + std::make_unique<VerifyIdIsBoundTo<NestedNameSpecifierLoc>>("x", 1))); } TEST(NNSLoc, NestedNameSpecifierLocsAsDescendants) { @@ -2458,7 +2458,7 @@ TEST(NNSLoc, NestedNameSpecifierLocsAsDescendants) { functionDecl(hasName("f"), forEachDescendant(nestedNameSpecifierLoc().bind("x"))), // Nested names: a, a::A and a::A::B. - llvm::make_unique<VerifyIdIsBoundTo<NestedNameSpecifierLoc>>("x", 3))); + std::make_unique<VerifyIdIsBoundTo<NestedNameSpecifierLoc>>("x", 3))); } template <typename T> class VerifyMatchOnNode : public BoundNodesCallback { public: @@ -2483,12 +2483,12 @@ private: TEST(MatchFinder, CanMatchDeclarationsRecursively) { EXPECT_TRUE(matchAndVerifyResultTrue( "class X { class Y {}; };", recordDecl(hasName("::X")).bind("X"), - llvm::make_unique<VerifyMatchOnNode<Decl>>( + std::make_unique<VerifyMatchOnNode<Decl>>( "X", decl(hasDescendant(recordDecl(hasName("X::Y")).bind("Y"))), "Y"))); EXPECT_TRUE(matchAndVerifyResultFalse( "class X { class Y {}; };", recordDecl(hasName("::X")).bind("X"), - llvm::make_unique<VerifyMatchOnNode<Decl>>( + std::make_unique<VerifyMatchOnNode<Decl>>( "X", decl(hasDescendant(recordDecl(hasName("X::Z")).bind("Z"))), "Z"))); } @@ -2496,22 +2496,22 @@ TEST(MatchFinder, CanMatchDeclarationsRecursively) { TEST(MatchFinder, CanMatchStatementsRecursively) { EXPECT_TRUE(matchAndVerifyResultTrue( "void f() { if (1) { for (;;) { } } }", ifStmt().bind("if"), - llvm::make_unique<VerifyMatchOnNode<Stmt>>( + std::make_unique<VerifyMatchOnNode<Stmt>>( "if", stmt(hasDescendant(forStmt().bind("for"))), "for"))); EXPECT_TRUE(matchAndVerifyResultFalse( "void f() { if (1) { for (;;) { } } }", ifStmt().bind("if"), - llvm::make_unique<VerifyMatchOnNode<Stmt>>( + std::make_unique<VerifyMatchOnNode<Stmt>>( "if", stmt(hasDescendant(declStmt().bind("decl"))), "decl"))); } TEST(MatchFinder, CanMatchSingleNodesRecursively) { EXPECT_TRUE(matchAndVerifyResultTrue( "class X { class Y {}; };", recordDecl(hasName("::X")).bind("X"), - llvm::make_unique<VerifyMatchOnNode<Decl>>( + std::make_unique<VerifyMatchOnNode<Decl>>( "X", recordDecl(has(recordDecl(hasName("X::Y")).bind("Y"))), "Y"))); EXPECT_TRUE(matchAndVerifyResultFalse( "class X { class Y {}; };", recordDecl(hasName("::X")).bind("X"), - llvm::make_unique<VerifyMatchOnNode<Decl>>( + std::make_unique<VerifyMatchOnNode<Decl>>( "X", recordDecl(has(recordDecl(hasName("X::Z")).bind("Z"))), "Z"))); } @@ -2569,18 +2569,18 @@ TEST(Matcher, ForEachOverriden) { // C::f overrides A::f. EXPECT_TRUE(matchAndVerifyResultTrue( Code1, ForEachOverriddenInClass("C"), - llvm::make_unique<VerifyIdIsBoundTo<CXXMethodDecl>>("override", "f", 1))); + std::make_unique<VerifyIdIsBoundTo<CXXMethodDecl>>("override", "f", 1))); EXPECT_TRUE(matchAndVerifyResultTrue( Code1, ForEachOverriddenInClass("C"), - llvm::make_unique<VerifyIdIsBoundTo<CXXMethodDecl>>("overridden", "f", + std::make_unique<VerifyIdIsBoundTo<CXXMethodDecl>>("overridden", "f", 1))); // B::f overrides A::f. EXPECT_TRUE(matchAndVerifyResultTrue( Code1, ForEachOverriddenInClass("B"), - llvm::make_unique<VerifyIdIsBoundTo<CXXMethodDecl>>("override", "f", 1))); + std::make_unique<VerifyIdIsBoundTo<CXXMethodDecl>>("override", "f", 1))); EXPECT_TRUE(matchAndVerifyResultTrue( Code1, ForEachOverriddenInClass("B"), - llvm::make_unique<VerifyIdIsBoundTo<CXXMethodDecl>>("overridden", "f", + std::make_unique<VerifyIdIsBoundTo<CXXMethodDecl>>("overridden", "f", 1))); // A::f overrides nothing. EXPECT_TRUE(notMatches(Code1, ForEachOverriddenInClass("A"))); @@ -2592,10 +2592,10 @@ TEST(Matcher, ForEachOverriden) { // B::f overrides A1::f and A2::f. This produces two matches. EXPECT_TRUE(matchAndVerifyResultTrue( Code2, ForEachOverriddenInClass("B"), - llvm::make_unique<VerifyIdIsBoundTo<CXXMethodDecl>>("override", "f", 2))); + std::make_unique<VerifyIdIsBoundTo<CXXMethodDecl>>("override", "f", 2))); EXPECT_TRUE(matchAndVerifyResultTrue( Code2, ForEachOverriddenInClass("B"), - llvm::make_unique<VerifyIdIsBoundTo<CXXMethodDecl>>("overridden", "f", + std::make_unique<VerifyIdIsBoundTo<CXXMethodDecl>>("overridden", "f", 2))); // A1::f overrides nothing. EXPECT_TRUE(notMatches(Code2, ForEachOverriddenInClass("A1"))); diff --git a/clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp b/clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp index aba094c..db16ca4 100644 --- a/clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp +++ b/clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp @@ -388,10 +388,10 @@ TEST(ParserTest, ParseBindOnLet) { EXPECT_TRUE(matchAndVerifyResultTrue( "void foo(int a);", M, - llvm::make_unique<VerifyIdIsBoundTo<FunctionDecl>>("parmABinding"))); + std::make_unique<VerifyIdIsBoundTo<FunctionDecl>>("parmABinding"))); EXPECT_TRUE(matchAndVerifyResultFalse( "void foo(int b);", M, - llvm::make_unique<VerifyIdIsBoundTo<FunctionDecl>>("parmABinding"))); + std::make_unique<VerifyIdIsBoundTo<FunctionDecl>>("parmABinding"))); } { @@ -404,10 +404,10 @@ TEST(ParserTest, ParseBindOnLet) { EXPECT_TRUE(matchAndVerifyResultTrue( "void foo(int a);", M, - llvm::make_unique<VerifyIdIsBoundTo<FunctionDecl>>("parmABinding"))); + std::make_unique<VerifyIdIsBoundTo<FunctionDecl>>("parmABinding"))); EXPECT_TRUE(matchAndVerifyResultFalse( "void foo(int b);", M, - llvm::make_unique<VerifyIdIsBoundTo<FunctionDecl>>("parmABinding"))); + std::make_unique<VerifyIdIsBoundTo<FunctionDecl>>("parmABinding"))); } } diff --git a/clang/unittests/Basic/FileManagerTest.cpp b/clang/unittests/Basic/FileManagerTest.cpp index 97b525e..c55403a 100644 --- a/clang/unittests/Basic/FileManagerTest.cpp +++ b/clang/unittests/Basic/FileManagerTest.cpp @@ -110,7 +110,7 @@ TEST_F(FileManagerTest, NoVirtualDirectoryExistsBeforeAVirtualFileIsAdded) { // FileManager to report "file/directory doesn't exist". This // avoids the possibility of the result of this test being affected // by what's in the real file system. - manager.setStatCache(llvm::make_unique<FakeStatCache>()); + manager.setStatCache(std::make_unique<FakeStatCache>()); ASSERT_FALSE(manager.getDirectory("virtual/dir/foo")); ASSERT_FALSE(manager.getDirectory("virtual/dir")); @@ -120,7 +120,7 @@ TEST_F(FileManagerTest, NoVirtualDirectoryExistsBeforeAVirtualFileIsAdded) { // When a virtual file is added, all of its ancestors should be created. TEST_F(FileManagerTest, getVirtualFileCreatesDirectoryEntriesForAncestors) { // Fake an empty real file system. - manager.setStatCache(llvm::make_unique<FakeStatCache>()); + manager.setStatCache(std::make_unique<FakeStatCache>()); manager.getVirtualFile("virtual/dir/bar.h", 100, 0); ASSERT_FALSE(manager.getDirectory("virtual/dir/foo")); @@ -137,7 +137,7 @@ TEST_F(FileManagerTest, getVirtualFileCreatesDirectoryEntriesForAncestors) { // getFile() returns non-NULL if a real file exists at the given path. TEST_F(FileManagerTest, getFileReturnsValidFileEntryForExistingRealFile) { // Inject fake files into the file system. - auto statCache = llvm::make_unique<FakeStatCache>(); + auto statCache = std::make_unique<FakeStatCache>(); statCache->InjectDirectory("/tmp", 42); statCache->InjectFile("/tmp/test", 43); @@ -172,7 +172,7 @@ TEST_F(FileManagerTest, getFileReturnsValidFileEntryForExistingRealFile) { // getFile() returns non-NULL if a virtual file exists at the given path. TEST_F(FileManagerTest, getFileReturnsValidFileEntryForExistingVirtualFile) { // Fake an empty real file system. - manager.setStatCache(llvm::make_unique<FakeStatCache>()); + manager.setStatCache(std::make_unique<FakeStatCache>()); manager.getVirtualFile("virtual/dir/bar.h", 100, 0); auto file = manager.getFile("virtual/dir/bar.h"); @@ -190,7 +190,7 @@ TEST_F(FileManagerTest, getFileReturnsValidFileEntryForExistingVirtualFile) { TEST_F(FileManagerTest, getFileReturnsDifferentFileEntriesForDifferentFiles) { // Inject two fake files into the file system. Different inodes // mean the files are not symlinked together. - auto statCache = llvm::make_unique<FakeStatCache>(); + auto statCache = std::make_unique<FakeStatCache>(); statCache->InjectDirectory(".", 41); statCache->InjectFile("foo.cpp", 42); statCache->InjectFile("bar.cpp", 43); @@ -209,7 +209,7 @@ TEST_F(FileManagerTest, getFileReturnsDifferentFileEntriesForDifferentFiles) { // exists at the given path. TEST_F(FileManagerTest, getFileReturnsErrorForNonexistentFile) { // Inject a fake foo.cpp into the file system. - auto statCache = llvm::make_unique<FakeStatCache>(); + auto statCache = std::make_unique<FakeStatCache>(); statCache->InjectDirectory(".", 41); statCache->InjectFile("foo.cpp", 42); statCache->InjectDirectory("MyDirectory", 49); @@ -238,7 +238,7 @@ TEST_F(FileManagerTest, getFileReturnsErrorForNonexistentFile) { // getFile() returns the same FileEntry for real files that are aliases. TEST_F(FileManagerTest, getFileReturnsSameFileEntryForAliasedRealFiles) { // Inject two real files with the same inode. - auto statCache = llvm::make_unique<FakeStatCache>(); + auto statCache = std::make_unique<FakeStatCache>(); statCache->InjectDirectory("abc", 41); statCache->InjectFile("abc/foo.cpp", 42); statCache->InjectFile("abc/bar.cpp", 42); @@ -255,7 +255,7 @@ TEST_F(FileManagerTest, getFileReturnsSameFileEntryForAliasedRealFiles) { // corresponding real files that are aliases. TEST_F(FileManagerTest, getFileReturnsSameFileEntryForAliasedVirtualFiles) { // Inject two real files with the same inode. - auto statCache = llvm::make_unique<FakeStatCache>(); + auto statCache = std::make_unique<FakeStatCache>(); statCache->InjectDirectory("abc", 41); statCache->InjectFile("abc/foo.cpp", 42); statCache->InjectFile("abc/bar.cpp", 42); @@ -277,7 +277,7 @@ TEST_F(FileManagerTest, getFileReturnsSameFileEntryForAliasedVirtualFiles) { // here by checking the size. TEST_F(FileManagerTest, getVirtualFileWithDifferentName) { // Inject fake files into the file system. - auto statCache = llvm::make_unique<FakeStatCache>(); + auto statCache = std::make_unique<FakeStatCache>(); statCache->InjectDirectory("c:\\tmp", 42); statCache->InjectFile("c:\\tmp\\test", 43); @@ -348,7 +348,7 @@ TEST_F(FileManagerTest, getVirtualFileFillsRealPathName) { FileManager Manager(Opts, FS); // Inject fake files into the file system. - auto statCache = llvm::make_unique<FakeStatCache>(); + auto statCache = std::make_unique<FakeStatCache>(); statCache->InjectDirectory("/tmp", 42); statCache->InjectFile("/tmp/test", 43); @@ -381,7 +381,7 @@ TEST_F(FileManagerTest, getFileDontOpenRealPath) { FileManager Manager(Opts, FS); // Inject fake files into the file system. - auto statCache = llvm::make_unique<FakeStatCache>(); + auto statCache = std::make_unique<FakeStatCache>(); statCache->InjectDirectory("/tmp", 42); statCache->InjectFile("/tmp/test", 43); diff --git a/clang/unittests/Basic/SourceManagerTest.cpp b/clang/unittests/Basic/SourceManagerTest.cpp index ff8a364..bc7031e 100644 --- a/clang/unittests/Basic/SourceManagerTest.cpp +++ b/clang/unittests/Basic/SourceManagerTest.cpp @@ -354,7 +354,7 @@ TEST_F(SourceManagerTest, isBeforeInTranslationUnitWithMacroInInclude) { PP.Initialize(*Target); std::vector<MacroAction> Macros; - PP.addPPCallbacks(llvm::make_unique<MacroTracker>(Macros)); + PP.addPPCallbacks(std::make_unique<MacroTracker>(Macros)); PP.EnterMainSourceFile(); diff --git a/clang/unittests/CrossTU/CrossTranslationUnitTest.cpp b/clang/unittests/CrossTU/CrossTranslationUnitTest.cpp index b4f22d5..3cea339 100644 --- a/clang/unittests/CrossTU/CrossTranslationUnitTest.cpp +++ b/clang/unittests/CrossTU/CrossTranslationUnitTest.cpp @@ -122,7 +122,7 @@ protected: std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(clang::CompilerInstance &CI, StringRef) override { CI.getAnalyzerOpts()->CTUImportThreshold = OverrideLimit; - return llvm::make_unique<CTUASTConsumer>(CI, Success); + return std::make_unique<CTUASTConsumer>(CI, Success); } private: diff --git a/clang/unittests/Frontend/ASTUnitTest.cpp b/clang/unittests/Frontend/ASTUnitTest.cpp index 9232b7b..5cb2087 100644 --- a/clang/unittests/Frontend/ASTUnitTest.cpp +++ b/clang/unittests/Frontend/ASTUnitTest.cpp @@ -34,7 +34,7 @@ protected: std::unique_ptr<ASTUnit> createASTUnit(bool isVolatile) { EXPECT_FALSE(llvm::sys::fs::createTemporaryFile("ast-unit", "cpp", FD, InputFileName)); - input_file = llvm::make_unique<ToolOutputFile>(InputFileName, FD); + input_file = std::make_unique<ToolOutputFile>(InputFileName, FD); input_file->os() << ""; const char *Args[] = {"clang", "-xc++", InputFileName.c_str()}; diff --git a/clang/unittests/Frontend/CompilerInstanceTest.cpp b/clang/unittests/Frontend/CompilerInstanceTest.cpp index 4935853..d2377d0 100644 --- a/clang/unittests/Frontend/CompilerInstanceTest.cpp +++ b/clang/unittests/Frontend/CompilerInstanceTest.cpp @@ -81,7 +81,7 @@ TEST(CompilerInstance, AllowDiagnosticLogWithUnownedDiagnosticConsumer) { // Create the diagnostic engine with unowned consumer. std::string DiagnosticOutput; llvm::raw_string_ostream DiagnosticsOS(DiagnosticOutput); - auto DiagPrinter = llvm::make_unique<TextDiagnosticPrinter>( + auto DiagPrinter = std::make_unique<TextDiagnosticPrinter>( DiagnosticsOS, new DiagnosticOptions()); CompilerInstance Instance; IntrusiveRefCntPtr<DiagnosticsEngine> Diags = Instance.createDiagnostics( diff --git a/clang/unittests/Frontend/FrontendActionTest.cpp b/clang/unittests/Frontend/FrontendActionTest.cpp index 082d2f6..95be040 100644 --- a/clang/unittests/Frontend/FrontendActionTest.cpp +++ b/clang/unittests/Frontend/FrontendActionTest.cpp @@ -48,7 +48,7 @@ public: std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override { - return llvm::make_unique<Visitor>(CI, ActOnEndOfTranslationUnit, + return std::make_unique<Visitor>(CI, ActOnEndOfTranslationUnit, decl_names); } diff --git a/clang/unittests/Index/IndexTests.cpp b/clang/unittests/Index/IndexTests.cpp index bbd5db3..bf0418c 100644 --- a/clang/unittests/Index/IndexTests.cpp +++ b/clang/unittests/Index/IndexTests.cpp @@ -134,7 +134,7 @@ protected: indexTopLevelDecls(Ctx, *PP, DeclsToIndex, *Index, Opts); } }; - return llvm::make_unique<Consumer>(Index, CI.getPreprocessorPtr(), Opts); + return std::make_unique<Consumer>(Index, CI.getPreprocessorPtr(), Opts); } private: diff --git a/clang/unittests/Lex/LexerTest.cpp b/clang/unittests/Lex/LexerTest.cpp index 29eea42..2295a90 100644 --- a/clang/unittests/Lex/LexerTest.cpp +++ b/clang/unittests/Lex/LexerTest.cpp @@ -49,7 +49,7 @@ protected: HeaderSearch HeaderInfo(std::make_shared<HeaderSearchOptions>(), SourceMgr, Diags, LangOpts, Target.get()); - std::unique_ptr<Preprocessor> PP = llvm::make_unique<Preprocessor>( + std::unique_ptr<Preprocessor> PP = std::make_unique<Preprocessor>( std::make_shared<PreprocessorOptions>(), Diags, LangOpts, SourceMgr, HeaderInfo, ModLoader, /*IILookup =*/nullptr, diff --git a/clang/unittests/Sema/CodeCompleteTest.cpp b/clang/unittests/Sema/CodeCompleteTest.cpp index 1d0e732..dc0f7e0 100644 --- a/clang/unittests/Sema/CodeCompleteTest.cpp +++ b/clang/unittests/Sema/CodeCompleteTest.cpp @@ -101,7 +101,7 @@ ParsedSourceLocation offsetToPosition(llvm::StringRef Code, size_t Offset) { CompletionContext runCompletion(StringRef Code, size_t Offset) { CompletionContext ResultCtx; - auto Action = llvm::make_unique<CodeCompleteAction>( + auto Action = std::make_unique<CodeCompleteAction>( offsetToPosition(Code, Offset), ResultCtx); clang::tooling::runToolOnCodeWithArgs(Action.release(), Code, {"-std=c++11"}, TestCCName); diff --git a/clang/unittests/Sema/ExternalSemaSourceTest.cpp b/clang/unittests/Sema/ExternalSemaSourceTest.cpp index c591ccb..edf91c9 100644 --- a/clang/unittests/Sema/ExternalSemaSourceTest.cpp +++ b/clang/unittests/Sema/ExternalSemaSourceTest.cpp @@ -187,7 +187,7 @@ protected: std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(clang::CompilerInstance &Compiler, llvm::StringRef /* dummy */) override { - return llvm::make_unique<clang::ASTConsumer>(); + return std::make_unique<clang::ASTConsumer>(); } void ExecuteAction() override { diff --git a/clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp b/clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp index 9201922..86cd6a4 100644 --- a/clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp +++ b/clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp @@ -93,7 +93,7 @@ public: std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &Compiler, StringRef File) override { - return llvm::make_unique<CallDescriptionConsumer>(Compiler, RM); + return std::make_unique<CallDescriptionConsumer>(Compiler, RM); } }; diff --git a/clang/unittests/StaticAnalyzer/StoreTest.cpp b/clang/unittests/StaticAnalyzer/StoreTest.cpp index ab8c781..0cbe7d4 100644 --- a/clang/unittests/StaticAnalyzer/StoreTest.cpp +++ b/clang/unittests/StaticAnalyzer/StoreTest.cpp @@ -91,7 +91,7 @@ class VariableBindAction : public ASTFrontendAction { public: std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &Compiler, StringRef File) override { - return llvm::make_unique<VariableBindConsumer>(Compiler); + return std::make_unique<VariableBindConsumer>(Compiler); } }; diff --git a/clang/unittests/StaticAnalyzer/SymbolReaperTest.cpp b/clang/unittests/StaticAnalyzer/SymbolReaperTest.cpp index 5d9af319..bd11303 100644 --- a/clang/unittests/StaticAnalyzer/SymbolReaperTest.cpp +++ b/clang/unittests/StaticAnalyzer/SymbolReaperTest.cpp @@ -55,7 +55,7 @@ public: SuperRegionLivenessAction() {} std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &Compiler, StringRef File) override { - return llvm::make_unique<SuperRegionLivenessConsumer>(Compiler); + return std::make_unique<SuperRegionLivenessConsumer>(Compiler); } }; diff --git a/clang/unittests/Tooling/CompilationDatabaseTest.cpp b/clang/unittests/Tooling/CompilationDatabaseTest.cpp index fde9544..6189071 100644 --- a/clang/unittests/Tooling/CompilationDatabaseTest.cpp +++ b/clang/unittests/Tooling/CompilationDatabaseTest.cpp @@ -696,7 +696,7 @@ protected: // The input file is not included in the returned command. std::string getCommand(llvm::StringRef F) { auto Results = - inferMissingCompileCommands(llvm::make_unique<MemCDB>(Entries)) + inferMissingCompileCommands(std::make_unique<MemCDB>(Entries)) ->getCompileCommands(path(F)); if (Results.empty()) return "none"; @@ -710,7 +710,7 @@ protected: // Parse the file whose command was used out of the Heuristic string. std::string getProxy(llvm::StringRef F) { auto Results = - inferMissingCompileCommands(llvm::make_unique<MemCDB>(Entries)) + inferMissingCompileCommands(std::make_unique<MemCDB>(Entries)) ->getCompileCommands(path(F)); if (Results.empty()) return "none"; @@ -843,7 +843,7 @@ public: protected: // Look up the command from a relative path, and return it in string form. std::string getCommand(llvm::StringRef F) { - auto Results = inferTargetAndDriverMode(llvm::make_unique<MemCDB>(Entries)) + auto Results = inferTargetAndDriverMode(std::make_unique<MemCDB>(Entries)) ->getCompileCommands(path(F)); if (Results.empty()) return "none"; diff --git a/clang/unittests/Tooling/ExecutionTest.cpp b/clang/unittests/Tooling/ExecutionTest.cpp index 6c2c91c..3e1e51e 100644 --- a/clang/unittests/Tooling/ExecutionTest.cpp +++ b/clang/unittests/Tooling/ExecutionTest.cpp @@ -125,7 +125,7 @@ class TestToolExecutorPlugin : public ToolExecutorPlugin { public: llvm::Expected<std::unique_ptr<ToolExecutor>> create(CommonOptionsParser &OptionsParser) override { - return llvm::make_unique<TestToolExecutor>(std::move(OptionsParser)); + return std::make_unique<TestToolExecutor>(std::move(OptionsParser)); } }; diff --git a/clang/unittests/Tooling/RefactoringTest.cpp b/clang/unittests/Tooling/RefactoringTest.cpp index b04c9a9..b5c56e90 100644 --- a/clang/unittests/Tooling/RefactoringTest.cpp +++ b/clang/unittests/Tooling/RefactoringTest.cpp @@ -680,7 +680,7 @@ private: Visitor->SM = &compiler.getSourceManager(); Visitor->Context = &compiler.getASTContext(); /// TestConsumer will be deleted by the framework calling us. - return llvm::make_unique<FindConsumer>(Visitor); + return std::make_unique<FindConsumer>(Visitor); } private: diff --git a/clang/unittests/Tooling/Syntax/TokensTest.cpp b/clang/unittests/Tooling/Syntax/TokensTest.cpp index a1398bd..78f0d2f 100644 --- a/clang/unittests/Tooling/Syntax/TokensTest.cpp +++ b/clang/unittests/Tooling/Syntax/TokensTest.cpp @@ -106,7 +106,7 @@ public: std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override { - return llvm::make_unique<ASTConsumer>(); + return std::make_unique<ASTConsumer>(); } private: diff --git a/clang/unittests/Tooling/Syntax/TreeTest.cpp b/clang/unittests/Tooling/Syntax/TreeTest.cpp index e83d2b72..c88a112 100644 --- a/clang/unittests/Tooling/Syntax/TreeTest.cpp +++ b/clang/unittests/Tooling/Syntax/TreeTest.cpp @@ -40,7 +40,7 @@ protected: } void HandleTranslationUnit(ASTContext &Ctx) override { - Arena = llvm::make_unique<syntax::Arena>(Ctx.getSourceManager(), + Arena = std::make_unique<syntax::Arena>(Ctx.getSourceManager(), Ctx.getLangOpts(), std::move(*Tokens).consume()); Tokens = nullptr; // make sure we fail if this gets called twice. @@ -63,8 +63,8 @@ protected: CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override { // We start recording the tokens, ast consumer will take on the result. auto Tokens = - llvm::make_unique<syntax::TokenCollector>(CI.getPreprocessor()); - return llvm::make_unique<BuildSyntaxTree>(Root, Arena, + std::make_unique<syntax::TokenCollector>(CI.getPreprocessor()); + return std::make_unique<BuildSyntaxTree>(Root, Arena, std::move(Tokens)); } diff --git a/clang/unittests/Tooling/TestVisitor.h b/clang/unittests/Tooling/TestVisitor.h index ff90a77..95252b8 100644 --- a/clang/unittests/Tooling/TestVisitor.h +++ b/clang/unittests/Tooling/TestVisitor.h @@ -109,7 +109,7 @@ protected: std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(CompilerInstance &, llvm::StringRef dummy) override { /// TestConsumer will be deleted by the framework calling us. - return llvm::make_unique<FindConsumer>(Visitor); + return std::make_unique<FindConsumer>(Visitor); } protected: diff --git a/clang/unittests/Tooling/ToolingTest.cpp b/clang/unittests/Tooling/ToolingTest.cpp index f9f4de3..447b997 100644 --- a/clang/unittests/Tooling/ToolingTest.cpp +++ b/clang/unittests/Tooling/ToolingTest.cpp @@ -63,7 +63,7 @@ class FindTopLevelDeclConsumer : public clang::ASTConsumer { TEST(runToolOnCode, FindsNoTopLevelDeclOnEmptyCode) { bool FoundTopLevelDecl = false; EXPECT_TRUE( - runToolOnCode(new TestAction(llvm::make_unique<FindTopLevelDeclConsumer>( + runToolOnCode(new TestAction(std::make_unique<FindTopLevelDeclConsumer>( &FoundTopLevelDecl)), "")); EXPECT_FALSE(FoundTopLevelDecl); @@ -103,14 +103,14 @@ bool FindClassDeclX(ASTUnit *AST) { TEST(runToolOnCode, FindsClassDecl) { bool FoundClassDeclX = false; EXPECT_TRUE( - runToolOnCode(new TestAction(llvm::make_unique<FindClassDeclXConsumer>( + runToolOnCode(new TestAction(std::make_unique<FindClassDeclXConsumer>( &FoundClassDeclX)), "class X;")); EXPECT_TRUE(FoundClassDeclX); FoundClassDeclX = false; EXPECT_TRUE( - runToolOnCode(new TestAction(llvm::make_unique<FindClassDeclXConsumer>( + runToolOnCode(new TestAction(std::make_unique<FindClassDeclXConsumer>( &FoundClassDeclX)), "class Y;")); EXPECT_FALSE(FoundClassDeclX); @@ -135,7 +135,7 @@ TEST(newFrontendActionFactory, CreatesFrontendActionFactoryFromType) { struct IndependentFrontendActionCreator { std::unique_ptr<ASTConsumer> newASTConsumer() { - return llvm::make_unique<FindTopLevelDeclConsumer>(nullptr); + return std::make_unique<FindTopLevelDeclConsumer>(nullptr); } }; @@ -207,7 +207,7 @@ struct VerifyEndCallback : public SourceFileCallbacks { } void handleEndSource() override { ++EndCalled; } std::unique_ptr<ASTConsumer> newASTConsumer() { - return llvm::make_unique<FindTopLevelDeclConsumer>(&Matched); + return std::make_unique<FindTopLevelDeclConsumer>(&Matched); } unsigned BeginCalled; unsigned EndCalled; @@ -249,7 +249,7 @@ struct SkipBodyAction : public clang::ASTFrontendAction { std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &Compiler, StringRef) override { Compiler.getFrontendOpts().SkipFunctionBodies = true; - return llvm::make_unique<SkipBodyConsumer>(); + return std::make_unique<SkipBodyConsumer>(); } }; @@ -340,7 +340,7 @@ struct CheckColoredDiagnosticsAction : public clang::ASTFrontendAction { Compiler.getDiagnostics().getCustomDiagID( DiagnosticsEngine::Fatal, "getDiagnosticOpts().ShowColors != ShouldShowColor")); - return llvm::make_unique<ASTConsumer>(); + return std::make_unique<ASTConsumer>(); } private: @@ -651,7 +651,7 @@ TEST(runToolOnCode, TestResetDiagnostics) { return true; } }; - return llvm::make_unique<Consumer>(); + return std::make_unique<Consumer>(); } }; |