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 | e0d97dfa4ed04ebdca0fb409ecca166e811d1384 (patch) | |
tree | c0a9c65e54d27e0fd1e70b9019b5b79ef26546c7 /llvm/unittests/IR/VerifierTest.cpp | |
parent | a88c119ba3a26d252bdfa66fb4117cbd105f1568 (diff) | |
download | llvm-e0d97dfa4ed04ebdca0fb409ecca166e811d1384.zip llvm-e0d97dfa4ed04ebdca0fb409ecca166e811d1384.tar.gz llvm-e0d97dfa4ed04ebdca0fb409ecca166e811d1384.tar.bz2 |
Add unit test to test a trivial verifier check.
llvm-svn: 184338
Diffstat (limited to 'llvm/unittests/IR/VerifierTest.cpp')
-rw-r--r-- | llvm/unittests/IR/VerifierTest.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/unittests/IR/VerifierTest.cpp b/llvm/unittests/IR/VerifierTest.cpp index 8911936..2848cb8 100644 --- a/llvm/unittests/IR/VerifierTest.cpp +++ b/llvm/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!")); +} + } } |