DebugInfo: Move DIFlag-related API from DIDescriptor to DebugNode

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234274 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith
2015-04-07 01:21:40 +00:00
parent 329f8219cd
commit 5f3bcf7dc4
7 changed files with 95 additions and 95 deletions

View File

@ -14,6 +14,7 @@
#include "llvm/IR/DebugInfoMetadata.h"
#include "LLVMContextImpl.h"
#include "MetadataImpl.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/IR/Function.h"
using namespace llvm;
@ -65,6 +66,49 @@ MDLocation *MDLocation::getImpl(LLVMContext &Context, unsigned Line,
Storage, Context.pImpl->MDLocations);
}
unsigned DebugNode::getFlag(StringRef Flag) {
return StringSwitch<unsigned>(Flag)
#define HANDLE_DI_FLAG(ID, NAME) .Case("DIFlag" #NAME, Flag##NAME)
#include "llvm/IR/DebugInfoFlags.def"
.Default(0);
}
const char *DebugNode::getFlagString(unsigned Flag) {
switch (Flag) {
default:
return "";
#define HANDLE_DI_FLAG(ID, NAME) \
case Flag##NAME: \
return "DIFlag" #NAME;
#include "llvm/IR/DebugInfoFlags.def"
}
}
unsigned DebugNode::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;
}
static StringRef getString(const MDString *S) {
if (S)
return S->getString();