[llvm] r266764 - IR: LLVMContextTest => DebugTypeODRUniquingTest, NFC

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 19 10:11:06 PDT 2016


Author: dexonsmith
Date: Tue Apr 19 12:11:06 2016
New Revision: 266764

URL: http://llvm.org/viewvc/llvm-project?rev=266764&view=rev
Log:
IR: LLVMContextTest => DebugTypeODRUniquingTest, NFC

The second test in this file is actually testing DICompositeType API,
not LLVMContext API (after r266742 moved it to a higher level).  This
really doesn't make sense in an LLVMContextTest.  Rename the tests
before adding more.

Added:
    llvm/trunk/unittests/IR/DebugTypeODRUniquingTest.cpp
      - copied, changed from r266761, llvm/trunk/unittests/IR/LLVMContextTest.cpp
Removed:
    llvm/trunk/unittests/IR/LLVMContextTest.cpp
Modified:
    llvm/trunk/unittests/IR/CMakeLists.txt

Modified: llvm/trunk/unittests/IR/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/CMakeLists.txt?rev=266764&r1=266763&r2=266764&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/CMakeLists.txt (original)
+++ llvm/trunk/unittests/IR/CMakeLists.txt Tue Apr 19 12:11:06 2016
@@ -11,12 +11,12 @@ set(IRSources
   ConstantRangeTest.cpp
   ConstantsTest.cpp
   DebugInfoTest.cpp
+  DebugTypeODRUniquingTest.cpp
   DominatorTreeTest.cpp
   FunctionTest.cpp
   IRBuilderTest.cpp
   InstructionsTest.cpp
   IntrinsicsTest.cpp
-  LLVMContextTest.cpp
   LegacyPassManagerTest.cpp
   MDBuilderTest.cpp
   MetadataTest.cpp

Copied: llvm/trunk/unittests/IR/DebugTypeODRUniquingTest.cpp (from r266761, llvm/trunk/unittests/IR/LLVMContextTest.cpp)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/DebugTypeODRUniquingTest.cpp?p2=llvm/trunk/unittests/IR/DebugTypeODRUniquingTest.cpp&p1=llvm/trunk/unittests/IR/LLVMContextTest.cpp&r1=266761&r2=266764&rev=266764&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/LLVMContextTest.cpp (original)
+++ llvm/trunk/unittests/IR/DebugTypeODRUniquingTest.cpp Tue Apr 19 12:11:06 2016
@@ -1,4 +1,4 @@
-//===- LLVMContextTest.cpp - LLVMContext unit tests -----------------------===//
+//===- DebugTypeODRUniquingTest.cpp - Debug type ODR uniquing tests -------===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -14,7 +14,7 @@ using namespace llvm;
 
 namespace {
 
-TEST(LLVMContextTest, enableDebugTypeODRUniquing) {
+TEST(DebugTypeODRUniquingTest, enableDebugTypeODRUniquing) {
   LLVMContext Context;
   EXPECT_FALSE(Context.isODRUniquingDebugTypes());
   Context.enableDebugTypeODRUniquing();
@@ -23,7 +23,7 @@ TEST(LLVMContextTest, enableDebugTypeODR
   EXPECT_FALSE(Context.isODRUniquingDebugTypes());
 }
 
-TEST(LLVMContextTest, getOrInsertODRUniquedType) {
+TEST(DebugTypeODRUniquingTest, getODRType) {
   LLVMContext Context;
   MDString &UUID = *MDString::get(Context, "string");
 

Removed: llvm/trunk/unittests/IR/LLVMContextTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/LLVMContextTest.cpp?rev=266763&view=auto
==============================================================================
--- llvm/trunk/unittests/IR/LLVMContextTest.cpp (original)
+++ llvm/trunk/unittests/IR/LLVMContextTest.cpp (removed)
@@ -1,65 +0,0 @@
-//===- LLVMContextTest.cpp - LLVMContext unit tests -----------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/IR/LLVMContext.h"
-#include "llvm/IR/DebugInfoMetadata.h"
-#include "gtest/gtest.h"
-using namespace llvm;
-
-namespace {
-
-TEST(LLVMContextTest, enableDebugTypeODRUniquing) {
-  LLVMContext Context;
-  EXPECT_FALSE(Context.isODRUniquingDebugTypes());
-  Context.enableDebugTypeODRUniquing();
-  EXPECT_TRUE(Context.isODRUniquingDebugTypes());
-  Context.disableDebugTypeODRUniquing();
-  EXPECT_FALSE(Context.isODRUniquingDebugTypes());
-}
-
-TEST(LLVMContextTest, getOrInsertODRUniquedType) {
-  LLVMContext Context;
-  MDString &UUID = *MDString::get(Context, "string");
-
-  // Without a type map, this should return null.
-  EXPECT_FALSE(DICompositeType::getODRType(
-      Context, UUID, dwarf::DW_TAG_class_type, nullptr, nullptr, 0, nullptr,
-      nullptr, 0, 0, 0, 0, nullptr, 0, nullptr, nullptr));
-
-  // Enable the mapping.  There still shouldn't be a type.
-  Context.enableDebugTypeODRUniquing();
-  EXPECT_FALSE(DICompositeType::getODRTypeIfExists(Context, UUID));
-
-  // Create some ODR-uniqued type.
-  auto &CT = *DICompositeType::getODRType(
-      Context, UUID, dwarf::DW_TAG_class_type, nullptr, nullptr, 0, nullptr,
-      nullptr, 0, 0, 0, 0, nullptr, 0, nullptr, nullptr);
-  EXPECT_EQ(UUID.getString(), CT.getIdentifier());
-
-  // Check that we get it back, even if we change a field.
-  EXPECT_EQ(&CT, DICompositeType::getODRTypeIfExists(Context, UUID));
-  EXPECT_EQ(
-      &CT, DICompositeType::getODRType(Context, UUID, dwarf::DW_TAG_class_type,
-                                       nullptr, nullptr, 0, nullptr, nullptr, 0,
-                                       0, 0, 0, nullptr, 0, nullptr, nullptr));
-  EXPECT_EQ(&CT, DICompositeType::getODRType(
-                     Context, UUID, dwarf::DW_TAG_class_type,
-                     MDString::get(Context, "name"), nullptr, 0, nullptr,
-                     nullptr, 0, 0, 0, 0, nullptr, 0, nullptr, nullptr));
-
-  // Check that it's discarded with the type map.
-  Context.disableDebugTypeODRUniquing();
-  EXPECT_FALSE(DICompositeType::getODRTypeIfExists(Context, UUID));
-
-  // And it shouldn't magically reappear...
-  Context.enableDebugTypeODRUniquing();
-  EXPECT_FALSE(DICompositeType::getODRTypeIfExists(Context, UUID));
-}
-
-} // end namespace




More information about the llvm-commits mailing list