diff options
Diffstat (limited to 'unittests/StaticAnalyzer')
-rw-r--r-- | unittests/StaticAnalyzer/CallDescriptionTest.cpp | 24 | ||||
-rw-r--r-- | unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp | 3 | ||||
-rw-r--r-- | unittests/StaticAnalyzer/StoreTest.cpp | 4 | ||||
-rw-r--r-- | unittests/StaticAnalyzer/SymbolReaperTest.cpp | 5 |
4 files changed, 19 insertions, 17 deletions
diff --git a/unittests/StaticAnalyzer/CallDescriptionTest.cpp b/unittests/StaticAnalyzer/CallDescriptionTest.cpp index 86cd6a40f0..2ebaa46b0f 100644 --- a/unittests/StaticAnalyzer/CallDescriptionTest.cpp +++ b/unittests/StaticAnalyzer/CallDescriptionTest.cpp @@ -100,30 +100,30 @@ public: TEST(CallEvent, CallDescription) { // Test simple name matching. EXPECT_TRUE(tooling::runToolOnCode( - new CallDescriptionAction({ + std::unique_ptr<CallDescriptionAction>(new CallDescriptionAction({ {{"bar"}, false}, // false: there's no call to 'bar' in this code. {{"foo"}, true}, // true: there's a call to 'foo' in this code. - }), "void foo(); void bar() { foo(); }")); + })), "void foo(); void bar() { foo(); }")); // Test arguments check. EXPECT_TRUE(tooling::runToolOnCode( - new CallDescriptionAction({ + std::unique_ptr<CallDescriptionAction>(new CallDescriptionAction({ {{"foo", 1}, true}, {{"foo", 2}, false}, - }), "void foo(int); void foo(int, int); void bar() { foo(1); }")); + })), "void foo(int); void foo(int, int); void bar() { foo(1); }")); // Test lack of arguments check. EXPECT_TRUE(tooling::runToolOnCode( - new CallDescriptionAction({ + std::unique_ptr<CallDescriptionAction>(new CallDescriptionAction({ {{"foo", None}, true}, {{"foo", 2}, false}, - }), "void foo(int); void foo(int, int); void bar() { foo(1); }")); + })), "void foo(int); void foo(int, int); void bar() { foo(1); }")); // Test qualified names. EXPECT_TRUE(tooling::runToolOnCode( - new CallDescriptionAction({ + std::unique_ptr<CallDescriptionAction>(new CallDescriptionAction({ {{{"std", "basic_string", "c_str"}}, true}, - }), + })), "namespace std { inline namespace __1 {" " template<typename T> class basic_string {" " public:" @@ -138,18 +138,18 @@ TEST(CallEvent, CallDescription) { // A negative test for qualified names. EXPECT_TRUE(tooling::runToolOnCode( - new CallDescriptionAction({ + std::unique_ptr<CallDescriptionAction>(new CallDescriptionAction({ {{{"foo", "bar"}}, false}, {{{"bar", "foo"}}, false}, {{"foo"}, true}, - }), "void foo(); struct bar { void foo(); }; void test() { foo(); }")); + })), "void foo(); struct bar { void foo(); }; void test() { foo(); }")); // Test CDF_MaybeBuiltin - a flag that allows matching weird builtins. EXPECT_TRUE(tooling::runToolOnCode( - new CallDescriptionAction({ + std::unique_ptr<CallDescriptionAction>(new CallDescriptionAction({ {{"memset", 3}, false}, {{CDF_MaybeBuiltin, "memset", 3}, true} - }), + })), "void foo() {" " int x;" " __builtin___memset_chk(&x, 0, sizeof(x)," diff --git a/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp b/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp index 109e762892..4773852866 100644 --- a/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp +++ b/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp @@ -58,7 +58,8 @@ public: template <typename CheckerT> bool runCheckerOnCode(const std::string &Code, std::string &Diags) { llvm::raw_string_ostream OS(Diags); - return tooling::runToolOnCode(new TestAction<CheckerT>(OS), Code); + return tooling::runToolOnCode(std::make_unique<TestAction<CheckerT>>(OS), + Code); } template <typename CheckerT> bool runCheckerOnCode(const std::string &Code) { diff --git a/unittests/StaticAnalyzer/StoreTest.cpp b/unittests/StaticAnalyzer/StoreTest.cpp index 0cbe7d4793..c8b930bf32 100644 --- a/unittests/StaticAnalyzer/StoreTest.cpp +++ b/unittests/StaticAnalyzer/StoreTest.cpp @@ -96,8 +96,8 @@ public: }; TEST(Store, VariableBind) { - EXPECT_TRUE(tooling::runToolOnCode( - new VariableBindAction, "void foo() { int x0, y0, z0, x1, y1; }")); + EXPECT_TRUE(tooling::runToolOnCode(std::make_unique<VariableBindAction>(), + "void foo() { int x0, y0, z0, x1, y1; }")); } } // namespace diff --git a/unittests/StaticAnalyzer/SymbolReaperTest.cpp b/unittests/StaticAnalyzer/SymbolReaperTest.cpp index bd11303e94..bbbf68851a 100644 --- a/unittests/StaticAnalyzer/SymbolReaperTest.cpp +++ b/unittests/StaticAnalyzer/SymbolReaperTest.cpp @@ -61,8 +61,9 @@ public: // Test that marking s.x as live would also make s live. TEST(SymbolReaper, SuperRegionLiveness) { - EXPECT_TRUE(tooling::runToolOnCode(new SuperRegionLivenessAction, - "void foo() { struct S { int x; } s; }")); + EXPECT_TRUE( + tooling::runToolOnCode(std::make_unique<SuperRegionLivenessAction>(), + "void foo() { struct S { int x; } s; }")); } } // namespace |