Make sure to generate the right kind of MDNode for enum forward declarations.
PR14029, LLVM part. llvm-svn: 165288
This commit is contained in:
		
							parent
							
								
									847ad4460a
								
							
						
					
					
						commit
						c6c86c43f9
					
				| 
						 | 
					@ -331,12 +331,10 @@ namespace llvm {
 | 
				
			||||||
    /// @param SizeInBits   Member size.
 | 
					    /// @param SizeInBits   Member size.
 | 
				
			||||||
    /// @param AlignInBits  Member alignment.
 | 
					    /// @param AlignInBits  Member alignment.
 | 
				
			||||||
    /// @param Elements     Enumeration elements.
 | 
					    /// @param Elements     Enumeration elements.
 | 
				
			||||||
    /// @param Flags        Flags (e.g. forward decl)
 | 
					 | 
				
			||||||
    DIType createEnumerationType(DIDescriptor Scope, StringRef Name, 
 | 
					    DIType createEnumerationType(DIDescriptor Scope, StringRef Name, 
 | 
				
			||||||
                                 DIFile File, unsigned LineNumber, 
 | 
					                                 DIFile File, unsigned LineNumber, 
 | 
				
			||||||
                                 uint64_t SizeInBits, uint64_t AlignInBits,
 | 
					                                 uint64_t SizeInBits, uint64_t AlignInBits,
 | 
				
			||||||
                                 DIArray Elements, DIType ClassType,
 | 
					                                 DIArray Elements, DIType ClassType);
 | 
				
			||||||
                                 unsigned Flags);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// createSubroutineType - Create subroutine type.
 | 
					    /// createSubroutineType - Create subroutine type.
 | 
				
			||||||
    /// @param File           File in which this subroutine is defined.
 | 
					    /// @param File           File in which this subroutine is defined.
 | 
				
			||||||
| 
						 | 
					@ -357,7 +355,8 @@ namespace llvm {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// createForwardDecl - Create a temporary forward-declared type.
 | 
					    /// createForwardDecl - Create a temporary forward-declared type.
 | 
				
			||||||
    DIType createForwardDecl(unsigned Tag, StringRef Name, DIDescriptor Scope,
 | 
					    DIType createForwardDecl(unsigned Tag, StringRef Name, DIDescriptor Scope,
 | 
				
			||||||
                             DIFile F, unsigned Line, unsigned RuntimeLang = 0);
 | 
					                             DIFile F, unsigned Line, unsigned RuntimeLang = 0,
 | 
				
			||||||
 | 
					                             uint64_t SizeInBits = 0, uint64_t AlignInBits = 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// retainType - Retain DIType in a module even if it is not referenced 
 | 
					    /// retainType - Retain DIType in a module even if it is not referenced 
 | 
				
			||||||
    /// through debug info anchors.
 | 
					    /// through debug info anchors.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -550,7 +550,7 @@ DIType DIBuilder::createEnumerationType(DIDescriptor Scope, StringRef Name,
 | 
				
			||||||
                                        uint64_t SizeInBits,
 | 
					                                        uint64_t SizeInBits,
 | 
				
			||||||
                                        uint64_t AlignInBits,
 | 
					                                        uint64_t AlignInBits,
 | 
				
			||||||
                                        DIArray Elements,
 | 
					                                        DIArray Elements,
 | 
				
			||||||
                                        DIType ClassType, unsigned Flags) {
 | 
					                                        DIType ClassType) {
 | 
				
			||||||
  // TAG_enumeration_type is encoded in DICompositeType format.
 | 
					  // TAG_enumeration_type is encoded in DICompositeType format.
 | 
				
			||||||
  Value *Elts[] = {
 | 
					  Value *Elts[] = {
 | 
				
			||||||
    GetTagConstant(VMContext, dwarf::DW_TAG_enumeration_type),
 | 
					    GetTagConstant(VMContext, dwarf::DW_TAG_enumeration_type),
 | 
				
			||||||
| 
						 | 
					@ -561,7 +561,7 @@ DIType DIBuilder::createEnumerationType(DIDescriptor Scope, StringRef Name,
 | 
				
			||||||
    ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
 | 
					    ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
 | 
				
			||||||
    ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
 | 
					    ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
 | 
				
			||||||
    ConstantInt::get(Type::getInt32Ty(VMContext), 0),
 | 
					    ConstantInt::get(Type::getInt32Ty(VMContext), 0),
 | 
				
			||||||
    ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
 | 
					    ConstantInt::get(Type::getInt32Ty(VMContext), 0),
 | 
				
			||||||
    ClassType,
 | 
					    ClassType,
 | 
				
			||||||
    Elements,
 | 
					    Elements,
 | 
				
			||||||
    ConstantInt::get(Type::getInt32Ty(VMContext), 0),
 | 
					    ConstantInt::get(Type::getInt32Ty(VMContext), 0),
 | 
				
			||||||
| 
						 | 
					@ -706,7 +706,9 @@ DIType DIBuilder::createTemporaryType(DIFile F) {
 | 
				
			||||||
/// can be RAUW'd if the full type is seen.
 | 
					/// can be RAUW'd if the full type is seen.
 | 
				
			||||||
DIType DIBuilder::createForwardDecl(unsigned Tag, StringRef Name,
 | 
					DIType DIBuilder::createForwardDecl(unsigned Tag, StringRef Name,
 | 
				
			||||||
                                    DIDescriptor Scope, DIFile F,
 | 
					                                    DIDescriptor Scope, DIFile F,
 | 
				
			||||||
                                    unsigned Line, unsigned RuntimeLang) {
 | 
					                                    unsigned Line, unsigned RuntimeLang,
 | 
				
			||||||
 | 
					                                    uint64_t SizeInBits,
 | 
				
			||||||
 | 
					                                    uint64_t AlignInBits) {
 | 
				
			||||||
  // Create a temporary MDNode.
 | 
					  // Create a temporary MDNode.
 | 
				
			||||||
  Value *Elts[] = {
 | 
					  Value *Elts[] = {
 | 
				
			||||||
    GetTagConstant(VMContext, Tag),
 | 
					    GetTagConstant(VMContext, Tag),
 | 
				
			||||||
| 
						 | 
					@ -714,9 +716,8 @@ DIType DIBuilder::createForwardDecl(unsigned Tag, StringRef Name,
 | 
				
			||||||
    MDString::get(VMContext, Name),
 | 
					    MDString::get(VMContext, Name),
 | 
				
			||||||
    F,
 | 
					    F,
 | 
				
			||||||
    ConstantInt::get(Type::getInt32Ty(VMContext), Line),
 | 
					    ConstantInt::get(Type::getInt32Ty(VMContext), Line),
 | 
				
			||||||
    // To ease transition include sizes etc of 0.
 | 
					    ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
 | 
				
			||||||
    ConstantInt::get(Type::getInt32Ty(VMContext), 0),
 | 
					    ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
 | 
				
			||||||
    ConstantInt::get(Type::getInt32Ty(VMContext), 0),
 | 
					 | 
				
			||||||
    ConstantInt::get(Type::getInt32Ty(VMContext), 0),
 | 
					    ConstantInt::get(Type::getInt32Ty(VMContext), 0),
 | 
				
			||||||
    ConstantInt::get(Type::getInt32Ty(VMContext),
 | 
					    ConstantInt::get(Type::getInt32Ty(VMContext),
 | 
				
			||||||
                     DIDescriptor::FlagFwdDecl),
 | 
					                     DIDescriptor::FlagFwdDecl),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,16 +5,14 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
!llvm.dbg.cu = !{!0}
 | 
					!llvm.dbg.cu = !{!0}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
!0 = metadata !{i32 786449, i32 0, i32 4, metadata !"foo.cpp", metadata !"/Users/echristo/tmp", metadata !"clang version 3.2 (trunk 157772) (llvm/trunk 157761)", i1 true, i1 false, metadata !"", i32 0, metadata !1, metadata !6, metadata !6, metadata !7} ; [ DW_TAG_compile_unit ]
 | 
					!0 = metadata !{i32 786449, i32 0, i32 4, metadata !"foo.cpp", metadata !"/tmp", metadata !"clang version 3.2 (trunk 165274) (llvm/trunk 165272)", i1 true, i1 false, metadata !"", i32 0, metadata !1, metadata !1, metadata !1, metadata !3} ; [ DW_TAG_compile_unit ] [/tmp/foo.cpp] [DW_LANG_C_plus_plus]
 | 
				
			||||||
!1 = metadata !{metadata !2}
 | 
					!1 = metadata !{metadata !2}
 | 
				
			||||||
!2 = metadata !{metadata !3}
 | 
					!2 = metadata !{i32 0}
 | 
				
			||||||
!3 = metadata !{i32 786436, null, metadata !"E", metadata !4, i32 1, i64 16, i64 16, i32 0, i32 4, null, metadata !5, i32 0, i32 0} ; [ DW_TAG_enumeration_type ]
 | 
					!3 = metadata !{metadata !4}
 | 
				
			||||||
!4 = metadata !{i32 786473, metadata !"foo.cpp", metadata !"/Users/echristo/tmp", null} ; [ DW_TAG_file_type ]
 | 
					!4 = metadata !{metadata !5}
 | 
				
			||||||
!5 = metadata !{i32 0}
 | 
					!5 = metadata !{i32 786484, i32 0, null, metadata !"e", metadata !"e", metadata !"", metadata !6, i32 2, metadata !7, i32 0, i32 1, i16* @e} ; [ DW_TAG_variable ] [e] [line 2] [def]
 | 
				
			||||||
!6 = metadata !{metadata !5}
 | 
					!6 = metadata !{i32 786473, metadata !"foo.cpp", metadata !"/tmp", null} ; [ DW_TAG_file_type ]
 | 
				
			||||||
!7 = metadata !{metadata !8}
 | 
					!7 = metadata !{i32 786436, null, metadata !"E", metadata !6, i32 1, i64 16, i64 16, i32 0, i32 4, null, null, i32 0} ; [ DW_TAG_enumeration_type ] [E] [line 1, size 16, align 16, offset 0] [fwd] [from ]
 | 
				
			||||||
!8 = metadata !{metadata !9}
 | 
					 | 
				
			||||||
!9 = metadata !{i32 786484, i32 0, null, metadata !"e", metadata !"e", metadata !"", metadata !4, i32 2, metadata !3, i32 0, i32 1, i16* @e} ; [ DW_TAG_variable ]
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
; CHECK: DW_TAG_enumeration_type
 | 
					; CHECK: DW_TAG_enumeration_type
 | 
				
			||||||
; CHECK-NEXT: DW_AT_name
 | 
					; CHECK-NEXT: DW_AT_name
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue