summaryrefslogtreecommitdiff
path: root/llvm/unittests/IR/AttributesTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/IR/AttributesTest.cpp')
-rw-r--r--llvm/unittests/IR/AttributesTest.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/llvm/unittests/IR/AttributesTest.cpp b/llvm/unittests/IR/AttributesTest.cpp
index 03b4cef404f5..f260f0f9bf86 100644
--- a/llvm/unittests/IR/AttributesTest.cpp
+++ b/llvm/unittests/IR/AttributesTest.cpp
@@ -217,4 +217,39 @@ TEST(Attributes, HasParentContext) {
}
}
+TEST(Attributes, AttributeListPrinting) {
+ LLVMContext C;
+
+ {
+ std::string S;
+ raw_string_ostream OS(S);
+ AttributeList AL;
+ AL.addAttribute(C, AttributeList::FunctionIndex, Attribute::AlwaysInline)
+ .print(OS);
+ EXPECT_EQ(S, "AttributeList[\n"
+ " { function => alwaysinline }\n"
+ "]\n");
+ }
+
+ {
+ std::string S;
+ raw_string_ostream OS(S);
+ AttributeList AL;
+ AL.addAttribute(C, AttributeList::ReturnIndex, Attribute::SExt).print(OS);
+ EXPECT_EQ(S, "AttributeList[\n"
+ " { return => signext }\n"
+ "]\n");
+ }
+
+ {
+ std::string S;
+ raw_string_ostream OS(S);
+ AttributeList AL;
+ AL.addParamAttribute(C, 5, Attribute::ZExt).print(OS);
+ EXPECT_EQ(S, "AttributeList[\n"
+ " { arg(5) => zeroext }\n"
+ "]\n");
+ }
+}
+
} // end anonymous namespace