diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-06-19 19:26:44 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-06-19 19:26:44 +0000 |
commit | ae5758bac75f561f8aa519476942e02be73022e4 (patch) | |
tree | 4f6dc5ca6681041087d2021d11d7ceb46923fda7 /unittests/IR | |
parent | 27ff1f3f7d9a20e02e00fe88dbb7541ce066d33c (diff) | |
download | external_llvm-ae5758bac75f561f8aa519476942e02be73022e4.zip external_llvm-ae5758bac75f561f8aa519476942e02be73022e4.tar.gz external_llvm-ae5758bac75f561f8aa519476942e02be73022e4.tar.bz2 |
Add unit test to test a trivial verifier check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184338 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/IR')
-rw-r--r-- | unittests/IR/VerifierTest.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/unittests/IR/VerifierTest.cpp b/unittests/IR/VerifierTest.cpp index 8911936..2848cb8 100644 --- a/unittests/IR/VerifierTest.cpp +++ b/unittests/IR/VerifierTest.cpp @@ -60,5 +60,21 @@ TEST(VerifierTest, AliasUnnamedAddr) { EXPECT_TRUE(verifyModule(M, ReturnStatusAction, &Error)); EXPECT_TRUE(StringRef(Error).startswith("Alias cannot have unnamed_addr")); } + +TEST(VerifierTest, InvalidRetAttribute) { + LLVMContext &C = getGlobalContext(); + Module M("M", C); + FunctionType *FTy = FunctionType::get(Type::getInt32Ty(C), /*isVarArg=*/false); + Function *F = cast<Function>(M.getOrInsertFunction("foo", FTy)); + AttributeSet AS = F->getAttributes(); + F->setAttributes(AS.addAttribute(C, AttributeSet::ReturnIndex, + Attribute::UWTable)); + + std::string Error; + EXPECT_TRUE(verifyModule(M, ReturnStatusAction, &Error)); + EXPECT_TRUE(StringRef(Error). + startswith("Attribute 'uwtable' only applies to functions!")); +} + } } |