summaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
AgeCommit message (Collapse)Author
2016-07-01[codeview] Add DISubprogram::ThisAdjustmentReid Kleckner
Summary: This represents the adjustment applied to the implicit 'this' parameter in the prologue of a virtual method in the MS C++ ABI. The adjustment is always zero unless multiple inheritance is involved. This increases the size of DISubprogram by 8 bytes, unfortunately. The adjustment really is a signed 32-bit integer. If this size increase is too much, we could probably win it back by splitting out a subclass with info specific to virtual methods (virtuality, vindex, thisadjustment, containingType). Reviewers: aprantl, dexonsmith Subscribers: aaboud, amccarth, llvm-commits Differential Revision: http://reviews.llvm.org/D21614 llvm-svn: 274325
2016-06-30[CodeView] Implement support for bitfields in LLVMDavid Majnemer
CodeView need to know the offset of the storage allocation for a bitfield. Encode this via the "extraData" field in DIDerivedType and introduced a new flag, DIFlagBitField, to indicate whether or not a member is a bitfield. This fixes PR28162. Differential Revision: http://reviews.llvm.org/D21782 llvm-svn: 274200
2016-06-26Revert r273807 (and r273809, r273810), it caused PR28311Nico Weber
llvm-svn: 273815
2016-06-26Fixed build failure (due to unused variable error) in r273807.Amjad Aboud
llvm-svn: 273810
2016-06-26Fixed build failure (due to unused variable error) in r273807.Amjad Aboud
llvm-svn: 273809
2016-06-26[codeview] Improved array type support.Amjad Aboud
Added support for: 1. Multi dimension array. 2. Array of structure type, which previously was declared incompletely. 3. Dynamic size array. Differential Revision: http://reviews.llvm.org/D21526 llvm-svn: 273807
2016-06-24[codeview] Emit parameter variables in the right orderReid Kleckner
Clang emits them in reverse order to conform to the ABI, which requires left-to-right destruction. As a result, the order doesn't fall out naturally, and we have to sort things out in the backend. Fixes PR28213 llvm-svn: 273696
2016-06-24[codeview] Emit base class information from DW_TAG_inheritance nodesReid Kleckner
There are two remaining issues here: 1. No vbptr information 2. Need to mention indirect virtual bases Getting indirect virtual bases is just a matter of adding an "indirect" flag, emitting them in the frontend, and ignoring them when appropriate for DWARF. All virtual bases use the same artificial vbptr field, so I think the vbptr offset will be best represented by an implicit __vbptr$ClassName member similar to our existing __vptr$ member. llvm-svn: 273688
2016-06-23[codeview] Add classes and unions to the Local/Global UDTs listsHans Wennborg
Differential Revision: http://reviews.llvm.org/D21655 llvm-svn: 273626
2016-06-23[codeview] Emit retained typesHans Wennborg
Differential Revision: http://reviews.llvm.org/D21630 llvm-svn: 273579
2016-06-22[codeview] Write LF_UDT_SRC_LINE records (PR28251)Hans Wennborg
Differential Revision: http://reviews.llvm.org/D21621 llvm-svn: 273495
2016-06-22[codeview] Add IntroducingVirtual debug info flagReid Kleckner
CodeView needs to know if a virtual method was introduced in the current class, and base classes may not have complete type information, so we need to thread this bit through from the frontend. llvm-svn: 273453
2016-06-22[codeview] Defer emission of all referenced complete recordsReid Kleckner
This is the motivating example: struct B { int b; }; struct A { B *b; }; int f(A *p) { return p->b->b; } Clang emits complete types for both A and B because they are required to be complete, but our CodeView emission would only emit forward declarations of A and B. This was a consequence of the fact that the A* type must reference the forward declaration of A, which doesn't reference B at all. We can't eagerly emit complete definitions of A and B when we request the forward declaration's type index because of recursive types like linked lists. If we did that, our stack usage could get out of hand, and it would be possible to lower a type while attempting to lower a type, and we would need to double check if our type is already present in the TypeIndexMap after all recursive getTypeIndex calls. Instead, defer complete type emission until after all type lowering has completed. This ensures that all referenced complete types are emitted, and that type lowering is not re-entrant. llvm-svn: 273443
2016-06-22[codeview] Remove ClassInfoMapReid Kleckner
From a design perspective, complete record type emission should not depend on information from other complete record types. Currently this map is unused, and needlessly accumulates data throughout compilation. llvm-svn: 273431
2016-06-22[codeview] Improve names of types in scopes and member function idsReid Kleckner
We now include namespace scope info in LF_FUNC_ID records and we emit LF_MFUNC_ID records for member functions as we should. Class names are now fully qualified, which is what MSVC does. Add a little bit of scaffolding to handle ThisAdjustment when it arrives in DISubprogram. llvm-svn: 273358
2016-06-21[codeview] Fix DenseMap pointer invalidation bugReid Kleckner
When you have a map holding a unique_ptr, hold a reference to the raw pointer instead of the unique pointer. The unique_ptr will be moved on rehash. llvm-svn: 273268
2016-06-18[codeview] Emit non-virtual method type.Amjad Aboud
Differential Revision: http://reviews.llvm.org/D21011 llvm-svn: 273084
2016-06-17[codeview] Emit incomplete member pointer types with the unknown modelReid Kleckner
An incomplete member pointer type will always have a size of zero, so we don't need an extra flag. Credit to David Majnemer for the idea. llvm-svn: 273057
2016-06-17[codeview] Add DIFlags for pointer to member representationsReid Kleckner
Summary: This seems like the least intrusive way to pass this information through. Fixes PR28151 Reviewers: majnemer, aprantl, dblaikie Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D21444 llvm-svn: 273053
2016-06-17[CodeView] Refactor enumerator emissionDavid Majnemer
This addresses Amjad's review comments on D21442. llvm-svn: 273010
2016-06-17[codeview] Make function names more consistent with MSVCReid Kleckner
Names in function id records don't include nested name specifiers or template arguments, but names in the symbol stream include both. For the symbol stream, instead of having Clang put the fully qualified name in the subprogram display name, recreate it from the subprogram scope chain. For the type stream, take the unqualified name and chop of any template arguments. This makes it so that CodeView DI metadata is more similar to DWARF DI metadata. llvm-svn: 273009
2016-06-16[CodeView] Implement support for enumsDavid Majnemer
MSVC handles enums differently from structs and classes: a forward declaration is not emitted unconditionally. MSVC does not emit an S_UDT record for the enum. Differential Revision: http://reviews.llvm.org/D21442 llvm-svn: 272960
2016-06-16Resubmit "[pdb] Change type visitor pattern to be dynamic."Zachary Turner
There was a regression introduced during type stream merging when visiting a field list record. This has been fixed in this patch. llvm-svn: 272929
2016-06-16Revert "[pdb] Change type visitor pattern to be dynamic."Zachary Turner
This reverts commit fb0dd311e1ad945827b8ffd5354f4810e2be1579. This breaks some llvm-readobj tests. llvm-svn: 272927
2016-06-16[pdb] Change type visitor pattern to be dynamic.Zachary Turner
This allows better catching of compiler errors since we can use the override keyword to verify that methods are actually overridden. Also in this patch I've changed from storing a boolean Error code everywhere to returning an llvm::Error, to propagate richer error information up the call stack. Reviewed By: ruiu, rnk Differential Revision: http://reviews.llvm.org/D21410 llvm-svn: 272926
2016-06-15[CodeView] Add support for emitting S_UDT for typedefsDavid Majnemer
Emit a S_UDT record for typedefs. We still need to do something for class types. Differential Revision: http://reviews.llvm.org/D21149 llvm-svn: 272813
2016-06-15[CodeView] Don't emit debuginfo for imported symbolsDavid Majnemer
Emitting symbol information requires us to have a definition for the symbol. A symbol reference is insufficient. This fixes PR28123. llvm-svn: 272738
2016-06-12Pass DebugLoc and SDLoc by const ref.Benjamin Kramer
This used to be free, copying and moving DebugLocs became expensive after the metadata rewrite. Passing by reference eliminates a ton of track/untrack operations. No functionality change intended. llvm-svn: 272512
2016-06-09[codeview] Skip DIGlobalVariables with no variableReid Kleckner
They have probably been discarded during optimization. llvm-svn: 272231
2016-06-08[DebugInfo] Add calling convention support for DWARF and CodeViewReid Kleckner
Summary: Now DISubroutineType has a 'cc' field which should be a DW_CC_ enum. If it is present and non-zero, the backend will emit it as a DW_AT_calling_convention attribute. On the CodeView side, we translate it to the appropriate enum for the LF_PROCEDURE record. I added a new LLVM vendor specific enum to the list of DWARF calling conventions. DWARF does not appear to attempt to standardize these, so I assume it's OK to do this until we coordinate with GCC on how to emit vectorcall convention functions. Reviewers: dexonsmith, majnemer, aaboud, amccarth Subscribers: mehdi_amini, llvm-commits Differential Revision: http://reviews.llvm.org/D21114 llvm-svn: 272197
2016-06-08Generate codeview for array type metadata.Adrian McCarthy
Differential Revision: http://reviews.llvm.org/D21107 llvm-svn: 272187
2016-06-07Re-land "[codeview] Emit information about global variables"Reid Kleckner
This reverts commit r271962 and reinstantes r271957. MSVC's linker doesn't appear to like it if you have an empty symbol substream, so only open a symbol substream if we're going to emit something about globals into it. Makes check-asan pass. llvm-svn: 271965
2016-06-06Revert "[codeview] Emit information about global variables"Reid Kleckner
This reverts commit r271957, it broke check-asan on Windows. llvm-svn: 271962
2016-06-06[codeview] Emit information about global variablesReid Kleckner
This currently emits everything as S_GDATA32, which isn't right for things like thread locals, but it's a start. llvm-svn: 271957
2016-06-04[AsmPrinter, CodeView] There are some more ways of getting wchar_tDavid Majnemer
C++ has a builtin type called wchar_t. Clang also provides a type called __wchar_t in C mode. In C mode, wchar_t can be a typedef to unsigned short. llvm-svn: 271793
2016-06-03[codeview] Add basic record type translationReid Kleckner
This only translates data members for now. Translating overloaded methods is complicated, so I stopped short of doing that. Reviewers: aaboud Differential Revision: http://reviews.llvm.org/D20924 llvm-svn: 271680
2016-06-02[CodeView] Use None instead of Void if there is no subprogramDavid Majnemer
llvm-svn: 271566
2016-06-02[codeview] Fix crash when handling qualified void typesReid Kleckner
The DIType* for void is the null pointer. A null DIType can never be a qualified type, so we can just exit the loop at this point and go to getTypeIndex(BaseTy). Fixes PR27984 llvm-svn: 271550
2016-06-02[CodeView] Implement function-type indicesDavid Majnemer
We still need to do something about member functions and calling conventions. Differential Revision: http://reviews.llvm.org/D20900 llvm-svn: 271541
2016-06-02[CodeView] Use the right type index for long longDavid Majnemer
We used T_INT8 instead of T_QUAD. llvm-svn: 271497
2016-06-02[CodeView] Remove superfluous bitmathDavid Majnemer
llvm-svn: 271495
2016-06-02[codeview] Return type indices for typedefsDavid Majnemer
Use the type index of the underlying type unless we have a typedef from long to HRESULT; HRESULT typedefs are translated to T_HRESULT. llvm-svn: 271494
2016-06-01Fix the NDEBUG buildReid Kleckner
llvm-svn: 271411
2016-06-01[codeview] Translate basic DITypes to CV type recordsReid Kleckner
Summary: This is meant to be the tiniest step towards DIType to CV type index translation that I could come up with. Whenever translation fails, we use type index zero, which is the unknown type. Reviewers: aaboud, zturner Subscribers: llvm-commits, amccarth Differential Revision: http://reviews.llvm.org/D20840 llvm-svn: 271408
2016-05-31[codeview] Improve readability of type record assemblyReid Kleckner
Adds the method MCStreamer::EmitBinaryData, which is usually an alias for EmitBytes. In the MCAsmStreamer case, it is overridden to emit hex dump output like this: .byte 0x0e, 0x00, 0x08, 0x10 .byte 0x03, 0x00, 0x00, 0x00 .byte 0x00, 0x00, 0x00, 0x00 .byte 0x00, 0x10, 0x00, 0x00 Also, when verbose asm comments are enabled, this patch prints the dump output for each comment before its record, like this: # ArgList (0x1000) { # TypeLeafKind: LF_ARGLIST (0x1201) # NumArgs: 0 # Arguments [ # ] # } .byte 0x06, 0x00, 0x01, 0x12 .byte 0x00, 0x00, 0x00, 0x00 This should make debugging easier and testing more convenient. Reviewers: aaboud Subscribers: majnemer, zturner, amccarth, aaboud, llvm-commits Differential Revision: http://reviews.llvm.org/D20711 llvm-svn: 271313
2016-05-25[codeview] Use comdats for debug info describing comdat functionsReid Kleckner
Summary: This allows the linker to discard unused symbol information for comdat functions that were discarded during the link. Before this change, searching for the name of an inline function in the debugger would return multiple results, one per symbol subsection in the object file. After this change, there is only one result, the result for the function chosen by the linker. Reviewers: zturner, majnemer Subscribers: aaboud, amccarth, llvm-commits Differential Revision: http://reviews.llvm.org/D20642 llvm-svn: 270792
2016-05-23Modify emitTypeInformation to use MemoryTypeTableBuilder, take 2Reid Kleckner
This effectively revers commit r270389 and re-lands r270106, but it's almost a rewrite. The behavior change in r270106 was that we could no longer assume that each LF_FUNC_ID record got its own type index. This patch adds a map from DINode* to TypeIndex, so we can stop making that assumption. This change also emits padding bytes between type records similar to the way MSVC does. The size of the type record includes the padding bytes. llvm-svn: 270485
2016-05-23[codeview] Refactor symbol records to use same pattern as types.Zachary Turner
This will pave the way to introduce a full fledged symbol visitor similar to how we have a type visitor, thus allowing the same dumping code to be used in llvm-readobj and llvm-pdbdump. Differential Revision: http://reviews.llvm.org/D20384 Reviewed By: rnk llvm-svn: 270475
2016-05-23Revert "Modify emitTypeInformation to use MemoryTypeTableBuilder"David Majnemer
This reverts commit r270106. It results in certain function types omitted in the output. llvm-svn: 270389
2016-05-19Modify emitTypeInformation to use MemoryTypeTableBuilderAdrian McCarthy
A baby step toward translating DIType records to CodeView. This does not (yet) combine the record length with the record data. I'm going back and forth trying to determine if that's a good idea. llvm-svn: 270106