diff options
Diffstat (limited to 'unittests/VMCore')
-rw-r--r-- | unittests/VMCore/Makefile | 2 | ||||
-rw-r--r-- | unittests/VMCore/pr11677.cpp | 64 |
2 files changed, 1 insertions, 65 deletions
diff --git a/unittests/VMCore/Makefile b/unittests/VMCore/Makefile index c6babe742c..1b2b69c6d6 100644 --- a/unittests/VMCore/Makefile +++ b/unittests/VMCore/Makefile @@ -9,7 +9,7 @@ LEVEL = ../.. TESTNAME = VMCore -LINK_COMPONENTS := core support bitreader bitwriter target ipa +LINK_COMPONENTS := core support target ipa include $(LEVEL)/Makefile.config include $(LLVM_SRC_ROOT)/unittests/Makefile.unittest diff --git a/unittests/VMCore/pr11677.cpp b/unittests/VMCore/pr11677.cpp deleted file mode 100644 index 362eec7763..0000000000 --- a/unittests/VMCore/pr11677.cpp +++ /dev/null @@ -1,64 +0,0 @@ -//===- llvm/unittest/VMCore/pr11677.cpp - Test for blockaddr --------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "llvm/Analysis/Verifier.h" -#include "llvm/Bitcode/BitstreamWriter.h" -#include "llvm/Bitcode/ReaderWriter.h" -#include "llvm/Constants.h" -#include "llvm/Instructions.h" -#include "llvm/LLVMContext.h" -#include "llvm/Module.h" -#include "llvm/PassManager.h" -#include "llvm/Support/MemoryBuffer.h" -#include "gtest/gtest.h" - -namespace llvm { -namespace { - -static Module *makeLLVMModule() { - Module* Mod = new Module("test-mem", getGlobalContext()); - - FunctionType* FuncTy = - FunctionType::get(Type::getVoidTy(Mod->getContext()), false); - Function* Func = Function::Create(FuncTy,GlobalValue::ExternalLinkage, - "func", Mod); - - BasicBlock* Entry = BasicBlock::Create(Mod->getContext(), "entry", Func); - new UnreachableInst(Mod->getContext(), Entry); - - BasicBlock* BB = BasicBlock::Create(Mod->getContext(), "bb", Func); - new UnreachableInst(Mod->getContext(), BB); - - PointerType* Int8Ptr = Type::getInt8PtrTy(Mod->getContext()); - new GlobalVariable(*Mod, Int8Ptr, /*isConstant=*/true, - GlobalValue::ExternalLinkage, - BlockAddress::get(BB), "table"); - - return Mod; -} - -static void writeModuleToBuffer(std::vector<unsigned char> &Buffer) { - Module *Mod = makeLLVMModule(); - BitstreamWriter Stream(Buffer); - WriteBitcodeToStream(Mod, Stream); -} - -TEST(PR11677, BlockAddr) { - std::vector<unsigned char> Mem; - writeModuleToBuffer(Mem); - StringRef Data((const char*)&Mem[0], Mem.size()); - MemoryBuffer *Buffer = MemoryBuffer::getMemBuffer(Data, "test", false); - std::string errMsg; - Module *m = getLazyBitcodeModule(Buffer, getGlobalContext(), &errMsg); - PassManager passes; - passes.add(createVerifierPass()); - passes.run(*m); -} -} -} |