diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-02-21 00:45:26 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-02-21 00:45:26 +0000 |
commit | 269e38d3976a15113cf72a04a559c1d124ac5dc6 (patch) | |
tree | db67fa111d215170a0f2da0df4b980873361d700 /llvm/lib/IR/DebugInfo.cpp | |
parent | c22a5c2c6c519d9a5d25bc52b8b26ccebff62264 (diff) | |
download | bcm5719-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/lib/IR/DebugInfo.cpp')
-rw-r--r-- | llvm/lib/IR/DebugInfo.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index ad75fbae80d..6590661311a 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -55,6 +55,30 @@ const char *DIDescriptor::getFlagString(unsigned Flag) { } } +unsigned DIDescriptor::splitFlags(unsigned Flags, + SmallVectorImpl<unsigned> &SplitFlags) { + // Accessibility flags need to be specially handled, since they're packed + // together. + if (unsigned A = Flags & FlagAccessibility) { + if (A == FlagPrivate) + SplitFlags.push_back(FlagPrivate); + else if (A == FlagProtected) + SplitFlags.push_back(FlagProtected); + else + SplitFlags.push_back(FlagPublic); + Flags &= ~A; + } + +#define HANDLE_DI_FLAG(ID, NAME) \ + if (unsigned Bit = Flags & ID) { \ + SplitFlags.push_back(Bit); \ + Flags &= ~Bit; \ + } +#include "llvm/IR/DebugInfoFlags.def" + + return Flags; +} + bool DIDescriptor::Verify() const { return DbgNode && (DIDerivedType(DbgNode).Verify() || |