2013-01-07 15:35:46 +00:00
|
|
|
//===- llvm/unittest/IR/TypesTest.cpp - Type unit tests -------------------===//
|
2012-08-04 09:47:02 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2013-01-02 11:36:10 +00:00
|
|
|
#include "llvm/IR/DerivedTypes.h"
|
|
|
|
#include "llvm/IR/LLVMContext.h"
|
2012-08-04 09:47:02 +00:00
|
|
|
#include "gtest/gtest.h"
|
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
TEST(TypesTest, StructType) {
|
|
|
|
LLVMContext C;
|
|
|
|
|
|
|
|
// PR13522
|
|
|
|
StructType *Struct = StructType::create(C, "FooBar");
|
|
|
|
EXPECT_EQ("FooBar", Struct->getName());
|
|
|
|
Struct->setName(Struct->getName().substr(0, 3));
|
|
|
|
EXPECT_EQ("Foo", Struct->getName());
|
|
|
|
Struct->setName("");
|
|
|
|
EXPECT_TRUE(Struct->getName().empty());
|
|
|
|
EXPECT_FALSE(Struct->hasName());
|
|
|
|
}
|
|
|
|
|
2016-01-03 17:22:03 +00:00
|
|
|
TEST(TypesTest, LayoutIdenticalEmptyStructs) {
|
|
|
|
LLVMContext C;
|
|
|
|
|
|
|
|
StructType *Foo = StructType::create(C, "Foo");
|
|
|
|
StructType *Bar = StructType::create(C, "Bar");
|
|
|
|
EXPECT_TRUE(Foo->isLayoutIdentical(Bar));
|
|
|
|
}
|
2015-08-18 07:59:09 +00:00
|
|
|
|
2012-08-04 09:47:02 +00:00
|
|
|
} // end anonymous namespace
|