summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Metadata.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-01-22 23:10:55 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-01-22 23:10:55 +0000
commit68ab023ef75c38c59024d322c9d81dbd7ea9e475 (patch)
treee6a908b077f376bf90339a606be04d2490aea2cd /llvm/lib/IR/Metadata.cpp
parent999500a26dfb1285bb9ea4dc489f49f7809d09d9 (diff)
downloadbcm5719-llvm-68ab023ef75c38c59024d322c9d81dbd7ea9e475.tar.gz
bcm5719-llvm-68ab023ef75c38c59024d322c9d81dbd7ea9e475.zip
IR: Change GenericDwarfNode::getHeader() to StringRef
Simplify the API to use a `StringRef` directly rather than exposing the `MDString` bits underneath. llvm-svn: 226876
Diffstat (limited to 'llvm/lib/IR/Metadata.cpp')
-rw-r--r--llvm/lib/IR/Metadata.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp
index e55d287e63a..d4393026d50 100644
--- a/llvm/lib/IR/Metadata.cpp
+++ b/llvm/lib/IR/Metadata.cpp
@@ -760,14 +760,10 @@ MDLocation *MDLocation::getImpl(LLVMContext &Context, unsigned Line,
}
GenericDebugNode *GenericDebugNode::getImpl(LLVMContext &Context, unsigned Tag,
- MDString *Header,
+ StringRef Header,
ArrayRef<Metadata *> DwarfOps,
StorageType Storage,
bool ShouldCreate) {
- // Canonicalize empty string to a nullptr.
- if (Header && Header->getString().empty())
- Header = nullptr;
-
unsigned Hash = 0;
if (Storage == Uniqued) {
GenericDebugNodeInfo::KeyTy Key(Tag, Header, DwarfOps);
@@ -780,7 +776,9 @@ GenericDebugNode *GenericDebugNode::getImpl(LLVMContext &Context, unsigned Tag,
assert(ShouldCreate && "Expected non-uniqued nodes to always be created");
}
- Metadata *PreOps[] = {Header};
+ // Use a nullptr for empty headers.
+ Metadata *PreOps[] = {Header.empty() ? nullptr
+ : MDString::get(Context, Header)};
return storeImpl(new (DwarfOps.size() + 1) GenericDebugNode(
Context, Storage, Hash, Tag, PreOps, DwarfOps),
Storage, Context.pImpl->GenericDebugNodes);
OpenPOWER on IntegriCloud