LLVM: lib/CodeGen/AsmPrinter/DwarfUnit.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
31#include
32#include
33#include
34#include
35
36using namespace llvm;
37
38#define DEBUG_TYPE "dwarfdebug"
39
43
44void DIEDwarfExpression::emitOp(uint8_t Op, const char* Comment) {
45 CU.addUInt(getActiveDIE(), dwarf::DW_FORM_data1, Op);
46}
47
48void DIEDwarfExpression::emitSigned(int64_t Value) {
49 CU.addSInt(getActiveDIE(), dwarf::DW_FORM_sdata, Value);
50}
51
52void DIEDwarfExpression::emitUnsigned(uint64_t Value) {
53 CU.addUInt(getActiveDIE(), dwarf::DW_FORM_udata, Value);
54}
55
56void DIEDwarfExpression::emitData1(uint8_t Value) {
57 CU.addUInt(getActiveDIE(), dwarf::DW_FORM_data1, Value);
58}
59
60void DIEDwarfExpression::emitBaseTypeRef(uint64_t Idx) {
61 CU.addBaseTypeRef(getActiveDIE(), Idx);
62}
63
65 assert(!IsBuffering && "Already buffering?");
66 IsBuffering = true;
67}
68
70
72 return TmpDIE.computeSize(AP.getDwarfFormParams());
73}
74
76
79 return MachineReg == TRI.getFrameRegister(*AP.MF);
80}
81
87
92 CU(CU), SplitLineTable(SplitLineTable) {}
93
96 B->~DIEBlock();
98 L->~DIELoc();
99}
100
101int64_t DwarfUnit::getDefaultLowerBound() const {
103 default:
104 break;
105
106
107 case dwarf::DW_LANG_C:
108 case dwarf::DW_LANG_C89:
109 case dwarf::DW_LANG_C_plus_plus:
110 return 0;
111
112 case dwarf::DW_LANG_Fortran77:
113 case dwarf::DW_LANG_Fortran90:
114 return 1;
115
116
117 case dwarf::DW_LANG_C99:
118 case dwarf::DW_LANG_ObjC:
119 case dwarf::DW_LANG_ObjC_plus_plus:
121 return 0;
122 break;
123
124 case dwarf::DW_LANG_Fortran95:
126 return 1;
127 break;
128
129
130 case dwarf::DW_LANG_D:
131 case dwarf::DW_LANG_Java:
132 case dwarf::DW_LANG_Python:
133 case dwarf::DW_LANG_UPC:
135 return 0;
136 break;
137
138 case dwarf::DW_LANG_Ada83:
139 case dwarf::DW_LANG_Ada95:
140 case dwarf::DW_LANG_Cobol74:
141 case dwarf::DW_LANG_Cobol85:
142 case dwarf::DW_LANG_Modula2:
143 case dwarf::DW_LANG_Pascal83:
144 case dwarf::DW_LANG_PLI:
146 return 1;
147 break;
148
149
150 case dwarf::DW_LANG_BLISS:
151 case dwarf::DW_LANG_C11:
152 case dwarf::DW_LANG_C_plus_plus_03:
153 case dwarf::DW_LANG_C_plus_plus_11:
154 case dwarf::DW_LANG_C_plus_plus_14:
155 case dwarf::DW_LANG_Dylan:
156 case dwarf::DW_LANG_Go:
157 case dwarf::DW_LANG_Haskell:
158 case dwarf::DW_LANG_OCaml:
159 case dwarf::DW_LANG_OpenCL:
160 case dwarf::DW_LANG_RenderScript:
161 case dwarf::DW_LANG_Rust:
162 case dwarf::DW_LANG_Swift:
164 return 0;
165 break;
166
167 case dwarf::DW_LANG_Fortran03:
168 case dwarf::DW_LANG_Fortran08:
169 case dwarf::DW_LANG_Julia:
170 case dwarf::DW_LANG_Modula3:
172 return 1;
173 break;
174 }
175
176 return -1;
177}
178
179
181
182
183
184
185
186
187
188 if (isDwoUnit() && ->shareAcrossDWOCUs())
189 return false;
192 ->generateTypeUnits();
193}
194
199}
200
208
212
214 if (DD->getDwarfVersion() >= 4)
216 else
218}
219
222 if (!Form)
224 assert(Form != dwarf::DW_FORM_implicit_const &&
225 "DW_FORM_implicit_const is used only for signed integers");
227}
228
233
236
237
239
240 int NumBytes = Val.getBitWidth() / 8;
242
243
244 for (int i = 0; i < NumBytes; i++) {
246 if (LittleEndian)
247 c = Ptr64[i / 8] >> (8 * (i & 7));
248 else
249 c = Ptr64[(NumBytes - 1 - i) / 8] >> (8 * ((NumBytes - 1 - i) & 7));
251 }
252
254}
255
259 if (CIBitWidth <= 64) {
262 else
264 return;
265 }
266
267 addIntAsBlock(Die, Attribute, Val);
268}
269
271 std::optionaldwarf::Form Form, int64_t Integer) {
272 if (!Form)
275}
276
281
284 if (CUNode->isDebugDirectivesOnly())
285 return;
286
287 if (DD->useInlineStrings()) {
291 return;
292 }
294 isDwoUnit() ? dwarf::DW_FORM_GNU_str_index : dwarf::DW_FORM_strp;
295
296 auto StringPoolEntry =
298 ? DU->getStringPool().getIndexedEntry(*Asm, String)
299 : DU->getStringPool().getEntry(*Asm, String);
300
301
303 IxForm = dwarf::DW_FORM_strx1;
304 unsigned Index = StringPoolEntry.getIndex();
305 if (Index > 0xffffff)
306 IxForm = dwarf::DW_FORM_strx4;
307 else if (Index > 0xffff)
308 IxForm = dwarf::DW_FORM_strx3;
309 else if (Index > 0xff)
310 IxForm = dwarf::DW_FORM_strx2;
311 }
313}
314
319
323
328
329unsigned DwarfTypeUnit::getOrCreateSourceID(const DIFile *File) {
330 if (!SplitLineTable)
332 if (!UsedLineTable) {
333 UsedLineTable = true;
334
336 }
337 return SplitLineTable->getFile(
338 File->getDirectory(), File->getFilename(), DD->getMD5AsBytes(File),
340}
341
343 bool UseAddrOffsetFormOrExpressions =
344 DD->useAddrOffsetForm() || DD->useAddrOffsetExpressions();
345
347 if (Label->isInSection() && UseAddrOffsetFormOrExpressions)
348 Base = DD->getSectionLabel(&Label->getSection());
349
351
352 if (DD->getDwarfVersion() >= 5) {
353 addUInt(Die, dwarf::DW_FORM_data1, dwarf::DW_OP_addrx);
354 addUInt(Die, dwarf::DW_FORM_addrx, Index);
355 } else {
356 addUInt(Die, dwarf::DW_FORM_data1, dwarf::DW_OP_GNU_addr_index);
357 addUInt(Die, dwarf::DW_FORM_GNU_addr_index, Index);
358 }
359
361 addUInt(Die, dwarf::DW_FORM_data1, dwarf::DW_OP_const4u);
363 addUInt(Die, dwarf::DW_FORM_data1, dwarf::DW_OP_plus);
364 }
365}
366
368 if (DD->getDwarfVersion() >= 5) {
370 return;
371 }
372
373 if (DD->useSplitDwarf()) {
375 return;
376 }
377
378 addUInt(Die, dwarf::DW_FORM_data1, dwarf::DW_OP_addr);
379 addLabel(Die, dwarf::DW_FORM_addr, Sym);
380}
381
387
391
393
394
395
396
397 addFlag(Die, dwarf::DW_AT_declaration);
398
399 addAttribute(Die, dwarf::DW_AT_signature, dwarf::DW_FORM_ref_sig8,
401}
402
405 const DIEUnit *CU = Die.getUnit();
406 const DIEUnit *EntryCU = Entry.getEntry().getUnit();
407 if ()
408
410 if (!EntryCU)
412 assert(EntryCU == CU || ->useSplitDwarf() || DD->shareAcrossDWOCUs() ||
413 !static_cast<const DwarfUnit*>(CU)->isDwoUnit());
415 EntryCU == CU ? dwarf::DW_FORM_ref4 : dwarf::DW_FORM_ref_addr,
416 Entry);
417}
418
421 if (N)
423 return Die;
424}
425
427 Loc->computeSize(Asm->getDwarfFormParams());
430}
431
438
443
452
454 const DIFile *File) {
455 if (Line == 0)
456 return;
457
459 addUInt(Die, dwarf::DW_AT_decl_file, std::nullopt, FileID);
460 addUInt(Die, dwarf::DW_AT_decl_line, std::nullopt, Line);
461
462 if (Column != 0)
463 addUInt(Die, dwarf::DW_AT_decl_column, std::nullopt, Column);
464}
465
471
477
480
481 addSourceLine(Die, SP->getLine(), 0, SP->getFile());
482}
483
486
487 addSourceLine(Die, L->getLine(), L->getColumn(), L->getFile());
488}
489
492
493 addSourceLine(Die, Ty->getLine(), 0, Ty->getFile());
494}
495
498
499 addSourceLine(Die, Ty->getLine(), 0, Ty->getFile());
500}
501
506
511
515
517
518
519 addUInt(Die, dwarf::DW_AT_const_value,
520 Unsigned ? dwarf::DW_FORM_udata : dwarf::DW_FORM_sdata, Val);
521}
522
526
529 if (CIBitWidth <= 64) {
532 return;
533 }
534
535 addIntAsBlock(Die, dwarf::DW_AT_const_value, Val);
536}
537
541 DD->getDwarfVersion() >= 4 ? dwarf::DW_AT_linkage_name
542 : dwarf::DW_AT_MIPS_linkage_name,
544}
545
547
548 for (const auto *Element : TParams) {
550 constructTemplateTypeParameterDIE(Buffer, TTP);
552 constructTemplateValueParameterDIE(Buffer, TVP);
553 }
554}
555
556
558 for (const auto *Ty : ThrownTypes) {
561 }
562}
563
566 addUInt(Die, dwarf::DW_AT_accessibility, dwarf::DW_FORM_data1,
569 addUInt(Die, dwarf::DW_AT_accessibility, dwarf::DW_FORM_data1,
572 addUInt(Die, dwarf::DW_AT_accessibility, dwarf::DW_FORM_data1,
574}
575
587 return getDIE(Context);
588}
589
591 auto *Context = Ty->getScope();
593
595 return TyDIE;
596
597
599
601
603 return &TyDIE;
604}
605
608
610
611 auto construct = [&](const auto *Ty) {
614 };
615
617 if (DD->generateTypeUnits() && !Ty->isForwardDecl() &&
618 (Ty->getRawName() || CTy->getRawIdentifier())) {
619
620 if (MDString *TypeId = CTy->getRawIdentifier()) {
622 DD->addDwarfTypeUnitType(getCU(), TypeId->getString(), TyDIE, CTy);
623 } else {
625 finishNonUnitTypeDIE(TyDIE, CTy);
626 }
627 return &TyDIE;
628 }
629 construct(CTy);
631 construct(FPT);
633 construct(BT);
635 construct(ST);
637 construct(STy);
639 constructSubrangeDIE(TyDIE, SRTy);
640 else
642
643 return &TyDIE;
644}
645
647 if (!TyNode)
648 return nullptr;
649
651
652
653 if (Ty->getTag() == dwarf::DW_TAG_restrict_type && DD->getDwarfVersion() <= 2)
655
656
657 if (Ty->getTag() == dwarf::DW_TAG_atomic_type && DD->getDwarfVersion() < 5)
659
660
661
662 auto *Context = Ty->getScope();
665
667 return TyDIE;
668
670 ->createTypeDIE(Context, *ContextDIE, Ty);
671}
672
674 const DIType *Ty, const DIE &TyDIE) {
675 if (Ty->getName().empty())
676 return;
677 if (Ty->isForwardDecl())
678 return;
679
680
681
682 unsigned Flags = 0;
684
685
686 if (CT->getRuntimeLang() == 0 || CT->isObjcClassComplete())
688 }
689
690 DD->addAccelType(*this, CUNode->getNameTableKind(), Ty->getName(), TyDIE,
691 Flags);
692
694 if (Ty->getName() != CT->getIdentifier() &&
695 CT->getRuntimeLang() == dwarf::DW_LANG_Swift)
696 DD->addAccelType(*this, CUNode->getNameTableKind(), CT->getIdentifier(),
697 TyDIE, Flags);
698
700}
701
708
711 assert(Ty && "Trying to add a type that doesn't exist?");
713}
714
715
717 const auto &Lang = getLanguage();
718
719 if (!Lang.hasVersionedName())
721
724 Lang.getVersion())
726}
727
729 if (!Context)
730 return "";
731
732
734 return "";
735
736 std::string CS;
739 Parents.push_back(Context);
741 Context = S;
742 else
743
744
745 break;
746 }
747
748
749
753 Name = "(anonymous namespace)";
754 if (!Name.empty()) {
755 CS += Name;
756 CS += "::";
757 }
758 }
759 return CS;
760}
761
763
765
766 if (!Name.empty())
767 addString(Buffer, dwarf::DW_AT_name, Name);
768
769
770 if (BTy->getTag() == dwarf::DW_TAG_unspecified_type)
771 return;
772
773 if (BTy->getTag() != dwarf::DW_TAG_string_type)
774 addUInt(Buffer, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1,
776
778 addUInt(Buffer, dwarf::DW_AT_byte_size, std::nullopt, SizeInBytes);
779 if (BTy->getTag() == dwarf::Tag::DW_TAG_base_type) {
780
781
782
783
784
785
787 DataSizeInBits && DataSizeInBits != SizeInBytes * 8)
788 addUInt(Buffer, dwarf::DW_AT_bit_size, std::nullopt, DataSizeInBits);
789 }
790
792 addUInt(Buffer, dwarf::DW_AT_endianity, std::nullopt, dwarf::DW_END_big);
794 addUInt(Buffer, dwarf::DW_AT_endianity, std::nullopt, dwarf::DW_END_little);
795
797 addUInt(Buffer, dwarf::DW_AT_LLVM_num_extra_inhabitants, std::nullopt,
798 NumExtraInhabitants);
799}
800
802
803 constructTypeDIE(Buffer, static_cast<const DIBasicType *>(BTy));
804
806 addSInt(Buffer, dwarf::DW_AT_binary_scale, dwarf::DW_FORM_sdata,
809 addSInt(Buffer, dwarf::DW_AT_decimal_scale, dwarf::DW_FORM_sdata,
811 else {
815
820
821 addDIEEntry(Buffer, dwarf::DW_AT_small, Constant);
822 }
823}
824
826
828
829 if (.empty())
830 addString(Buffer, dwarf::DW_AT_name, Name);
831
833 if (auto *VarDIE = getDIE(Var))
834 addDIEEntry(Buffer, dwarf::DW_AT_string_length, *VarDIE);
836 addBlock(Buffer, dwarf::DW_AT_string_length, Expr);
837 } else {
839 addUInt(Buffer, dwarf::DW_AT_byte_size, std::nullopt, Size);
840 }
841
843 addBlock(Buffer, dwarf::DW_AT_data_location, Expr);
844 }
845
847
848 addUInt(Buffer, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1,
850 }
851}
852
854
858
859
860 const DIType *FromTy = DTy->getBaseType();
861 if (FromTy)
863
864
865 if (.empty())
866 addString(Buffer, dwarf::DW_AT_name, Name);
867
869
870
871
872 if (Tag == dwarf::DW_TAG_typedef && DD->getDwarfVersion() >= 5) {
874 if (AlignInBytes > 0)
875 addUInt(Buffer, dwarf::DW_AT_alignment, dwarf::DW_FORM_udata,
876 AlignInBytes);
877 }
878
879
880 if (Size && Tag != dwarf::DW_TAG_pointer_type
881 && Tag != dwarf::DW_TAG_ptr_to_member_type
882 && Tag != dwarf::DW_TAG_reference_type
883 && Tag != dwarf::DW_TAG_rvalue_reference_type)
884 addUInt(Buffer, dwarf::DW_AT_byte_size, std::nullopt, Size);
885
886 if (Tag == dwarf::DW_TAG_ptr_to_member_type)
887 addDIEEntry(Buffer, dwarf::DW_AT_containing_type,
889
891
892
895
896
897
898
899 if (DTy->getDWARFAddressSpace())
900 addUInt(Buffer, dwarf::DW_AT_address_class, dwarf::DW_FORM_data4,
901 *DTy->getDWARFAddressSpace());
902
903
904 if (Tag == dwarf::DW_TAG_template_alias)
906
907 if (auto PtrAuthData = DTy->getPtrAuthData()) {
908 addUInt(Buffer, dwarf::DW_AT_LLVM_ptrauth_key, dwarf::DW_FORM_data1,
909 PtrAuthData->key());
910 if (PtrAuthData->isAddressDiscriminated())
911 addFlag(Buffer, dwarf::DW_AT_LLVM_ptrauth_address_discriminated);
912 addUInt(Buffer, dwarf::DW_AT_LLVM_ptrauth_extra_discriminator,
913 dwarf::DW_FORM_data2, PtrAuthData->extraDiscriminator());
914 if (PtrAuthData->isaPointer())
915 addFlag(Buffer, dwarf::DW_AT_LLVM_ptrauth_isa_pointer);
916 if (PtrAuthData->authenticatesNullValues())
917 addFlag(Buffer, dwarf::DW_AT_LLVM_ptrauth_authenticates_null_values);
918 }
919}
920
921std::optional
923
924 std::optional ObjectPointerIndex;
925 for (unsigned i = 1, N = Args.size(); i < N; ++i) {
926 const DIType *Ty = Args[i];
927 if (!Ty) {
928 assert(i == N-1 && "Unspecified parameter must be the last argument");
929 createAndAddDIE(dwarf::DW_TAG_unspecified_parameters, Buffer);
930 } else {
933 if (Ty->isArtificial())
934 addFlag(Arg, dwarf::DW_AT_artificial);
935
936 if (Ty->isObjectPointer()) {
937 assert(!ObjectPointerIndex &&
938 "Can't have more than one object pointer");
939 ObjectPointerIndex = i;
940 }
941 }
942 }
943
944 return ObjectPointerIndex;
945}
946
948
950 if (Elements.size())
951 if (auto RTy = Elements[0])
953
954 bool isPrototyped = true;
955 if (Elements.size() == 2 && !Elements[1])
956 isPrototyped = false;
957
959
960
961
963 addFlag(Buffer, dwarf::DW_AT_prototyped);
964
965
966 if (CTy->getCC() && CTy->getCC() != dwarf::DW_CC_normal)
967 addUInt(Buffer, dwarf::DW_AT_calling_convention, dwarf::DW_FORM_data1,
969
971 addFlag(Buffer, dwarf::DW_AT_reference);
972
974 addFlag(Buffer, dwarf::DW_AT_rvalue_reference);
975}
976
979 return;
980
985
986 DIE &AnnotationDie = createAndAddDIE(dwarf::DW_TAG_LLVM_annotation, Buffer);
987 addString(AnnotationDie, dwarf::DW_AT_name, Name->getString());
989 addString(AnnotationDie, dwarf::DW_AT_const_value, Data->getString());
992 true);
993 else
994 assert(false && "Unsupported annotation value type");
995 }
996}
997
998void DwarfUnit::addDiscriminant(DIE &Variant, Constant *Discriminant,
999 bool IsUnsigned) {
1001 addInt(Variant, dwarf::DW_AT_discr_value, CI->getValue(), IsUnsigned);
1002 } else if (const auto *CA =
1004
1005 unsigned NElems = CA->getNumElements();
1006 if (NElems % 2 != 0) {
1007 return;
1008 }
1009
1011
1012 auto AddInt = [&](const APInt &Val) {
1013 if (IsUnsigned)
1015 else
1017 };
1018
1019 for (unsigned I = 0; I < NElems; I += 2) {
1020 APInt LV = CA->getElementAsAPInt(I);
1021 APInt HV = CA->getElementAsAPInt(I + 1);
1022 if (LV == HV) {
1024 AddInt(LV);
1025 } else {
1027 AddInt(LV);
1028 AddInt(HV);
1029 }
1030 }
1031 addBlock(Variant, dwarf::DW_AT_discr_list, Block);
1032 }
1033}
1034
1036
1038
1040
1041 switch (Tag) {
1042 case dwarf::DW_TAG_array_type:
1043 constructArrayTypeDIE(Buffer, CTy);
1044 break;
1045 case dwarf::DW_TAG_enumeration_type:
1046 constructEnumTypeDIE(Buffer, CTy);
1047 break;
1048 case dwarf::DW_TAG_variant_part:
1049 case dwarf::DW_TAG_variant:
1050 case dwarf::DW_TAG_structure_type:
1051 case dwarf::DW_TAG_union_type:
1052 case dwarf::DW_TAG_class_type:
1053 case dwarf::DW_TAG_namelist: {
1054
1056 if (Tag == dwarf::DW_TAG_variant_part) {
1058 if (Discriminator) {
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069 DIE *DiscDIE = getDIE(Discriminator);
1070 if (DiscDIE == nullptr) {
1071 DiscDIE = &constructMemberDIE(Buffer, Discriminator);
1072 }
1073 addDIEEntry(Buffer, dwarf::DW_AT_discr, *DiscDIE);
1074 }
1075 }
1076
1077
1078 if (Tag == dwarf::DW_TAG_class_type ||
1079 Tag == dwarf::DW_TAG_structure_type || Tag == dwarf::DW_TAG_union_type)
1081
1082
1083 DINodeArray Elements = CTy->getElements();
1084 for (const auto *Element : Elements) {
1085 if (!Element)
1086 continue;
1090 if (DDTy->getTag() == dwarf::DW_TAG_friend) {
1092 addType(ElemDie, DDTy->getBaseType(), dwarf::DW_AT_friend);
1093 } else if (DDTy->isStaticMember()) {
1095 } else if (Tag == dwarf::DW_TAG_variant_part) {
1096
1097
1099 if (Constant *CI = DDTy->getDiscriminantValue()) {
1100 addDiscriminant(Variant, CI,
1101 DD->isUnsignedDIType(Discriminator->getBaseType()));
1102 }
1103
1104
1105
1106 if (auto *Composite =
1108 Composite != nullptr &&
1109 Composite->getTag() == dwarf::DW_TAG_variant) {
1111 } else {
1112 constructMemberDIE(Variant, DDTy);
1113 }
1114 } else {
1115 constructMemberDIE(Buffer, DDTy);
1116 }
1118 DIE &ElemDie = createAndAddDIE(Property->getTag(), Buffer, Property);
1119 StringRef PropertyName = Property->getName();
1120 addString(ElemDie, dwarf::DW_AT_APPLE_property_name, PropertyName);
1121 if (Property->getType())
1122 addType(ElemDie, Property->getType());
1124 StringRef GetterName = Property->getGetterName();
1125 if (!GetterName.empty())
1126 addString(ElemDie, dwarf::DW_AT_APPLE_property_getter, GetterName);
1127 StringRef SetterName = Property->getSetterName();
1128 if (!SetterName.empty())
1129 addString(ElemDie, dwarf::DW_AT_APPLE_property_setter, SetterName);
1130 if (unsigned PropertyAttributes = Property->getAttributes())
1131 addUInt(ElemDie, dwarf::DW_AT_APPLE_property_attribute, std::nullopt,
1132 PropertyAttributes);
1134 if (Composite->getTag() == dwarf::DW_TAG_variant_part) {
1137 }
1138 } else if (Tag == dwarf::DW_TAG_namelist) {
1140 auto *VarDIE = getDIE(Var);
1141 if (VarDIE) {
1142 DIE &ItemDie = createAndAddDIE(dwarf::DW_TAG_namelist_item, Buffer);
1143 addDIEEntry(ItemDie, dwarf::DW_AT_namelist_item, *VarDIE);
1144 }
1145 }
1146 }
1147
1149 addFlag(Buffer, dwarf::DW_AT_APPLE_block);
1150
1152 addFlag(Buffer, dwarf::DW_AT_export_symbols);
1153
1154
1155
1156
1157
1159 addDIEEntry(Buffer, dwarf::DW_AT_containing_type,
1161
1163 addFlag(Buffer, dwarf::DW_AT_APPLE_objc_complete_type);
1164
1165
1166
1167 if (->TM.Options.DebugStrictDwarf || DD->getDwarfVersion() >= 5) {
1170 CC = dwarf::DW_CC_pass_by_value;
1172 CC = dwarf::DW_CC_pass_by_reference;
1173 if (CC)
1174 addUInt(Buffer, dwarf::DW_AT_calling_convention, dwarf::DW_FORM_data1,
1175 CC);
1176 }
1177
1179 addDIEEntry(Buffer, dwarf::DW_AT_specification,
1181
1182 break;
1183 }
1184 default:
1185 break;
1186 }
1187
1188
1189 if (!Name.empty())
1190 addString(Buffer, dwarf::DW_AT_name, Name);
1191
1192
1195
1197
1198 if (Tag == dwarf::DW_TAG_enumeration_type ||
1199 Tag == dwarf::DW_TAG_class_type || Tag == dwarf::DW_TAG_structure_type ||
1200 Tag == dwarf::DW_TAG_union_type) {
1202 if (auto *VarDIE = getDIE(Var))
1203 addDIEEntry(Buffer, dwarf::DW_AT_bit_size, *VarDIE);
1204 } else if (auto *Exp =
1206 addBlock(Buffer, dwarf::DW_AT_bit_size, Exp);
1207 } else {
1209
1210
1211
1213 (!CTy->isForwardDecl() || Tag == dwarf::DW_TAG_enumeration_type))
1214 addUInt(Buffer, dwarf::DW_AT_byte_size, std::nullopt, Size);
1216
1217 addUInt(Buffer, dwarf::DW_AT_byte_size, std::nullopt, 0);
1218 }
1219
1220
1222 addFlag(Buffer, dwarf::DW_AT_declaration);
1223
1224
1226
1227
1230
1231
1233 if (RLang)
1234 addUInt(Buffer, dwarf::DW_AT_APPLE_runtime_class, dwarf::DW_FORM_data1,
1235 RLang);
1236
1237
1239 addUInt(Buffer, dwarf::DW_AT_alignment, dwarf::DW_FORM_udata,
1240 AlignInBytes);
1241
1243 addUInt(Buffer, dwarf::DW_AT_LLVM_num_extra_inhabitants, std::nullopt,
1244 NumExtraInhabitants);
1245 }
1246}
1247
1248void DwarfUnit::constructTemplateTypeParameterDIE(
1250 DIE &ParamDIE =
1251 createAndAddDIE(dwarf::DW_TAG_template_type_parameter, Buffer);
1252
1257 if (TP->isDefault() && isCompatibleWithVersion(5))
1258 addFlag(ParamDIE, dwarf::DW_AT_default_value);
1259}
1260
1261void DwarfUnit::constructTemplateValueParameterDIE(
1264
1265
1266
1267 if (VP->getTag() == dwarf::DW_TAG_template_value_parameter)
1271 if (VP->isDefault() && isCompatibleWithVersion(5))
1272 addFlag(ParamDIE, dwarf::DW_AT_default_value);
1279
1280
1281 if (!GV->hasDLLImportStorageClass()) {
1282
1283
1286
1287
1288 addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_stack_value);
1289 addBlock(ParamDIE, dwarf::DW_AT_location, Loc);
1290 }
1291 } else if (VP->getTag() == dwarf::DW_TAG_GNU_template_template_param) {
1293 addString(ParamDIE, dwarf::DW_AT_GNU_template_name,
1295 } else if (VP->getTag() == dwarf::DW_TAG_GNU_template_parameter_pack) {
1297 }
1298 }
1299}
1300
1302
1303
1305
1307 return NDie;
1308 DIE &NDie = createAndAddDIE(dwarf::DW_TAG_namespace, *ContextDIE, NS);
1309
1311 if (!Name.empty())
1313 else
1314 Name = "(anonymous namespace)";
1315 DD->addAccelNamespace(*this, CUNode->getNameTableKind(), Name, NDie);
1318 addFlag(NDie, dwarf::DW_AT_export_symbols);
1319 return &NDie;
1320}
1321
1323
1324
1326
1328 return MDie;
1330
1331 if (!M->getName().empty()) {
1332 addString(MDie, dwarf::DW_AT_name, M->getName());
1333 addGlobalName(M->getName(), MDie, M->getScope());
1334 }
1335 if (!M->getConfigurationMacros().empty())
1336 addString(MDie, dwarf::DW_AT_LLVM_config_macros,
1337 M->getConfigurationMacros());
1338 if (!M->getIncludePath().empty())
1339 addString(MDie, dwarf::DW_AT_LLVM_include_path, M->getIncludePath());
1340 if (!M->getAPINotesFile().empty())
1341 addString(MDie, dwarf::DW_AT_LLVM_apinotes, M->getAPINotesFile());
1342 if (M->getFile())
1343 addUInt(MDie, dwarf::DW_AT_decl_file, std::nullopt,
1345 if (M->getLineNo())
1346 addUInt(MDie, dwarf::DW_AT_decl_line, std::nullopt, M->getLineNo());
1347 if (M->getIsDecl())
1348 addFlag(MDie, dwarf::DW_AT_declaration);
1349
1350 return &MDie;
1351}
1352
1354 const Function *FnHint, bool Minimal) {
1355
1356
1357
1358 DIE *ContextDIE =
1360
1362 return SPDie;
1363
1364 if (auto *SPDecl = SP->getDeclaration()) {
1365 if (!Minimal) {
1366
1368
1369
1370
1371
1372
1374 return SPDie;
1375 }
1376 }
1377
1378
1379 DIE &SPDie = createAndAddDIE(dwarf::DW_TAG_subprogram, *ContextDIE, SP);
1380
1381
1382
1383 if (SP->isDefinition())
1384 return &SPDie;
1385
1387 ->applySubprogramAttributes(SP, SPDie);
1388 return &SPDie;
1389}
1390
1392 DIE &SPDie, bool Minimal) {
1393 DIE *DeclDie = nullptr;
1395 if (auto *SPDecl = SP->getDeclaration()) {
1396 if (!Minimal) {
1398 DeclArgs = SPDecl->getType()->getTypeArray();
1399 DefinitionArgs = SP->getType()->getTypeArray();
1400
1401 if (DeclArgs.size() && DefinitionArgs.size())
1402 if (DefinitionArgs[0] != nullptr && DeclArgs[0] != DefinitionArgs[0])
1403 addType(SPDie, DefinitionArgs[0]);
1404
1405 DeclDie = getDIE(SPDecl);
1406 assert(DeclDie && "This DIE should've already been constructed when the "
1407 "definition DIE was created in "
1408 "getOrCreateSubprogramDIE");
1409
1410 if (DD->useAllLinkageNames())
1411 DeclLinkageName = SPDecl->getLinkageName();
1414 if (DeclID != DefID)
1415 addUInt(SPDie, dwarf::DW_AT_decl_file, std::nullopt, DefID);
1416
1417 if (SP->getLine() != SPDecl->getLine())
1418 addUInt(SPDie, dwarf::DW_AT_decl_line, std::nullopt, SP->getLine());
1419 }
1420 }
1421
1422
1424
1425
1427
1429 (DD->useAllLinkageNames() || DU->getAbstractScopeDIEs().lookup(SP)))
1431
1432 if (!DeclDie)
1433 return false;
1434
1435
1436
1437 addDIEEntry(SPDie, dwarf::DW_AT_specification, *DeclDie);
1438 return true;
1439}
1440
1442 bool SkipSPAttributes) {
1443
1444
1445 bool SkipSPSourceLocation = SkipSPAttributes &&
1446 ->getDebugInfoForProfiling();
1447 if (!SkipSPSourceLocation)
1449 return;
1450
1451
1452 if (!SP->getName().empty())
1453 addString(SPDie, dwarf::DW_AT_name, SP->getName());
1454
1456
1457 if (!SkipSPSourceLocation)
1459
1460
1461 if (SkipSPAttributes)
1462 return;
1463
1464
1465
1467 addFlag(SPDie, dwarf::DW_AT_prototyped);
1468
1469 if (SP->isObjCDirect())
1470 addFlag(SPDie, dwarf::DW_AT_APPLE_objc_direct);
1471
1472 unsigned CC = 0;
1475 Args = SPTy->getTypeArray();
1476 CC = SPTy->getCC();
1477 }
1478
1479
1480 if (CC && CC != dwarf::DW_CC_normal)
1481 addUInt(SPDie, dwarf::DW_AT_calling_convention, dwarf::DW_FORM_data1, CC);
1482
1483
1484
1485 if (Args.size())
1486 if (auto Ty = Args[0])
1488
1489 unsigned VK = SP->getVirtuality();
1490 if (VK) {
1491 addUInt(SPDie, dwarf::DW_AT_virtuality, dwarf::DW_FORM_data1, VK);
1492 if (SP->getVirtualIndex() != -1u) {
1494 addUInt(*Block, dwarf::DW_FORM_data1, dwarf::DW_OP_constu);
1495 addUInt(*Block, dwarf::DW_FORM_udata, SP->getVirtualIndex());
1496 addBlock(SPDie, dwarf::DW_AT_vtable_elem_location, Block);
1497 }
1498 ContainingTypeMap.insert(std::make_pair(&SPDie, SP->getContainingType()));
1499 }
1500
1501 if (!SP->isDefinition()) {
1502 addFlag(SPDie, dwarf::DW_AT_declaration);
1503
1504
1505
1506
1507
1508
1509 if (std::optional ObjectPointerIndex =
1513
1514
1515 assert(*ObjectPointerIndex > 0);
1516 addSInt(SPDie, dwarf::DW_AT_object_pointer,
1517 dwarf::DW_FORM_implicit_const, *ObjectPointerIndex - 1);
1518 }
1519 }
1520 }
1521
1523
1524 if (SP->isArtificial())
1525 addFlag(SPDie, dwarf::DW_AT_artificial);
1526
1527 if (!SP->isLocalToUnit())
1528 addFlag(SPDie, dwarf::DW_AT_external);
1529
1530 if (DD->useAppleExtensionAttributes()) {
1531 if (SP->isOptimized())
1532 addFlag(SPDie, dwarf::DW_AT_APPLE_optimized);
1533
1534 if (unsigned isa = Asm->getISAEncoding())
1535 addUInt(SPDie, dwarf::DW_AT_APPLE_isa, dwarf::DW_FORM_flag, isa);
1536 }
1537
1538 if (SP->isLValueReference())
1539 addFlag(SPDie, dwarf::DW_AT_reference);
1540
1541 if (SP->isRValueReference())
1542 addFlag(SPDie, dwarf::DW_AT_rvalue_reference);
1543
1544 if (SP->isNoReturn())
1545 addFlag(SPDie, dwarf::DW_AT_noreturn);
1546
1547 addAccess(SPDie, SP->getFlags());
1548
1549 if (SP->isExplicit())
1550 addFlag(SPDie, dwarf::DW_AT_explicit);
1551
1552 if (SP->isMainSubprogram())
1553 addFlag(SPDie, dwarf::DW_AT_main_subprogram);
1554 if (SP->isPure())
1555 addFlag(SPDie, dwarf::DW_AT_pure);
1556 if (SP->isElemental())
1557 addFlag(SPDie, dwarf::DW_AT_elemental);
1558 if (SP->isRecursive())
1559 addFlag(SPDie, dwarf::DW_AT_recursive);
1560
1561 if (!SP->getTargetFuncName().empty())
1562 addString(SPDie, dwarf::DW_AT_trampoline, SP->getTargetFuncName());
1563
1564 if (DD->getDwarfVersion() >= 5 && SP->isDeleted())
1565 addFlag(SPDie, dwarf::DW_AT_deleted);
1566}
1567
1568void DwarfUnit::constructSubrangeDIE(DIE &DW_Subrange, const DISubrangeType *SR,
1569 bool ForArray) {
1571 if (!Name.empty())
1572 addString(DW_Subrange, dwarf::DW_AT_name, Name);
1573
1576
1578
1580 addUInt(DW_Subrange, dwarf::DW_AT_byte_size, std::nullopt, Size >> 3);
1582 addUInt(DW_Subrange, dwarf::DW_AT_alignment, dwarf::DW_FORM_udata,
1583 AlignInBytes);
1584
1586 addUInt(DW_Subrange, dwarf::DW_AT_endianity, std::nullopt,
1587 dwarf::DW_END_big);
1589 addUInt(DW_Subrange, dwarf::DW_AT_endianity, std::nullopt,
1590 dwarf::DW_END_little);
1591
1592
1593
1594 int64_t DefaultLowerBound = getDefaultLowerBound();
1595
1599 if (auto *VarDIE = getDIE(BV))
1600 addDIEEntry(DW_Subrange, Attr, *VarDIE);
1602 if (auto *DTDIE = getDIE(DT))
1605 addBlock(DW_Subrange, Attr, BE);
1607 if (Attr == dwarf::DW_AT_GNU_bias) {
1608 if (BI->getSExtValue() != 0)
1609 addUInt(DW_Subrange, Attr, dwarf::DW_FORM_sdata, BI->getSExtValue());
1610 } else if (Attr != dwarf::DW_AT_lower_bound || DefaultLowerBound == -1 ||
1611 BI->getSExtValue() != DefaultLowerBound || !ForArray)
1612 addSInt(DW_Subrange, Attr, dwarf::DW_FORM_sdata, BI->getSExtValue());
1613 }
1614 };
1615
1616 AddBoundTypeEntry(dwarf::DW_AT_lower_bound, SR->getLowerBound());
1617
1618 AddBoundTypeEntry(dwarf::DW_AT_upper_bound, SR->getUpperBound());
1619
1620 AddBoundTypeEntry(dwarf::DW_AT_bit_stride, SR->getStride());
1621
1622 AddBoundTypeEntry(dwarf::DW_AT_GNU_bias, SR->getBias());
1623}
1624
1625void DwarfUnit::constructSubrangeDIE(DIE &Buffer, const DISubrange *SR) {
1626 DIE &DW_Subrange = createAndAddDIE(dwarf::DW_TAG_subrange_type, Buffer);
1627
1628 DIE *IdxTy = getIndexTyDie();
1629 addDIEEntry(DW_Subrange, dwarf::DW_AT_type, *IdxTy);
1630
1631
1632
1633
1634
1635 int64_t DefaultLowerBound = getDefaultLowerBound();
1636
1638 DISubrange::BoundType Bound) -> void {
1640 if (auto *VarDIE = getDIE(BV))
1641 addDIEEntry(DW_Subrange, Attr, *VarDIE);
1643 addBlock(DW_Subrange, Attr, BE);
1645 if (Attr == dwarf::DW_AT_count) {
1646 if (BI->getSExtValue() != -1)
1647 addUInt(DW_Subrange, Attr, std::nullopt, BI->getSExtValue());
1648 } else if (Attr != dwarf::DW_AT_lower_bound || DefaultLowerBound == -1 ||
1649 BI->getSExtValue() != DefaultLowerBound)
1650 addSInt(DW_Subrange, Attr, dwarf::DW_FORM_sdata, BI->getSExtValue());
1651 }
1652 };
1653
1654 AddBoundTypeEntry(dwarf::DW_AT_lower_bound, SR->getLowerBound());
1655
1656 AddBoundTypeEntry(dwarf::DW_AT_count, SR->getCount());
1657
1658 AddBoundTypeEntry(dwarf::DW_AT_upper_bound, SR->getUpperBound());
1659
1660 AddBoundTypeEntry(dwarf::DW_AT_byte_stride, SR->getStride());
1661}
1662
1663void DwarfUnit::constructGenericSubrangeDIE(DIE &Buffer,
1665 DIE &DwGenericSubrange =
1666 createAndAddDIE(dwarf::DW_TAG_generic_subrange, Buffer);
1667
1668
1669
1670 DIE *IdxTy = getIndexTyDie();
1671 addDIEEntry(DwGenericSubrange, dwarf::DW_AT_type, *IdxTy);
1672
1673 int64_t DefaultLowerBound = getDefaultLowerBound();
1674
1678 if (auto *VarDIE = getDIE(BV))
1679 addDIEEntry(DwGenericSubrange, Attr, *VarDIE);
1681 if (BE->isConstant() &&
1683 *BE->isConstant()) {
1684 if (Attr != dwarf::DW_AT_lower_bound || DefaultLowerBound == -1 ||
1685 static_cast<int64_t>(BE->getElement(1)) != DefaultLowerBound)
1686 addSInt(DwGenericSubrange, Attr, dwarf::DW_FORM_sdata,
1687 BE->getElement(1));
1688 } else {
1689 addBlock(DwGenericSubrange, Attr, BE);
1690 }
1691 }
1692 };
1693
1694 AddBoundTypeEntry(dwarf::DW_AT_lower_bound, GSR->getLowerBound());
1695 AddBoundTypeEntry(dwarf::DW_AT_count, GSR->getCount());
1696 AddBoundTypeEntry(dwarf::DW_AT_upper_bound, GSR->getUpperBound());
1697 AddBoundTypeEntry(dwarf::DW_AT_byte_stride, GSR->getStride());
1698}
1699
1700DIE *DwarfUnit::getIndexTyDie() {
1703
1705 StringRef Name = "__ARRAY_SIZE_TYPE__";
1707 addUInt(*IndexTyDie, dwarf::DW_AT_byte_size, std::nullopt, sizeof(int64_t));
1708 addUInt(*IndexTyDie, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1,
1710 DD->addAccelType(*this, CUNode->getNameTableKind(), Name, *IndexTyDie,
1711 0);
1713}
1714
1715
1716
1717
1719 assert(CTy && CTy->isVector() && "Composite type is not a vector");
1721
1722
1724 assert(BaseTy && "Unknown vector element type.");
1726
1727
1728 const DINodeArray Elements = CTy->getElements();
1729 assert(Elements.size() == 1 &&
1730 Elements[0]->getTag() == dwarf::DW_TAG_subrange_type &&
1731 "Invalid vector element array, expected one element of type subrange");
1733 const auto NumVecElements =
1734 Subrange->getCount()
1736 : 0;
1737
1738
1739
1740 assert(ActualSize >= (NumVecElements * ElementSize) && "Invalid vector size");
1741 return ActualSize != (NumVecElements * ElementSize);
1742}
1743
1744void DwarfUnit::constructArrayTypeDIE(DIE &Buffer, const DICompositeType *CTy) {
1746 addFlag(Buffer, dwarf::DW_AT_GNU_vector);
1748 addUInt(Buffer, dwarf::DW_AT_byte_size, std::nullopt,
1750 }
1751
1753 if (auto *VarDIE = getDIE(Var))
1754 addDIEEntry(Buffer, dwarf::DW_AT_data_location, *VarDIE);
1756 addBlock(Buffer, dwarf::DW_AT_data_location, Expr);
1757 }
1758
1760 if (auto *VarDIE = getDIE(Var))
1761 addDIEEntry(Buffer, dwarf::DW_AT_associated, *VarDIE);
1763 addBlock(Buffer, dwarf::DW_AT_associated, Expr);
1764 }
1765
1766 if (DIVariable *Var = CTy->getAllocated()) {
1767 if (auto *VarDIE = getDIE(Var))
1768 addDIEEntry(Buffer, dwarf::DW_AT_allocated, *VarDIE);
1769 } else if (DIExpression *Expr = CTy->getAllocatedExp()) {
1770 addBlock(Buffer, dwarf::DW_AT_allocated, Expr);
1771 }
1772
1773 if (auto *RankConst = CTy->getRankConst()) {
1774 addSInt(Buffer, dwarf::DW_AT_rank, dwarf::DW_FORM_sdata,
1775 RankConst->getSExtValue());
1776 } else if (auto *RankExpr = CTy->getRankExp()) {
1777 addBlock(Buffer, dwarf::DW_AT_rank, RankExpr);
1778 }
1779
1781 addUInt(Buffer, dwarf::DW_AT_bit_stride, {}, BitStride->getZExtValue());
1782 }
1783
1784
1786
1787
1789 for (DINode *E : Elements) {
1791 DIE &TyDIE = createAndAddDIE(Element->getTag(), Buffer, CTy);
1792 constructSubrangeDIE(TyDIE, Element, true);
1794 constructSubrangeDIE(Buffer, Element);
1796 constructGenericSubrangeDIE(Buffer, Element);
1797 }
1798}
1799
1800void DwarfUnit::constructEnumTypeDIE(DIE &Buffer, const DICompositeType *CTy) {
1802 bool IsUnsigned = DTy && DD->isUnsignedDIType(DTy);
1803 if (DTy) {
1804 if (->TM.Options.DebugStrictDwarf || DD->getDwarfVersion() >= 3)
1806 if (DD->getDwarfVersion() >= 4 && (CTy->getFlags() & DINode::FlagEnumClass))
1807 addFlag(Buffer, dwarf::DW_AT_enum_class);
1808 }
1809
1811 addUInt(Buffer, dwarf::DW_AT_APPLE_enum_kind, dwarf::DW_FORM_data1, *Kind);
1812
1817
1818
1819 for (const DINode *E : Elements) {
1821 if (Enum) {
1823 StringRef Name = Enum->getName();
1826 if (IndexEnumerators)
1828 }
1829 }
1830}
1831
1836 if ()
1837 continue;
1839 if (!NDie)
1840 continue;
1841 addDIEEntry(SPDie, dwarf::DW_AT_containing_type, *NDie);
1842 }
1843}
1844
1845DIE &DwarfUnit::constructMemberDIE(DIE &Buffer, const DIDerivedType *DT) {
1848 if (!Name.empty())
1849 addString(MemberDie, dwarf::DW_AT_name, Name);
1850
1852
1853 if (DIType *Resolved = DT->getBaseType())
1854 addType(MemberDie, Resolved);
1855
1857
1858 if (DT->getTag() == dwarf::DW_TAG_inheritance && DT->isVirtual()) {
1859
1860
1861
1862
1863
1865 addUInt(*VBaseLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_dup);
1866 addUInt(*VBaseLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);
1867 addUInt(*VBaseLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_constu);
1869 addUInt(*VBaseLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_minus);
1870 addUInt(*VBaseLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);
1871 addUInt(*VBaseLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_plus);
1872
1873 addBlock(MemberDie, dwarf::DW_AT_data_member_location, VBaseLocationDie);
1874 } else {
1877
1879
1880
1882
1884 if (auto *VarDIE = getDIE(Var))
1885 addDIEEntry(MemberDie, dwarf::DW_AT_bit_size, *VarDIE);
1887 addBlock(MemberDie, dwarf::DW_AT_bit_size, Exp);
1888 } else {
1890 FieldSize = DD->getBaseTypeSize(DT);
1891 if (IsBitfield) {
1892
1893 if (DD->useDWARF2Bitfields())
1894 addUInt(MemberDie, dwarf::DW_AT_byte_size, std::nullopt,
1895 FieldSize / 8);
1896 addUInt(MemberDie, dwarf::DW_AT_bit_size, std::nullopt, Size);
1897 }
1898 }
1899
1900
1901
1902
1904 if (->TM.Options.DebugStrictDwarf || DD->getDwarfVersion() >= 6) {
1905 if (auto *VarDIE = getDIE(Var))
1906 addDIEEntry(MemberDie, dwarf::DW_AT_data_bit_offset, *VarDIE);
1907 }
1908 } else if (auto *Expr =
1910 if (->TM.Options.DebugStrictDwarf || DD->getDwarfVersion() >= 6) {
1911 addBlock(MemberDie, dwarf::DW_AT_data_bit_offset, Expr);
1912 }
1913 } else {
1915 uint64_t OffsetInBytes;
1916
1917 if (IsBitfield) {
1919 (uint64_t)std::numeric_limits<int64_t>::max());
1921
1922
1923
1924 uint32_t AlignInBits = FieldSize;
1925 uint32_t AlignMask = ~(AlignInBits - 1);
1926
1927
1928 uint64_t StartBitOffset = Offset - (Offset & AlignMask);
1929
1930
1931 OffsetInBytes = (Offset - StartBitOffset) / 8;
1932
1933 if (DD->useDWARF2Bitfields()) {
1934 uint64_t HiMark = (Offset + FieldSize) & AlignMask;
1935 uint64_t FieldOffset = (HiMark - FieldSize);
1936 Offset -= FieldOffset;
1937
1938
1939 if (Asm->getDataLayout().isLittleEndian())
1940 Offset = FieldSize - (Offset + Size);
1941
1942 if (Offset < 0)
1943 addSInt(MemberDie, dwarf::DW_AT_bit_offset, dwarf::DW_FORM_sdata,
1944 Offset);
1945 else
1946 addUInt(MemberDie, dwarf::DW_AT_bit_offset, std::nullopt,
1947 (uint64_t)Offset);
1948 OffsetInBytes = FieldOffset >> 3;
1949 } else {
1950 addUInt(MemberDie, dwarf::DW_AT_data_bit_offset, std::nullopt,
1951 Offset);
1952 }
1953 } else {
1954
1956 if (AlignInBytes)
1957 addUInt(MemberDie, dwarf::DW_AT_alignment, dwarf::DW_FORM_udata,
1958 AlignInBytes);
1959 }
1960
1961 if (DD->getDwarfVersion() <= 2) {
1963 addUInt(*MemLocationDie, dwarf::DW_FORM_data1,
1964 dwarf::DW_OP_plus_uconst);
1965 addUInt(*MemLocationDie, dwarf::DW_FORM_udata, OffsetInBytes);
1966 addBlock(MemberDie, dwarf::DW_AT_data_member_location, MemLocationDie);
1967 } else if (!IsBitfield || DD->useDWARF2Bitfields()) {
1968
1969
1970
1971
1972 if (DD->getDwarfVersion() == 3)
1973 addUInt(MemberDie, dwarf::DW_AT_data_member_location,
1974 dwarf::DW_FORM_udata, OffsetInBytes);
1975 else
1976 addUInt(MemberDie, dwarf::DW_AT_data_member_location, std::nullopt,
1977 OffsetInBytes);
1978 }
1979 }
1980 }
1981
1983
1985 addUInt(MemberDie, dwarf::DW_AT_virtuality, dwarf::DW_FORM_data1,
1986 dwarf::DW_VIRTUALITY_virtual);
1987
1988
1990 if (DIE *PDie = getDIE(PNode))
1991 addAttribute(MemberDie, dwarf::DW_AT_APPLE_property,
1992 dwarf::DW_FORM_ref4, DIEEntry(*PDie));
1993
1995 addFlag(MemberDie, dwarf::DW_AT_artificial);
1996
1997 return MemberDie;
1998}
1999
2001 if (!DT)
2002 return nullptr;
2003
2004
2005
2008 "Static member should belong to a type.");
2009
2010 if (DIE *StaticMemberDIE = getDIE(DT))
2011 return StaticMemberDIE;
2012
2015
2016 const DIType *Ty = DT->getBaseType();
2017
2018 addString(StaticMemberDIE, dwarf::DW_AT_name, DT->getName());
2019 addType(StaticMemberDIE, Ty);
2020 ContextUnit->addSourceLine(StaticMemberDIE, DT);
2021 addFlag(StaticMemberDIE, dwarf::DW_AT_external);
2022 addFlag(StaticMemberDIE, dwarf::DW_AT_declaration);
2023
2024
2026 addFlag(StaticMemberDIE, dwarf::DW_AT_artificial);
2027
2028
2029
2031
2036
2038 addUInt(StaticMemberDIE, dwarf::DW_AT_alignment, dwarf::DW_FORM_udata,
2039 AlignInBytes);
2040
2041 return &StaticMemberDIE;
2042}
2043
2045
2046 if (->useSectionsAsReferences())
2048 isDwoUnit() ? "debug_info_dwo" : "debug_info", "Length of Unit");
2049 else
2051 "Length of Unit");
2052
2053 Asm->OutStreamer->AddComment("DWARF version number");
2054 unsigned Version = DD->getDwarfVersion();
2056
2057
2059 Asm->OutStreamer->AddComment("DWARF Unit Type");
2060 Asm->emitInt8(UT);
2061 Asm->OutStreamer->AddComment("Address Size (in bytes)");
2062 Asm->emitInt8(Asm->MAI->getCodePointerSize());
2063 }
2064
2065
2066
2067
2068 Asm->OutStreamer->AddComment("Offset Into Abbrev. Section");
2070 if (UseOffsets)
2071 Asm->emitDwarfLengthOrOffset(0);
2072 else
2073 Asm->emitDwarfSymbolReference(
2075
2077 Asm->OutStreamer->AddComment("Address Size (in bytes)");
2078 Asm->emitInt8(Asm->MAI->getCodePointerSize());
2079 }
2080}
2081
2083 if (->useSplitDwarf()) {
2086 }
2088 DD->useSplitDwarf() ? dwarf::DW_UT_split_type
2089 : dwarf::DW_UT_type);
2090 Asm->OutStreamer->AddComment("Type Signature");
2091 Asm->OutStreamer->emitIntValue(TypeSignature, sizeof(TypeSignature));
2092 Asm->OutStreamer->AddComment("Type DIE Offset");
2093
2094 Asm->emitDwarfLengthOrOffset(Ty ? Ty->getOffset() : 0);
2095}
2096
2102
2105 if (Asm->doesDwarfUseRelocationsAcrossSections())
2107 else
2109}
2110
2111bool DwarfTypeUnit::isDwoUnit() const {
2112
2113
2115}
2116
2118 const DIScope *Context) {
2120}
2121
2123 const DIScope *Context) {
2125}
2126
2129 return nullptr;
2130 if (isDwoUnit())
2131 return nullptr;
2133}
2134
2138 DU->getStringOffsetsStartSym(),
2140}
2141
2143 assert(DD->getDwarfVersion() >= 5 &&
2144 "DW_AT_rnglists_base requires DWARF version 5 or later");
2147 DU->getRnglistsTableBaseSym(),
2149}
2150
2151void DwarfTypeUnit::finishNonUnitTypeDIE(DIE& D, const DICompositeType *CTy) {
2153}
2154
2155bool DwarfUnit::isCompatibleWithVersion(uint16_t Version) const {
2157}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file declares a class to represent arbitrary precision floating point values and provide a varie...
This file implements a class to represent arbitrary precision integral constant values and operations...
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static bool hasVectorBeenPadded(const DICompositeType *CTy)
Returns true if the vector's size differs from the sum of sizes of elements the user specified.
Definition DwarfUnit.cpp:1718
Register const TargetRegisterInfo * TRI
static enum BaseType getBaseType(const Value *Val)
Return the baseType for Val which states whether Val is exclusively derived from constant/null,...
static unsigned getSize(unsigned Kind)
APInt bitcastToAPInt() const
Class for arbitrary precision integers.
uint64_t getZExtValue() const
Get zero extended value.
unsigned getBitWidth() const
Return the number of bits in the APInt.
const uint64_t * getRawData() const
This function returns a pointer to the internal storage of the APInt.
int64_t getSExtValue() const
Get sign extended value.
void resetUsedFlag(bool HasBeenUsed=false)
Annotations lets you mark points and ranges inside source code, for tests:
This class is intended to be used as a driving class for all asm writers.
MCSymbol * getSymbol(const GlobalValue *GV) const
TargetMachine & TM
Target machine description.
MCContext & OutContext
This is the context for the output file that we are streaming.
const DataLayout & getDataLayout() const
Return information about data layout.
bool doesDwarfUseRelocationsAcrossSections() const
Functions, function parameters, and return types can have attributes to indicate how they should be t...
ConstantFP - Floating Point Values [float, double].
const APFloat & getValueAPF() const
This is the shared class of boolean and integer constants.
const APInt & getValue() const
Return the constant as an APInt value reference.
This is an important base class in LLVM.
Basic type, like 'int' or 'float'.
uint32_t getDataSizeInBits() const
unsigned getEncoding() const
DIExpression * getRankExp() const
DIExpression * getAssociatedExp() const
DIVariable * getAllocated() const
DIExpression * getDataLocationExp() const
DIVariable * getAssociated() const
DIDerivedType * getDiscriminator() const
DIVariable * getDataLocation() const
unsigned getRuntimeLang() const
DIType * getSpecification() const
StringRef getIdentifier() const
DINodeArray getElements() const
DITemplateParameterArray getTemplateParams() const
DIExpression * getAllocatedExp() const
ConstantInt * getBitStrideConst() const
std::optional< uint32_t > getEnumKind() const
DIType * getVTableHolder() const
DINodeArray getAnnotations() const
ConstantInt * getRankConst() const
MDString * getRawIdentifier() const
DIType * getBaseType() const
DINodeArray getAnnotations() const
Get annotations associated with this derived type.
DITemplateParameterArray getTemplateParams() const
Get the template parameters from a template alias.
DIObjCProperty * getObjCProperty() const
LLVM_ABI Constant * getConstant() const
DIEBlock - Represents a block of values.
A simple label difference DIE.
DwarfExpression implementation for singular DW_AT_location.
DIEDwarfExpression(const AsmPrinter &AP, DwarfCompileUnit &CU, DIELoc &DIE)
Definition DwarfUnit.cpp:40
A pointer to another debug information entry.
A container for inline string values.
static dwarf::Form BestForm(bool IsSigned, uint64_t Int)
Choose the best form for integer.
DIELoc - Represents an expression location.
A container for string pool string values.
virtual const MCSymbol * getCrossSectionRelativeBaseAddress() const
LLVM_ABI DIEUnit(dwarf::Tag UnitTag)
MCSection * getSection() const
Return the section that this DIEUnit will be emitted into.
A structured debug information entry.
DIE & addChild(DIE *Child)
Add a child to the DIE.
static DIE * get(BumpPtrAllocator &Alloc, dwarf::Tag Tag)
LLVM_ABI DIEUnit * getUnit() const
Climb up the parent chain to get the compile unit or type unit that this DIE belongs to.
dwarf::Tag getTag() const
const APInt & getDenominator() const
LLVM_ABI bool isSigned() const
const APInt & getNumerator() const
LLVM_ABI BoundType getLowerBound() const
LLVM_ABI BoundType getCount() const
LLVM_ABI BoundType getUpperBound() const
PointerUnion< DIVariable *, DIExpression * > BoundType
LLVM_ABI BoundType getStride() const
Represents a module in the programming language, for example, a Clang module, or a Fortran module.
DIScope * getScope() const
StringRef getName() const
bool getExportSymbols() const
Tagged DWARF-like metadata node.
LLVM_ABI dwarf::Tag getTag() const
Base class for scope-like contexts.
LLVM_ABI DIScope * getScope() const
String type, Fortran CHARACTER(n)
unsigned getEncoding() const
DIExpression * getStringLengthExp() const
DIVariable * getStringLength() const
DIExpression * getStringLocationExp() const
Subprogram description. Uses SubclassData1.
BoundType getLowerBound() const
BoundType getBias() const
PointerUnion< ConstantInt *, DIVariable *, DIExpression *, DIDerivedType * > BoundType
BoundType getUpperBound() const
DIType * getBaseType() const
Get the base type this is derived from.
BoundType getStride() const
LLVM_ABI BoundType getUpperBound() const
LLVM_ABI BoundType getStride() const
LLVM_ABI BoundType getLowerBound() const
LLVM_ABI BoundType getCount() const
Type array for a subprogram.
StringRef getName() const
Metadata * getValue() const
bool isLittleEndian() const
uint32_t getNumExtraInhabitants() const
bool isLValueReference() const
bool isObjcClassComplete() const
bool isAppleBlockExtension() const
uint64_t getOffsetInBits() const
StringRef getName() const
bool isForwardDecl() const
bool isTypePassByValue() const
uint64_t getSizeInBits() const
uint32_t getAlignInBytes() const
Metadata * getRawSizeInBits() const
bool isRValueReference() const
bool isArtificial() const
bool getExportSymbols() const
DIScope * getScope() const
bool isTypePassByReference() const
Metadata * getRawOffsetInBits() const
bool isLittleEndian() const
Layout endianness...
void addGlobalNameForTypeUnit(StringRef Name, const DIScope *Context)
Add a new global name present in a type unit to this compile unit.
unsigned getOrCreateSourceID(const DIFile *File) override
Look up the source ID for the given file.
void addGlobalTypeUnitType(const DIType *Ty, const DIScope *Context)
Add a new global type present in a type unit to this compile unit.
Collects and handles dwarf debug information.
std::optional< MD5::MD5Result > getMD5AsBytes(const DIFile *File) const
If the File has an MD5 checksum, return it as an MD5Result allocated in the MCContext.
uint16_t getDwarfVersion() const
Returns the Dwarf Version.
AddressPool & getAddressPool()
bool useSplitDwarf() const
Returns whether or not to change the current debug info for the split dwarf proposal support.
virtual void disableTemporaryBuffer()=0
Disable emission to the temporary buffer.
virtual unsigned getTemporaryBufferSize()=0
Return the emitted size, in number of bytes, for the data stored in the temporary buffer.
void setMemoryLocationKind()
Lock this down to become a memory location description.
void addExpression(DIExpressionCursor &&Expr)
Emit all remaining operations in the DIExpressionCursor.
virtual void commitTemporaryBuffer()=0
Commit the data stored in the temporary buffer to the main output.
DwarfExpression(unsigned DwarfVersion, DwarfCompileUnit &CU)
virtual void enableTemporaryBuffer()=0
Start emitting data to the temporary buffer.
DwarfTypeUnit(DwarfCompileUnit &CU, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU, unsigned UniqueID, MCDwarfDwoLineTable *SplitLineTable=nullptr)
Definition DwarfUnit.cpp:88
void addGlobalTypeImpl(const DIType *Ty, const DIE &Die, const DIScope *Context) override
Add a new global type to the compile unit.
Definition DwarfUnit.cpp:2122
DwarfCompileUnit & getCU() override
void emitHeader(bool UseOffsets) override
Emit the header for this unit, not including the initial length field.
Definition DwarfUnit.cpp:2082
void addGlobalName(StringRef Name, const DIE &Die, const DIScope *Context) override
Add a new global name to the compile unit.
Definition DwarfUnit.cpp:2117
virtual DIE * getOrCreateTypeDIE(const MDNode *TyNode)
Find existing DIE or create new DIE for the given type.
Definition DwarfUnit.cpp:646
void addInt(DIE &Die, dwarf::Attribute Attribute, const APInt &Integer, bool Unsigned)
Add an integer attribute data and value; value may be any width.
Definition DwarfUnit.cpp:256
DwarfDebug & getDwarfDebug() const
void addThrownTypes(DIE &Die, DINodeArray ThrownTypes)
Add thrown types.
Definition DwarfUnit.cpp:557
void addStringOffsetsStart()
Add the DW_AT_str_offsets_base attribute to the unit DIE.
Definition DwarfUnit.cpp:2135
void addAnnotation(DIE &Buffer, DINodeArray Annotations)
Add DW_TAG_LLVM_annotation.
Definition DwarfUnit.cpp:977
std::vector< DIEBlock * > DIEBlocks
A list of all the DIEBlocks in use.
std::vector< DIELoc * > DIELocs
A list of all the DIELocs in use.
void addBlock(DIE &Die, dwarf::Attribute Attribute, DIELoc *Loc)
Add block data.
Definition DwarfUnit.cpp:426
void addTemplateParams(DIE &Buffer, DINodeArray TParams)
Add template parameters in buffer.
Definition DwarfUnit.cpp:546
virtual DIE * getOrCreateContextDIE(const DIScope *Context)
Get context owner's DIE.
Definition DwarfUnit.cpp:576
bool useSegmentedStringOffsetsTable() const
bool applySubprogramDefinitionAttributes(const DISubprogram *SP, DIE &SPDie, bool Minimal)
Definition DwarfUnit.cpp:1391
DIELoc * getDIELoc()
Returns a fresh newly allocated DIELoc.
void updateAcceleratorTables(const DIScope *Context, const DIType *Ty, const DIE &TyDIE)
If this is a named finished type then include it in the list of types for the accelerator tables.
Definition DwarfUnit.cpp:673
void addAttribute(DIEValueList &Die, dwarf::Attribute Attribute, dwarf::Form Form, T &&Value)
void addOpAddress(DIELoc &Die, const MCSymbol *Sym)
Add a dwarf op address data and value using the form given and an op of either DW_FORM_addr or DW_FOR...
Definition DwarfUnit.cpp:367
void addUInt(DIEValueList &Die, dwarf::Attribute Attribute, std::optional< dwarf::Form > Form, uint64_t Integer)
Add an unsigned integer attribute data and value.
Definition DwarfUnit.cpp:220
void addString(DIE &Die, dwarf::Attribute Attribute, StringRef Str)
Add a string attribute data and value.
Definition DwarfUnit.cpp:282
void addConstantValue(DIE &Die, const ConstantInt *CI, const DIType *Ty)
Add constant value entry in variable DIE.
Definition DwarfUnit.cpp:507
DIE * getOrCreateNameSpace(const DINamespace *NS)
Definition DwarfUnit.cpp:1301
void insertDIE(const DINode *Desc, DIE *D)
Insert DIE into the map.
Definition DwarfUnit.cpp:201
void addAccess(DIE &Die, DINode::DIFlags Flags)
Add the accessibility attribute.
Definition DwarfUnit.cpp:564
void addSectionDelta(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Hi, const MCSymbol *Lo)
addSectionDelta - Add a label delta attribute data and value.
Definition DwarfUnit.cpp:2097
void addGlobalType(const DIType *Ty, const DIE &Die, const DIScope *Context)
Definition DwarfUnit.cpp:702
DIE * createTypeDIE(const DIScope *Context, DIE &ContextDIE, const DIType *Ty)
Creates type DIE with specific context.
Definition DwarfUnit.cpp:606
bool shouldPlaceInUnitDIE(const DISubprogram *SP, bool Minimal)
DenseMap< DIE *, const DINode * > ContainingTypeMap
This map is used to keep track of subprogram DIEs that need DW_AT_containing_type attribute.
const DICompileUnit * CUNode
MDNode for the compile unit.
virtual unsigned getOrCreateSourceID(const DIFile *File)=0
Look up the source ID for the given file.
virtual DIE * getOrCreateSubprogramDIE(const DISubprogram *SP, const Function *FnHint, bool Minimal=false)
Definition DwarfUnit.cpp:1353
DIE * getOrCreateSubprogramContextDIE(const DISubprogram *SP, bool IgnoreScope)
virtual void addGlobalTypeImpl(const DIType *Ty, const DIE &Die, const DIScope *Context)=0
Add a new global type to the compile unit.
void addDIETypeSignature(DIE &Die, uint64_t Signature)
Add a type's DW_AT_signature and set the declaration flag.
Definition DwarfUnit.cpp:392
std::optional< unsigned > constructSubprogramArguments(DIE &Buffer, DITypeRefArray Args)
Construct function argument DIEs.
Definition DwarfUnit.cpp:922
virtual DwarfCompileUnit & getCU()=0
DIE * getDIE(const DINode *D) const
Returns the DIE map slot for the specified debug variable.
Definition DwarfUnit.cpp:195
virtual unsigned getHeaderSize() const
Compute the size of a header for this unit, not including the initial length field.
MCSymbol * LabelBegin
The start of the unit within its section.
void addSInt(DIEValueList &Die, dwarf::Attribute Attribute, std::optional< dwarf::Form > Form, int64_t Integer)
Add an signed integer attribute data and value.
Definition DwarfUnit.cpp:270
DwarfUnit(dwarf::Tag, const DICompileUnit *Node, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU, unsigned UniqueID=0)
Definition DwarfUnit.cpp:82
void addLabelDelta(DIEValueList &Die, dwarf::Attribute Attribute, const MCSymbol *Hi, const MCSymbol *Lo)
Add a label delta attribute data and value.
Definition DwarfUnit.cpp:382
void addLinkageName(DIE &Die, StringRef LinkageName)
Add a linkage name, if it isn't empty.
Definition DwarfUnit.cpp:538
std::string getParentContextString(const DIScope *Context) const
Get string containing language specific context for a global name.
Definition DwarfUnit.cpp:728
void addSourceLine(DIE &Die, unsigned Line, unsigned Column, const DIFile *File)
Add location information to specified debug information entry.
Definition DwarfUnit.cpp:453
void emitCommonHeader(bool UseOffsets, dwarf::UnitType UT)
Emit the common part of the header for this unit.
Definition DwarfUnit.cpp:2044
BumpPtrAllocator DIEValueAllocator
DIE * IndexTyDie
An anonymous type for index type. Owned by DIEUnit.
void addRnglistsBase()
Add the DW_AT_rnglists_base attribute to the unit DIE.
Definition DwarfUnit.cpp:2142
DIE * getOrCreateModule(const DIModule *M)
Definition DwarfUnit.cpp:1322
const DICompileUnit * getCUNode() const
DIE & createAndAddDIE(dwarf::Tag Tag, DIE &Parent, const DINode *N=nullptr)
Create a DIE with the given Tag, add the DIE to its parent, and call insertDIE if MD is not null.
Definition DwarfUnit.cpp:419
void addSectionOffset(DIE &Die, dwarf::Attribute Attribute, uint64_t Integer)
Add an offset into a section attribute data and value.
Definition DwarfUnit.cpp:324
DIE * getOrCreateStaticMemberDIE(const DIDerivedType *DT)
Create new static data member DIE.
Definition DwarfUnit.cpp:2000
void addLabel(DIEValueList &Die, dwarf::Attribute Attribute, dwarf::Form Form, const MCSymbol *Label)
Add a Dwarf label attribute data and value.
Definition DwarfUnit.cpp:315
void addConstantFPValue(DIE &Die, const ConstantFP *CFP)
Add constant value entry in variable DIE.
Definition DwarfUnit.cpp:502
void constructContainingTypeDIEs()
Construct DIEs for types that contain vtables.
Definition DwarfUnit.cpp:1832
unsigned UniqueID
A numeric ID unique among all CUs in the module.
void addSectionLabel(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Label, const MCSymbol *Sec)
Add a Dwarf section label attribute data and value.
Definition DwarfUnit.cpp:2103
bool isShareableAcrossCUs(const DINode *D) const
Check whether the DIE for this MDNode can be shared across CUs.
Definition DwarfUnit.cpp:180
llvm::dwarf::SourceLanguage getSourceLanguage() const
Definition DwarfUnit.cpp:716
void addPoolOpAddress(DIEValueList &Die, const MCSymbol *Label)
Definition DwarfUnit.cpp:342
~DwarfUnit() override
Definition DwarfUnit.cpp:94
DenseMap< const MDNode *, DIE * > MDNodeToDieMap
Tracks the mapping of unit level debug information variables to debug information entries.
void constructTypeDIE(DIE &Buffer, const DICompositeType *CTy)
Definition DwarfUnit.cpp:1035
virtual void addGlobalName(StringRef Name, const DIE &Die, const DIScope *Context)=0
Add a new global name to the compile unit.
MCSymbol * EndLabel
Emitted at the end of the CU and used to compute the CU Length field.
void addFlag(DIE &Die, dwarf::Attribute Attribute)
Add a flag that is true to the DIE.
Definition DwarfUnit.cpp:213
AsmPrinter * Asm
Target of Dwarf emission.
void addType(DIE &Entity, const DIType *Ty, dwarf::Attribute Attribute=dwarf::DW_AT_type)
Add a new type attribute to the specified entity.
Definition DwarfUnit.cpp:709
void applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie, bool SkipSPAttributes=false)
Definition DwarfUnit.cpp:1441
void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE &Entry)
Add a DIE attribute data and value.
Definition DwarfUnit.cpp:388
static StringRef dropLLVMManglingEscape(StringRef Name)
If the given string begins with the GlobalValue name mangling escape character '\1',...
uint16_t getDwarfVersion() const
unsigned getFile(StringRef Directory, StringRef FileName, std::optional< MD5::MD5Result > Checksum, uint16_t DwarfVersion, std::optional< StringRef > Source)
MCSection * getDwarfStrOffSection() const
MCSection * getDwarfRnglistsSection() const
MCSection * getDwarfAbbrevSection() const
MCSymbol * getBeginSymbol()
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
const MDOperand & getOperand(unsigned I) const
Wrapper class representing virtual and physical registers.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
constexpr bool empty() const
empty - Check if the string is empty.
unsigned DebugStrictDwarf
When set to true, don't use DWARF extensions in later DWARF versions.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
LLVM Value Representation.
Calculates the starting offsets for various sections within the .debug_names section.
UnitType
Constants for unit types in DWARF v5.
std::optional< SourceLanguage > toDW_LANG(SourceLanguageName name, uint32_t version)
Convert a DWARF 6 pair of language name and version to a DWARF 5 DW_LANG.
bool isCPlusPlus(SourceLanguage S)
TypeKind getArrayIndexTypeEncoding(SourceLanguage S)
@ DW_FLAG_type_implementation
bool isC(SourceLanguage S)
std::enable_if_t< detail::IsValidPointer< X, Y >::value, X * > dyn_extract(Y &&MD)
Extract a Value from Metadata, if any.
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr Value
decltype(auto) dyn_cast(const From &Val)
dyn_cast - Return the argument parameter cast to the specified type.
auto dyn_cast_if_present(const Y &Val)
dyn_cast_if_present - Functionally identical to dyn_cast, except that a null (or none in the case ...
auto dyn_cast_or_null(const Y &Val)
FunctionAddr VTableAddr uintptr_t uintptr_t Version
auto reverse(ContainerTy &&C)
bool isa(const From &Val)
isa - Return true if the parameter to the template is an instance of one of the template type argu...
constexpr T divideCeil(U Numerator, V Denominator)
Returns the integer ceil(Numerator / Denominator).
FunctionAddr VTableAddr uintptr_t uintptr_t Data
DWARFExpression::Operation Op
decltype(auto) cast(const From &Val)
cast - Return the argument parameter cast to the specified type.