[llvm] r184338 - Add unit test to test a trivial verifier check.
Bill Wendling
isanbard at gmail.com
Wed Jun 19 12:26:44 PDT 2013
Author: void
Date: Wed Jun 19 14:26:44 2013
New Revision: 184338
URL: http://llvm.org/viewvc/llvm-project?rev=184338&view=rev
Log:
Add unit test to test a trivial verifier check.
Modified:
llvm/trunk/unittests/IR/VerifierTest.cpp
Modified: llvm/trunk/unittests/IR/VerifierTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/VerifierTest.cpp?rev=184338&r1=184337&r2=184338&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/VerifierTest.cpp (original)
+++ llvm/trunk/unittests/IR/VerifierTest.cpp Wed Jun 19 14:26:44 2013
@@ -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!"));
+}
+
}
}
More information about the llvm-commits
mailing list