Skip to content

Commit

Permalink
[LLVM-C] Add bindings to create enumerators
Browse files Browse the repository at this point in the history
Summary: The C API don't have the bindings to create enumerators, needed to create an enumeration.

Reviewers: whitequark, CodaFi, harlanhaskins, deadalnix

Reviewed By: whitequark, CodaFi, harlanhaskins

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D58323

llvm-svn: 354237
  • Loading branch information
CodaFi committed Feb 17, 2019
1 parent 92b5b19 commit a82b613
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
13 changes: 13 additions & 0 deletions llvm/include/llvm-c/DebugInfo.h
Expand Up @@ -478,6 +478,19 @@ LLVMDIBuilderCreateSubroutineType(LLVMDIBuilderRef Builder,
unsigned NumParameterTypes,
LLVMDIFlags Flags);

/**
* Create debugging information entry for an enumerator.
* @param Builder The DIBuilder.
* @param Name Enumerator name.
* @param NameLen Length of enumerator name.
* @param Value Enumerator value.
* @param IsUnsigned True if the value is unsigned.
*/
LLVMMetadataRef LLVMDIBuilderCreateEnumerator(LLVMDIBuilderRef Builder,
const char *Name, size_t NameLen,
int64_t Value,
LLVMBool IsUnsigned);

/**
* Create debugging information entry for an enumeration.
* \param Builder The DIBuilder.
Expand Down
8 changes: 8 additions & 0 deletions llvm/lib/IR/DebugInfo.cpp
Expand Up @@ -899,6 +899,14 @@ LLVMMetadataRef LLVMDILocationGetScope(LLVMMetadataRef Location) {
return wrap(unwrapDI<DILocation>(Location)->getScope());
}

LLVMMetadataRef LLVMDIBuilderCreateEnumerator(LLVMDIBuilderRef Builder,
const char *Name, size_t NameLen,
int64_t Value,
LLVMBool IsUnsigned) {
return wrap(unwrap(Builder)->createEnumerator({Name, NameLen}, Value,
IsUnsigned != 0));
}

LLVMMetadataRef LLVMDIBuilderCreateEnumerationType(
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,
Expand Down

0 comments on commit a82b613

Please sign in to comment.