summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/LLVMContextImpl.h
diff options
context:
space:
mode:
authorScott Linder <scott@scottlinder.com>2018-02-23 23:01:06 +0000
committerScott Linder <scott@scottlinder.com>2018-02-23 23:01:06 +0000
commit16c7bdaf3245d23b9b441144f5efb610e2044927 (patch)
tree870f3b5c5c606b19951cb4433f3887825bc61e56 /llvm/lib/IR/LLVMContextImpl.h
parent5e2f6ba51e89c9b9625902f0c36493ad46e46a3b (diff)
downloadbcm5719-llvm-16c7bdaf3245d23b9b441144f5efb610e2044927.tar.gz
bcm5719-llvm-16c7bdaf3245d23b9b441144f5efb610e2044927.zip
[DebugInfo] Support DWARF v5 source code embedding extension
In DWARF v5 the Line Number Program Header is extensible, allowing values with new content types. In this extension a content type is added, DW_LNCT_LLVM_source, which contains the embedded source code of the file. Add new optional attribute for !DIFile IR metadata called source which contains source text. Use this to output the source to the DWARF line table of code objects. Analogously extend METADATA_FILE in Bitcode and .file directive in ASM to support optional source. Teach llvm-dwarfdump and llvm-objdump about the new values. Update the output format of llvm-dwarfdump to make room for the new attribute on file_names entries, and support embedded sources for the -source option in llvm-objdump. Differential Revision: https://reviews.llvm.org/D42765 llvm-svn: 325970
Diffstat (limited to 'llvm/lib/IR/LLVMContextImpl.h')
-rw-r--r--llvm/lib/IR/LLVMContextImpl.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index 313b7e16bec..1f2956d54ed 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -575,24 +575,28 @@ template <> struct MDNodeKeyImpl<DIFile> {
MDString *Filename;
MDString *Directory;
Optional<DIFile::ChecksumInfo<MDString *>> Checksum;
+ Optional<MDString *> Source;
MDNodeKeyImpl(MDString *Filename, MDString *Directory,
- Optional<DIFile::ChecksumInfo<MDString *>> Checksum)
- : Filename(Filename), Directory(Directory), Checksum(Checksum) {}
+ Optional<DIFile::ChecksumInfo<MDString *>> Checksum,
+ Optional<MDString *> Source)
+ : Filename(Filename), Directory(Directory), Checksum(Checksum),
+ Source(Source) {}
MDNodeKeyImpl(const DIFile *N)
: Filename(N->getRawFilename()), Directory(N->getRawDirectory()),
- Checksum(N->getRawChecksum()) {}
+ Checksum(N->getRawChecksum()), Source(N->getRawSource()) {}
bool isKeyOf(const DIFile *RHS) const {
return Filename == RHS->getRawFilename() &&
Directory == RHS->getRawDirectory() &&
- Checksum == RHS->getRawChecksum();
+ Checksum == RHS->getRawChecksum() &&
+ Source == RHS->getRawSource();
}
unsigned getHashValue() const {
- if (Checksum)
- return hash_combine(Filename, Directory, Checksum->Kind, Checksum->Value);
- return hash_combine(Filename, Directory);
+ return hash_combine(
+ Filename, Directory, Checksum ? Checksum->Kind : 0,
+ Checksum ? Checksum->Value : nullptr, Source.getValueOr(nullptr));
}
};
OpenPOWER on IntegriCloud