llvm.org GIT mirror llvm / aaea1bf
[LLVM-C] Add Accessors for Common DIType and DILocation Properties Summary: - Adds getters for the line, column, and scope of a DILocation - Adds getters for the name, size in bits, offset in bits, alignment in bits, line, and flags of a DIType Reviewers: whitequark, harlanhaskins, deadalnix Reviewed By: whitequark Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D46627 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332014 91177308-0d34-0410-b5e6-96231b3b80d8 Robert Widmann 1 year, 4 months ago
2 changed file(s) with 115 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
384384 LLVMMetadataRef InlinedAt);
385385
386386 /**
387 * Get the line number of this debug location.
388 * \param Location The debug location.
389 *
390 * @see DILocation::getLine()
391 */
392 unsigned LLVMDILocationGetLine(LLVMMetadataRef Location);
393
394 /**
395 * Get the column number of this debug location.
396 * \param Location The debug location.
397 *
398 * @see DILocation::getColumn()
399 */
400 unsigned LLVMDILocationGetColumn(LLVMMetadataRef Location);
401
402 /**
403 * Get the local scope associated with this debug location.
404 * \param Location The debug location.
405 *
406 * @see DILocation::getScope()
407 */
408 LLVMMetadataRef LLVMDILocationGetScope(LLVMMetadataRef Location);
409
410 /**
387411 * Create a type array.
388412 * \param Builder The DIBuilder.
389413 * \param Data The type elements.
760784 LLVMMetadataRef Type);
761785
762786 /**
787 * Get the name of this DIType.
788 * \param DType The DIType.
789 * \param Length The length of the returned string.
790 *
791 * @see DIType::getName()
792 */
793 const char *LLVMDITypeGetName(LLVMMetadataRef DType, size_t *Length);
794
795 /**
796 * Get the size of this DIType in bits.
797 * \param DType The DIType.
798 *
799 * @see DIType::getSizeInBits()
800 */
801 uint64_t LLVMDITypeGetSizeInBits(LLVMMetadataRef DType);
802
803 /**
804 * Get the offset of this DIType in bits.
805 * \param DType The DIType.
806 *
807 * @see DIType::getOffsetInBits()
808 */
809 uint64_t LLVMDITypeGetOffsetInBits(LLVMMetadataRef DType);
810
811 /**
812 * Get the alignment of this DIType in bits.
813 * \param DType The DIType.
814 *
815 * @see DIType::getAlignInBits()
816 */
817 uint32_t LLVMDITypeGetAlignInBits(LLVMMetadataRef DType);
818
819 /**
820 * Get the source line where this DIType is declared.
821 * \param DType The DIType.
822 *
823 * @see DIType::getLine()
824 */
825 unsigned LLVMDITypeGetLine(LLVMMetadataRef DType);
826
827 /**
828 * Get the flags associated with this DIType.
829 * \param DType The DIType.
830 *
831 * @see DIType::getFlags()
832 */
833 LLVMDIFlags LLVMDITypeGetFlags(LLVMMetadataRef DType);
834
835 /**
763836 * Create a descriptor for a value range.
764837 * \param Builder The DIBuilder.
765838 * \param LowerBound Lower bound of the subrange, e.g. 0 for C, 1 for Fortran.
720720 return static_cast(Flags);
721721 }
722722
723 static LLVMDIFlags map_to_llvmDIFlags(DINode::DIFlags Flags) {
724 return static_cast(Flags);
725 }
726
723727 unsigned LLVMDebugMetadataVersion() {
724728 return DEBUG_METADATA_VERSION;
725729 }
882886 LLVMMetadataRef InlinedAt) {
883887 return wrap(DILocation::get(*unwrap(Ctx), Line, Column, unwrap(Scope),
884888 unwrap(InlinedAt)));
889 }
890
891 unsigned LLVMDILocationGetLine(LLVMMetadataRef Location) {
892 return unwrapDI(Location)->getLine();
893 }
894
895 unsigned LLVMDILocationGetColumn(LLVMMetadataRef Location) {
896 return unwrapDI(Location)->getColumn();
897 }
898
899 LLVMMetadataRef LLVMDILocationGetScope(LLVMMetadataRef Location) {
900 return wrap(unwrapDI(Location)->getScope());
885901 }
886902
887903 LLVMMetadataRef LLVMDIBuilderCreateEnumerationType(
11011117 return wrap(unwrap(Builder)->createArtificialType(unwrapDI(Type)));
11021118 }
11031119
1120 const char *LLVMDITypeGetName(LLVMMetadataRef DType, size_t *Length) {
1121 StringRef Str = unwrap(DType)->getName();
1122 *Length = Str.size();
1123 return Str.data();
1124 }
1125
1126 uint64_t LLVMDITypeGetSizeInBits(LLVMMetadataRef DType) {
1127 return unwrapDI(DType)->getSizeInBits();
1128 }
1129
1130 uint64_t LLVMDITypeGetOffsetInBits(LLVMMetadataRef DType) {
1131 return unwrapDI(DType)->getOffsetInBits();
1132 }
1133
1134 uint32_t LLVMDITypeGetAlignInBits(LLVMMetadataRef DType) {
1135 return unwrapDI(DType)->getAlignInBits();
1136 }
1137
1138 unsigned LLVMDITypeGetLine(LLVMMetadataRef DType) {
1139 return unwrapDI(DType)->getLine();
1140 }
1141
1142 LLVMDIFlags LLVMDITypeGetFlags(LLVMMetadataRef DType) {
1143 return map_to_llvmDIFlags(unwrapDI(DType)->getFlags());
1144 }
1145
11041146 LLVMMetadataRef LLVMDIBuilderGetOrCreateTypeArray(LLVMDIBuilderRef Builder,
11051147 LLVMMetadataRef *Types,
11061148 size_t Length) {