summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/IR/DebugInfoTest.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-02-21 00:45:26 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-02-21 00:45:26 +0000
commit269e38d3976a15113cf72a04a559c1d124ac5dc6 (patch)
treedb67fa111d215170a0f2da0df4b980873361d700 /llvm/unittests/IR/DebugInfoTest.cpp
parentc22a5c2c6c519d9a5d25bc52b8b26ccebff62264 (diff)
downloadbcm5719-llvm-269e38d3976a15113cf72a04a559c1d124ac5dc6.tar.gz
bcm5719-llvm-269e38d3976a15113cf72a04a559c1d124ac5dc6.zip
IR: Add helper to split debug info flags bitfield
Split debug info 'flags' bitfield over a vector so the current flags can be iterated over. This API (in combination with r230107) will be used for assembly support for symbolic constants. llvm-svn: 230108
Diffstat (limited to 'llvm/unittests/IR/DebugInfoTest.cpp')
-rw-r--r--llvm/unittests/IR/DebugInfoTest.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/unittests/IR/DebugInfoTest.cpp b/llvm/unittests/IR/DebugInfoTest.cpp
index fa05425e333..3c6c78651fa 100644
--- a/llvm/unittests/IR/DebugInfoTest.cpp
+++ b/llvm/unittests/IR/DebugInfoTest.cpp
@@ -111,4 +111,25 @@ TEST(DIDescriptorTest, getFlagString) {
EXPECT_EQ(StringRef(), DIDescriptor::getFlagString(0xffff));
}
+TEST(DIDescriptorTest, splitFlags) {
+ // Some valid flags.
+#define CHECK_SPLIT(FLAGS, VECTOR, REMAINDER) \
+ { \
+ SmallVector<unsigned, 8> V; \
+ EXPECT_EQ(REMAINDER, DIDescriptor::splitFlags(FLAGS, V)); \
+ EXPECT_TRUE(makeArrayRef(V).equals VECTOR); \
+ }
+ CHECK_SPLIT(DIDescriptor::FlagPublic, (DIDescriptor::FlagPublic), 0u);
+ CHECK_SPLIT(DIDescriptor::FlagProtected, (DIDescriptor::FlagProtected), 0u);
+ CHECK_SPLIT(DIDescriptor::FlagPrivate, (DIDescriptor::FlagPrivate), 0u);
+ CHECK_SPLIT(DIDescriptor::FlagVector, (DIDescriptor::FlagVector), 0u);
+ CHECK_SPLIT(DIDescriptor::FlagRValueReference, (DIDescriptor::FlagRValueReference), 0u);
+ CHECK_SPLIT(DIDescriptor::FlagFwdDecl | DIDescriptor::FlagVector,
+ (DIDescriptor::FlagFwdDecl, DIDescriptor::FlagVector), 0u);
+ CHECK_SPLIT(0x100000u, (), 0x100000u);
+ CHECK_SPLIT(0x100000u | DIDescriptor::FlagVector, (DIDescriptor::FlagVector),
+ 0x100000u);
+#undef CHECK_SPLIT
+}
+
} // end namespace
OpenPOWER on IntegriCloud