mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-22 10:24:26 +00:00
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:
@ -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();
|
||||
|
Reference in New Issue
Block a user