diff --git a/include/llvm-c/DebugInfo.h b/include/llvm-c/DebugInfo.h index bc341da3d52..87a72034b0e 100644 --- a/include/llvm-c/DebugInfo.h +++ b/include/llvm-c/DebugInfo.h @@ -54,7 +54,8 @@ typedef enum { LLVMDIFlagMainSubprogram = 1 << 21, LLVMDIFlagTypePassByValue = 1 << 22, LLVMDIFlagTypePassByReference = 1 << 23, - LLVMDIFlagFixedEnum = 1 << 24, + LLVMDIFlagEnumClass = 1 << 24, + LLVMDIFlagFixedEnum = LLVMDIFlagEnumClass, // Deprecated. LLVMDIFlagThunk = 1 << 25, LLVMDIFlagTrivial = 1 << 26, LLVMDIFlagBigEndian = 1 << 27, diff --git a/include/llvm/IR/DIBuilder.h b/include/llvm/IR/DIBuilder.h index 1fe7b36db00..443332b1b23 100644 --- a/include/llvm/IR/DIBuilder.h +++ b/include/llvm/IR/DIBuilder.h @@ -502,11 +502,11 @@ namespace llvm { /// \param Elements Enumeration elements. /// \param UnderlyingType Underlying type of a C++11/ObjC fixed enum. /// \param UniqueIdentifier A unique identifier for the enum. - /// \param IsFixed Boolean flag indicate if this is C++11/ObjC fixed enum. + /// \param IsScoped Boolean flag indicate if this is C++11/ObjC 'enum class'. DICompositeType *createEnumerationType( DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, DINodeArray Elements, - DIType *UnderlyingType, StringRef UniqueIdentifier = "", bool IsFixed = false); + DIType *UnderlyingType, StringRef UniqueIdentifier = "", bool IsScoped = false); /// Create subroutine type. /// \param ParameterTypes An array of subroutine parameter types. This diff --git a/include/llvm/IR/DebugInfoFlags.def b/include/llvm/IR/DebugInfoFlags.def index a0a9c6bcacb..ce117aa452a 100644 --- a/include/llvm/IR/DebugInfoFlags.def +++ b/include/llvm/IR/DebugInfoFlags.def @@ -54,7 +54,7 @@ HANDLE_DI_FLAG((1 << 20), NoReturn) HANDLE_DI_FLAG((1 << 21), MainSubprogram) HANDLE_DI_FLAG((1 << 22), TypePassByValue) HANDLE_DI_FLAG((1 << 23), TypePassByReference) -HANDLE_DI_FLAG((1 << 24), FixedEnum) +HANDLE_DI_FLAG((1 << 24), EnumClass) HANDLE_DI_FLAG((1 << 25), Thunk) HANDLE_DI_FLAG((1 << 26), Trivial) HANDLE_DI_FLAG((1 << 27), BigEndian) diff --git a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index 991dac7cf35..80b365f1aa4 100644 --- a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -1361,7 +1361,7 @@ void DwarfUnit::constructEnumTypeDIE(DIE &Buffer, const DICompositeType *CTy) { if (DTy) { if (DD->getDwarfVersion() >= 3) addType(Buffer, DTy); - if (DD->getDwarfVersion() >= 4 && (CTy->getFlags() & DINode::FlagFixedEnum)) + if (DD->getDwarfVersion() >= 4 && (CTy->getFlags() & DINode::FlagEnumClass)) addFlag(Buffer, dwarf::DW_AT_enum_class); } diff --git a/lib/IR/DIBuilder.cpp b/lib/IR/DIBuilder.cpp index d29759f5679..fb81634a286 100644 --- a/lib/IR/DIBuilder.cpp +++ b/lib/IR/DIBuilder.cpp @@ -504,11 +504,11 @@ DISubroutineType *DIBuilder::createSubroutineType(DITypeRefArray ParameterTypes, DICompositeType *DIBuilder::createEnumerationType( DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, DINodeArray Elements, - DIType *UnderlyingType, StringRef UniqueIdentifier, bool IsFixed) { + DIType *UnderlyingType, StringRef UniqueIdentifier, bool IsScoped) { auto *CTy = DICompositeType::get( VMContext, dwarf::DW_TAG_enumeration_type, Name, File, LineNumber, getNonCompileUnitScope(Scope), UnderlyingType, SizeInBits, AlignInBits, 0, - IsFixed ? DINode::FlagFixedEnum : DINode::FlagZero, Elements, 0, nullptr, + IsScoped ? DINode::FlagEnumClass : DINode::FlagZero, Elements, 0, nullptr, nullptr, UniqueIdentifier); AllEnumTypes.push_back(CTy); trackIfUnresolved(CTy); diff --git a/test/Assembler/DIEnumerator.ll b/test/Assembler/DIEnumerator.ll index 9dc3d7c9ec2..fdb91d451cc 100644 --- a/test/Assembler/DIEnumerator.ll +++ b/test/Assembler/DIEnumerator.ll @@ -40,9 +40,9 @@ ; CHECK: !DIEnumerator(name: "B0", value: 2147483647) -!10 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E1", file: !3, line: 3, baseType: !6, size: 32, flags: DIFlagFixedEnum, elements: !11, identifier: "_ZTS2E1") +!10 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E1", file: !3, line: 3, baseType: !6, size: 32, flags: DIFlagEnumClass, elements: !11, identifier: "_ZTS2E1") ; CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "E1"{{.*}}, baseType: ![[INT]] -; CHECK-SAME: DIFlagFixedEnum +; CHECK-SAME: DIFlagEnumClass !11 = !{!12, !13} !12 = !DIEnumerator(name: "A1", value: -2147483648) !13 = !DIEnumerator(name: "B1", value: 2147483647) @@ -50,9 +50,9 @@ ; CHECK: !DIEnumerator(name: "B1", value: 2147483647) -!14 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E2", file: !3, line: 5, baseType: !15, size: 64, flags: DIFlagFixedEnum, elements: !16, identifier: "_ZTS2E2") +!14 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E2", file: !3, line: 5, baseType: !15, size: 64, flags: DIFlagEnumClass, elements: !16, identifier: "_ZTS2E2") ; CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "E2"{{.*}}, baseType: ![[LONG:[0-9]+]] -; CHECK-SAME: DIFlagFixedEnum +; CHECK-SAME: DIFlagEnumClass !15 = !DIBasicType(name: "long long int", size: 64, encoding: DW_ATE_signed) ; CHECK: ![[LONG]] = !DIBasicType(name: "long long int", size: 64, encoding: DW_ATE_signed) !16 = !{!17, !18} @@ -62,9 +62,9 @@ ; CHECK: !DIEnumerator(name: "B2", value: 9223372036854775807) -!19 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E3", file: !3, line: 7, baseType: !20, size: 64, flags: DIFlagFixedEnum, elements: !21, identifier: "_ZTS2E3") +!19 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E3", file: !3, line: 7, baseType: !20, size: 64, flags: DIFlagEnumClass, elements: !21, identifier: "_ZTS2E3") ; CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "E3"{{.*}}, baseType: ![[ULONG:[0-9]+]] -; CHECK-SAME: DIFlagFixedEnum +; CHECK-SAME: DIFlagEnumClass !20 = !DIBasicType(name: "long long unsigned int", size: 64, encoding: DW_ATE_unsigned) ; CHECK: ![[ULONG]] = !DIBasicType(name: "long long unsigned int", size: 64, encoding: DW_ATE_unsigned) !21 = !{!22} diff --git a/test/DebugInfo/COFF/enum-co.ll b/test/DebugInfo/COFF/enum-co.ll index 14c1955c46a..f7e67238ec0 100644 --- a/test/DebugInfo/COFF/enum-co.ll +++ b/test/DebugInfo/COFF/enum-co.ll @@ -138,7 +138,7 @@ attributes #1 = { nounwind readnone speculatable } !5 = !{!6, !7} !6 = !DIEnumerator(name: "ON", value: 0) !7 = !DIEnumerator(name: "OFF", value: 1) -!8 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "EnumClass", file: !1, line: 7, baseType: !4, size: 32, flags: DIFlagFixedEnum, elements: !9, identifier: ".?AW4EnumClass@@") +!8 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "EnumClass", file: !1, line: 7, baseType: !4, size: 32, flags: DIFlagEnumClass, elements: !9, identifier: ".?AW4EnumClass@@") !9 = !{!10, !11, !12} !10 = !DIEnumerator(name: "RED", value: 0) !11 = !DIEnumerator(name: "BLUE", value: 1) diff --git a/test/DebugInfo/Generic/debug-info-enum.ll b/test/DebugInfo/Generic/debug-info-enum.ll index 5d887cd5cb8..85e22931a5f 100644 --- a/test/DebugInfo/Generic/debug-info-enum.ll +++ b/test/DebugInfo/Generic/debug-info-enum.ll @@ -28,7 +28,7 @@ !4 = !{!5, !10, !14, !19, !23, !28, !32, !37, !41} ; Test enumeration with a fixed "signed char" underlying type. -!5 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E0", file: !3, line: 2, baseType: !6, size: 8, flags: DIFlagFixedEnum, elements: !7, identifier: "_ZTS2E0") +!5 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E0", file: !3, line: 2, baseType: !6, size: 8, flags: DIFlagEnumClass, elements: !7, identifier: "_ZTS2E0") !6 = !DIBasicType(name: "signed char", size: 8, encoding: DW_ATE_signed_char) !7 = !{!8, !9} !8 = !DIEnumerator(name: "A0", value: -128) @@ -46,7 +46,7 @@ ; CHECK-NEXT: DW_AT_const_value (127) ; Test enumeration with a fixed "unsigned char" underlying type. -!10 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E1", file: !3, line: 12, baseType: !11, size: 8, flags: DIFlagFixedEnum, elements: !12, identifier: "_ZTS2E1") +!10 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E1", file: !3, line: 12, baseType: !11, size: 8, flags: DIFlagEnumClass, elements: !12, identifier: "_ZTS2E1") !11 = !DIBasicType(name: "unsigned char", size: 8, encoding: DW_ATE_unsigned_char) !12 = !{!13} !13 = !DIEnumerator(name: "A1", value: 255, isUnsigned: true) @@ -60,7 +60,7 @@ ; CHECK-NEXT: DW_AT_const_value (255) ; Test enumeration with a fixed "short" underlying type. -!14 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E2", file: !3, line: 18, baseType: !15, size: 16, flags: DIFlagFixedEnum, elements: !16, identifier: "_ZTS2E2") +!14 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E2", file: !3, line: 18, baseType: !15, size: 16, flags: DIFlagEnumClass, elements: !16, identifier: "_ZTS2E2") !15 = !DIBasicType(name: "short", size: 16, encoding: DW_ATE_signed) !16 = !{!17, !18} !17 = !DIEnumerator(name: "A2", value: -32768) @@ -78,7 +78,7 @@ ; CHECK-NEXT: DW_AT_const_value (32767) ; Test enumeration with a fixed "unsigned short" underlying type. -!19 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E3", file: !3, line: 28, baseType: !20, size: 16, flags: DIFlagFixedEnum, elements: !21, identifier: "_ZTS2E3") +!19 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E3", file: !3, line: 28, baseType: !20, size: 16, flags: DIFlagEnumClass, elements: !21, identifier: "_ZTS2E3") !20 = !DIBasicType(name: "unsigned short", size: 16, encoding: DW_ATE_unsigned) !21 = !{!22} !22 = !DIEnumerator(name: "A3", value: 65535, isUnsigned: true) @@ -92,7 +92,7 @@ ; CHECK-NEXT: DW_AT_const_value (65535) ; Test enumeration with a fixed "int" underlying type. -!23 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E4", file: !3, line: 34, baseType: !24, size: 32, flags: DIFlagFixedEnum, elements: !25, identifier: "_ZTS2E4") +!23 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E4", file: !3, line: 34, baseType: !24, size: 32, flags: DIFlagEnumClass, elements: !25, identifier: "_ZTS2E4") !24 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) !25 = !{!26, !27} !26 = !DIEnumerator(name: "A4", value: -2147483648) @@ -110,7 +110,7 @@ ; CHECK-NEXT: DW_AT_const_value (2147483647) ; Test enumeration with a fixed "unsigend int" underlying type. -!28 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E5", file: !3, line: 41, baseType: !29, size: 32, flags: DIFlagFixedEnum, elements: !30, identifier: "_ZTS2E5") +!28 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E5", file: !3, line: 41, baseType: !29, size: 32, flags: DIFlagEnumClass, elements: !30, identifier: "_ZTS2E5") !29 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned) !30 = !{!31} !31 = !DIEnumerator(name: "A5", value: 4294967295, isUnsigned: true) @@ -124,7 +124,7 @@ ; CHECK-NEXT: DW_AT_const_value (4294967295) ; Test enumeration with a fixed "long long" underlying type. -!32 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E6", file: !3, line: 47, baseType: !33, size: 64, flags: DIFlagFixedEnum, elements: !34, identifier: "_ZTS2E6") +!32 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E6", file: !3, line: 47, baseType: !33, size: 64, flags: DIFlagEnumClass, elements: !34, identifier: "_ZTS2E6") !33 = !DIBasicType(name: "long long int", size: 64, encoding: DW_ATE_signed) !34 = !{!35, !36} !35 = !DIEnumerator(name: "A6", value: -9223372036854775808) @@ -142,7 +142,7 @@ ; CHECK-NEXT: DW_AT_const_value (9223372036854775807) ; Test enumeration with a fixed "unsigned long long" underlying type. -!37 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E7", file: !3, line: 57, baseType: !38, size: 64, flags: DIFlagFixedEnum, elements: !39, identifier: "_ZTS2E7") +!37 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E7", file: !3, line: 57, baseType: !38, size: 64, flags: DIFlagEnumClass, elements: !39, identifier: "_ZTS2E7") !38 = !DIBasicType(name: "long long unsigned int", size: 64, encoding: DW_ATE_unsigned) !39 = !{!40} !40 = !DIEnumerator(name: "A7", value: 18446744073709551615, isUnsigned: true) @@ -168,11 +168,11 @@ ; CHECK-NOT: DW_AT_enum_class ; CHECK: DW_AT_name ("E8") -; Test enumeration without a fixed underlying type, but with the DIFlagFixedEnum +; Test enumeration without a fixed underlying type, but with the DIFlagEnumClass ; set. The DW_AT_enum_class attribute should be absent. This behaviour is ; intented to keep compatibilty with existing DWARF consumers, which may imply ; the type is present whenever DW_AT_enum_class is set. -!63 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E9", file: !3, line: 63, size: 32, flags: DIFlagFixedEnum, elements: !64, identifier: "_ZTS2E9") +!63 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E9", file: !3, line: 63, size: 32, flags: DIFlagEnumClass, elements: !64, identifier: "_ZTS2E9") !64 = !{!65, !66} !65 = !DIEnumerator(name: "A9", value: -128) !66 = !DIEnumerator(name: "B9", value: 127) diff --git a/test/DebugInfo/X86/enum-class.ll b/test/DebugInfo/X86/enum-class.ll index 92398c4202c..19b594ee831 100644 --- a/test/DebugInfo/X86/enum-class.ll +++ b/test/DebugInfo/X86/enum-class.ll @@ -13,13 +13,13 @@ source_filename = "test/DebugInfo/X86/enum-class.ll" !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) !1 = !DIGlobalVariable(name: "a", scope: null, file: !2, line: 4, type: !3, isLocal: false, isDefinition: true) !2 = !DIFile(filename: "foo.cpp", directory: "/Users/echristo/tmp") -!3 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "A", file: !2, line: 1, baseType: !4, size: 32, flags: DIFlagFixedEnum, align: 32, elements: !5) +!3 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "A", file: !2, line: 1, baseType: !4, size: 32, flags: DIFlagEnumClass, align: 32, elements: !5) !4 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) !5 = !{!6} !6 = !DIEnumerator(name: "A1", value: 1) !7 = !DIGlobalVariableExpression(var: !8, expr: !DIExpression()) ; [ DW_TAG_enumerator ] !8 = !DIGlobalVariable(name: "b", scope: null, file: !2, line: 5, type: !9, isLocal: false, isDefinition: true) -!9 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "B", file: !2, line: 2, baseType: !10, size: 64, flags: DIFlagFixedEnum, align: 64, elements: !11) +!9 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "B", file: !2, line: 2, baseType: !10, size: 64, flags: DIFlagEnumClass, align: 64, elements: !11) !10 = !DIBasicType(name: "long unsigned int", size: 64, align: 64, encoding: DW_ATE_unsigned) !11 = !{!12} !12 = !DIEnumerator(name: "B1", value: 1) ; [ DW_TAG_enumerator ]