r342586 - [NFC] Declare instead of define non-void functions in unit tests.

Shuai Wang via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 19 13:27:25 PDT 2018


Author: shuaiwang
Date: Wed Sep 19 13:27:25 2018
New Revision: 342586

URL: http://llvm.org/viewvc/llvm-project?rev=342586&view=rev
Log:
[NFC] Declare instead of define non-void functions in unit tests.

Modified:
    cfe/trunk/unittests/Analysis/ExprMutationAnalyzerTest.cpp

Modified: cfe/trunk/unittests/Analysis/ExprMutationAnalyzerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Analysis/ExprMutationAnalyzerTest.cpp?rev=342586&r1=342585&r2=342586&view=diff
==============================================================================
--- cfe/trunk/unittests/Analysis/ExprMutationAnalyzerTest.cpp (original)
+++ cfe/trunk/unittests/Analysis/ExprMutationAnalyzerTest.cpp Wed Sep 19 13:27:25 2018
@@ -203,7 +203,7 @@ TEST(ExprMutationAnalyzerTest, ByValueAr
   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, ByConstVa
   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, ByNonCons
   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, ByConstRe
   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, ByNonCons
   EXPECT_THAT(mutatedBy(Results, AST.get()),
               ElementsAre("g(static_cast<int &&>(x))"));
 
-  AST = buildASTFromCode("struct A {}; A operator+(A&&, int) {}"
+  AST = buildASTFromCode("struct A {}; A operator+(A&&, int);"
                          "void f() { A x; static_cast<A &&>(x) + 1; }");
   Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
   EXPECT_THAT(mutatedBy(Results, AST.get()),
@@ -382,7 +382,7 @@ TEST(ExprMutationAnalyzerTest, ByConstRR
       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<A&&>(x) + 1; }");
   Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
   EXPECT_FALSE(isMutated(Results, AST.get()));




More information about the cfe-commits mailing list