Fix inappropriate use of anonymous namespaces in unittests.
authorChandler Carruth <chandlerc@gmail.com>
Wed, 20 Jun 2012 08:39:27 +0000 (08:39 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Wed, 20 Jun 2012 08:39:27 +0000 (08:39 +0000)
The TEST_F macros actually declare *subclasses* of the test fixtures.
Even if they didn't we don't want them to declare external functions.
The entire unit test, including both the fixture class and the fixture
test cases should be wrapped in the anonymous namespace.

This issue was caught by the new '-Winternal-linkage-in-inline' warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158798 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/Support/IRBuilderTest.cpp
unittests/Transforms/Utils/Cloning.cpp

index b15de9ed38399e56d2ecb3c215e206862ece4c56..9c48c2c00f151b58c0f1123b452a8abaf53c7faf 100644 (file)
@@ -20,6 +20,7 @@
 using namespace llvm;
 
 namespace {
+
 class IRBuilderTest : public testing::Test {
 protected:
   virtual void SetUp() {
@@ -38,7 +39,6 @@ protected:
   OwningPtr<Module> M;
   BasicBlock *BB;
 };
-}
 
 TEST_F(IRBuilderTest, Lifetime) {
   IRBuilder<> Builder(BB);
@@ -70,3 +70,5 @@ TEST_F(IRBuilderTest, Lifetime) {
   ASSERT_TRUE(II_End1 != NULL);
   EXPECT_EQ(II_End1->getIntrinsicID(), Intrinsic::lifetime_end);
 }
+
+}
index 4243b2d39de7a229a7272798729adf6c09613faf..ea3d5bee78b9c75a928ae2ac1da18917486e17f5 100644 (file)
@@ -18,6 +18,7 @@
 using namespace llvm;
 
 namespace {
+
 class CloneInstruction : public ::testing::Test {
 protected:
   virtual void SetUp() {
@@ -48,7 +49,6 @@ protected:
   LLVMContext context;
   Value *V;
 };
-}
 
 TEST_F(CloneInstruction, OverflowBits) {
   V = new Argument(Type::getInt32Ty(context));
@@ -142,3 +142,5 @@ TEST_F(CloneInstruction, Exact) {
   SDiv->setIsExact(true);
   EXPECT_TRUE(this->clone(SDiv)->isExact());
 }
+
+}