mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 16:24:23 +00:00
IR: Separate helpers for string operands, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227846 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -71,6 +71,13 @@ MDLocation *MDLocation::getImpl(LLVMContext &Context, unsigned Line,
|
||||
Storage, Context.pImpl->MDLocations);
|
||||
}
|
||||
|
||||
/// \brief Get the MDString, or nullptr if the string is empty.
|
||||
static MDString *getCanonicalMDString(LLVMContext &Context, StringRef S) {
|
||||
if (S.empty())
|
||||
return nullptr;
|
||||
return MDString::get(Context, S);
|
||||
}
|
||||
|
||||
GenericDebugNode *GenericDebugNode::getImpl(LLVMContext &Context, unsigned Tag,
|
||||
StringRef Header,
|
||||
ArrayRef<Metadata *> DwarfOps,
|
||||
@ -89,8 +96,7 @@ GenericDebugNode *GenericDebugNode::getImpl(LLVMContext &Context, unsigned Tag,
|
||||
}
|
||||
|
||||
// Use a nullptr for empty headers.
|
||||
Metadata *PreOps[] = {Header.empty() ? nullptr
|
||||
: MDString::get(Context, Header)};
|
||||
Metadata *PreOps[] = {getCanonicalMDString(Context, Header)};
|
||||
return storeImpl(new (DwarfOps.size() + 1) GenericDebugNode(
|
||||
Context, Storage, Hash, Tag, PreOps, DwarfOps),
|
||||
Storage, Context.pImpl->GenericDebugNodes);
|
||||
|
Reference in New Issue
Block a user