From: Shuai Wang Date: Wed, 19 Sep 2018 20:27:25 +0000 (+0000) Subject: [NFC] Declare instead of define non-void functions in unit tests. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bd0e6da3a7e59c3e5948b5717b2d4a569851dd78;p=clang [NFC] Declare instead of define non-void functions in unit tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342586 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/unittests/Analysis/ExprMutationAnalyzerTest.cpp b/unittests/Analysis/ExprMutationAnalyzerTest.cpp index 8823ac803e..9c6bc783b3 100644 --- a/unittests/Analysis/ExprMutationAnalyzerTest.cpp +++ b/unittests/Analysis/ExprMutationAnalyzerTest.cpp @@ -203,7 +203,7 @@ TEST(ExprMutationAnalyzerTest, ByValueArgument) { EXPECT_FALSE(isMutated(Results, AST.get())); AST = buildASTFromCode( - "struct A {}; A operator+(A, int) {} void f() { A x; x + 1; }"); + "struct A {}; A operator+(A, int); void f() { A x; x + 1; }"); Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext()); EXPECT_FALSE(isMutated(Results, AST.get())); @@ -239,7 +239,7 @@ TEST(ExprMutationAnalyzerTest, ByConstValueArgument) { EXPECT_FALSE(isMutated(Results, AST.get())); AST = buildASTFromCode( - "struct A {}; A operator+(const A, int) {} void f() { A x; x + 1; }"); + "struct A {}; A operator+(const A, int); void f() { A x; x + 1; }"); Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext()); EXPECT_FALSE(isMutated(Results, AST.get())); @@ -289,7 +289,7 @@ TEST(ExprMutationAnalyzerTest, ByNonConstRefArgument) { EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("g(x)")); AST = buildASTFromCode( - "struct A {}; A operator+(A&, int) {} void f() { A x; x + 1; }"); + "struct A {}; A operator+(A&, int); void f() { A x; x + 1; }"); Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext()); EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x + 1")); @@ -333,7 +333,7 @@ TEST(ExprMutationAnalyzerTest, ByConstRefArgument) { EXPECT_FALSE(isMutated(Results, AST.get())); AST = buildASTFromCode( - "struct A {}; A operator+(const A&, int) {} void f() { A x; x + 1; }"); + "struct A {}; A operator+(const A&, int); void f() { A x; x + 1; }"); Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext()); EXPECT_FALSE(isMutated(Results, AST.get())); @@ -356,7 +356,7 @@ TEST(ExprMutationAnalyzerTest, ByNonConstRRefArgument) { EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("g(static_cast(x))")); - AST = buildASTFromCode("struct A {}; A operator+(A&&, int) {}" + AST = buildASTFromCode("struct A {}; A operator+(A&&, int);" "void f() { A x; static_cast(x) + 1; }"); Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext()); EXPECT_THAT(mutatedBy(Results, AST.get()), @@ -382,7 +382,7 @@ TEST(ExprMutationAnalyzerTest, ByConstRRefArgument) { match(withEnclosingCompound(declRefTo("x")), AST->getASTContext()); EXPECT_FALSE(isMutated(Results, AST.get())); - AST = buildASTFromCode("struct A {}; A operator+(const A&&, int) {}" + AST = buildASTFromCode("struct A {}; A operator+(const A&&, int);" "void f() { A x; static_cast(x) + 1; }"); Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext()); EXPECT_FALSE(isMutated(Results, AST.get()));