-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Add checksum option for create file #162592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1095,6 +1095,38 @@ LLVMDIBuilderCreateFile(LLVMDIBuilderRef Builder, const char *Filename, | |
| StringRef(Directory, DirectoryLen))); | ||
| } | ||
|
|
||
| static llvm::DIFile::ChecksumKind | ||
| map_from_llvmChecksumKind(LLVMChecksumKind CSKind) { | ||
| switch (CSKind) { | ||
| case LLVMChecksumKind::CSK_MD5: | ||
| return llvm::DIFile::CSK_MD5; | ||
| case LLVMChecksumKind::CSK_SHA1: | ||
| return llvm::DIFile::CSK_SHA1; | ||
| case LLVMChecksumKind::CSK_SHA256: | ||
| return llvm::DIFile::CSK_SHA256; | ||
| } | ||
| llvm_unreachable("Unhandled Checksum Kind"); | ||
| } | ||
|
|
||
| LLVMMetadataRef LLVMDIBuilderCreateFileWithCheckSum( | ||
| LLVMDIBuilderRef Builder, const char *Filename, size_t FilenameLen, | ||
| const char *Directory, size_t DirectoryLen, LLVMChecksumKind ChecksumKind, | ||
| const char *Checksum, size_t ChecksumLen, const char *Source, | ||
| size_t SourceLen) { | ||
| StringRef ChkSum = StringRef(Checksum, ChecksumLen); | ||
| std::optional<llvm::DIFile::ChecksumInfo<StringRef>> CSInfo; | ||
|
||
| auto CSK = map_from_llvmChecksumKind(ChecksumKind); | ||
| CSInfo.emplace(CSK, ChkSum); | ||
| std::optional<StringRef> Src; | ||
| if (SourceLen > 0) | ||
| Src = StringRef(Source, SourceLen); | ||
| else | ||
| Src = std::nullopt; | ||
OCHyams marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return wrap(unwrap(Builder)->createFile(StringRef(Filename, FilenameLen), | ||
| StringRef(Directory, DirectoryLen), | ||
| CSInfo, Src)); | ||
| } | ||
|
|
||
| LLVMMetadataRef | ||
| LLVMDIBuilderCreateModule(LLVMDIBuilderRef Builder, LLVMMetadataRef ParentScope, | ||
| const char *Name, size_t NameLen, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.