summaryrefslogtreecommitdiffstats
path: root/llvm/lib
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
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')
-rw-r--r--llvm/lib/IR/LLVMContextImpl.h4
-rw-r--r--llvm/lib/IR/Metadata.cpp10
2 files changed, 6 insertions, 8 deletions
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index a009262f80e..12b150741dd 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -288,8 +288,8 @@ struct MDLocationInfo {
struct GenericDebugNodeInfo {
struct KeyTy : MDNodeOpsKey {
unsigned Tag;
- MDString *Header;
- KeyTy(unsigned Tag, MDString *Header, ArrayRef<Metadata *> DwarfOps)
+ StringRef Header;
+ KeyTy(unsigned Tag, StringRef Header, ArrayRef<Metadata *> DwarfOps)
: MDNodeOpsKey(DwarfOps), Tag(Tag), Header(Header) {}
KeyTy(GenericDebugNode *N)
: MDNodeOpsKey(N, 1), Tag(N->getTag()), Header(N->getHeader()) {}
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