summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDebugInfo.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [DebugInfo] Changed DIBuilder::createCompileUnit() to take DIFile instead of ↵Amjad Aboud2016-12-141-5/+7
| | | | | | | | | | | | FileName and Directory. This way it will be easier to expand DIFile (e.g., to contain checksum) without the need to modify the createCompileUnit() API. Reviewers: cfe-commits, rnk Differential Revision: https://reviews.llvm.org/D27763 llvm-svn: 289701
* [DebugInfo] Add support for __fp16, float, and double constants.David Gross2016-12-081-0/+3
| | | | | | | | | | | | | | | | | | | Summary: Partial fix for PR26619. Prior to this change, a DIGlobalVariable corresponding to a static const was marked with an expression corresponding to its constant value only if it is of integral type. With this change, we now do the same if it is of __fp16, float, or double type (that is, floating-point types that do not exceed 64 bits in size, and hence are supported easily by the existing LLVM machinery for creating constant expressions in debug info). Reviewers: llvm-commits Differential Revision: https://reviews.llvm.org/D27549 llvm-svn: 289094
* Accept nullability qualifiers on array parameters.Jordan Rose2016-11-101-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since array parameters decay to pointers, '_Nullable' and friends should be available for use there as well. This is especially important for parameters that are typedefs of arrays. The unsugared syntax for this follows the syntax for 'static'-sized arrays in C: void test(int values[_Nullable]); This syntax was previously accepted but the '_Nullable' (and any other attributes) were silently discarded. However, applying '_Nullable' to a typedef was previously rejected and is now accepted; therefore, it may be necessary to test for the presence of this feature: #if __has_feature(nullability_on_arrays) One important change here is that DecayedTypes don't always immediately contain PointerTypes anymore; they may contain an AttributedType instead. This only affected one place in-tree, so I would guess it's not likely to cause problems elsewhere. This commit does not change -Wnullability-completeness just yet. I want to think about whether it's worth doing something special to avoid breaking existing clients that compile with -Werror. It also doesn't change '#pragma clang assume_nonnull' behavior, which currently treats the following two declarations as equivalent: #pragma clang assume_nonnull begin void test(void *pointers[]); #pragma clang assume_nonnull end void test(void * _Nonnull pointers[]); This is not the desired behavior, but changing it would break backwards-compatibility. Most likely the best answer is going to be adding a new warning. Part of rdar://problem/25846421 llvm-svn: 286519
* Add the loop end location to the loop metadata. This additional informationAmara Emerson2016-11-101-0/+9
| | | | | | | | | | | | can be used to improve the locations when generating remarks for loops. Depends on the companion LLVM change r286227. Patch by Florian Hahn. Differential Revision: https://reviews.llvm.org/D25764 llvm-svn: 286456
* Use an artificial debug location for non-virtual thunks.Adrian Prantl2016-11-091-3/+2
| | | | | | | | | Thunks are artificial and have no corresponding source location except for the line number on the DISubprogram, which is marked as artificial. <rdar://problem/11941095> llvm-svn: 286400
* Emit debug info for global constants whose address is taken exactly once.Adrian Prantl2016-11-091-0/+7
| | | | | | | | | Add a check to the DeclCache before emitting debug info for a GlobalVariable a second time and just attach the previsously created one to it. <rdar://problem/26721101> llvm-svn: 286322
* Add debug info support for C++11 inline namespaces.Adrian Prantl2016-11-031-2/+2
| | | | | | <rdar://problem/18616046> llvm-svn: 285960
* regcall: Implement regcall Calling Conv in clangErich Keane2016-11-021-0/+1
| | | | | | | | | | This patch implements the register call calling convention, which ensures as many values as possible are passed in registers. CodeGen changes were committed in https://reviews.llvm.org/rL284108. Differential Revision: https://reviews.llvm.org/D25204 llvm-svn: 285849
* DebugInfo: support for DW_TAG_atomic_typeVictor Leschuk2016-10-311-3/+2
| | | | | | | | Mark C11 _Atomic variables with DW_TAG_atomic_type tag. Differential Revision: https://reviews.llvm.org/D26145 llvm-svn: 285625
* [codeview] emit debug info for indirect virtual base classesBob Haarman2016-10-251-8/+29
| | | | | | | | | | | | | | | Summary: Fixes PR28281. MSVC lists indirect virtual base classes in the field list of a class. This change makes Clang emit the information necessary for LLVM to emit such records. Reviewers: rnk, ruiu, zturner Differential Revision: https://reviews.llvm.org/D25579 llvm-svn: 285132
* DebugInfo: pass alignment value only if it was forcedVictor Leschuk2016-10-201-50/+74
| | | | | | | | | | Preparation to implement DW_AT_alignment support: - We pass non-zero align value to DIBuilder only when alignment was forced - Modify tests to match this change Differential Revision: https://reviews.llvm.org/D24426 llvm-svn: 284679
* Don't crash generating debug info for VLA in function prototype.Eli Friedman2016-10-191-3/+5
| | | | | | | | Fixes regression from r279445. Differential Revision: https://reviews.llvm.org/D25793 llvm-svn: 284652
* DebugInfo: use uint32_t for alignment variables.Victor Leschuk2016-10-191-17/+17
| | | | | | | | | LLVM now uses uint32_t for DebugInfo alignment for space efficiency, in this patch we change frontend DebugInfo-related variables to uint32_t too. Differential Revision: https://reviews.llvm.org/D25621 llvm-svn: 284651
* ObjectiveC generics: Add ObjCTypeParamType in the type system.Manman Ren2016-09-131-0/+14
| | | | | | | | | | | | | | | | | We also need to add ObjCTypeParamTypeLoc. ObjCTypeParamType supports the representation of "T <protocol>" where T is a type parameter. Before this, we use TypedefType to represent the type parameter for ObjC. ObjCTypeParamType has "ObjCTypeParamDecl *OTPDecl" and it extends from ObjCProtocolQualifiers. It is a non-canonical type and is canonicalized to the underlying type with the protocol qualifiers. rdar://24619481 rdar://25060179 Differential Revision: http://reviews.llvm.org/D23079 llvm-svn: 281355
* Update Clang for D20147 ("DebugInfo: New metadata representation for global ↵Peter Collingbourne2016-09-131-6/+10
| | | | | | | | variables.") Differential Revision: http://reviews.llvm.org/D20415 llvm-svn: 281285
* [DebugInfo] Deduplicate debug info limiting logicReid Kleckner2016-09-131-21/+10
| | | | | | | | | | | | | We should be doing the same checks when a type is completed as we do when a complete type is used during emission. Previously, we duplicated the logic, and it got out of sync. This could be observed with dllimported classes. Also reduce a test case for this slightly. Implementing review feedback from David Blaikie on r281057. llvm-svn: 281278
* [DebugInfo] Ensure complete type is emitted with -fstandalone-debugReid Kleckner2016-09-091-3/+7
| | | | | | | | | | | The logic for upgrading a class from a forward decl to a complete type was not checking the debug info emission level before applying the vtable optimization. This meant we ended up without debug info for a class which was required to be complete. I noticed it because it triggered an assertion during CodeView emission, but that's a separate issue. llvm-svn: 281057
* [codeview] Extend the heuristic for detecting classes imported from DLLsReid Kleckner2016-09-091-3/+15
| | | | | | | | | | | | | | If a dynamic class contains a dllimport method, then assume the class may not be constructed in this DLL, and therefore the vtable will live in a different PDB. This heuristic is still incomplete, and will miss things like abstract base classes that are only constructed on one side of the DLL interface. That said, this heuristic does detect some cases that are currently problematic, and may be useful to other projects that don't use many DLLs. llvm-svn: 281053
* CodeGen: Clean up implementation of vtable initializer builder. NFC.Peter Collingbourne2016-09-081-1/+1
| | | | | | | | | | | | | - Simplify signature of CreateVTableInitializer function. - Move vtable component builder to a separate function. - Remove unnecessary accessors from VTableLayout class. This is in preparation for a future change that will alter the type of the vtable initializer. Differential Revision: https://reviews.llvm.org/D22642 llvm-svn: 280897
* Formatting with clang-format patch r280701Leny Kholodov2016-09-061-23/+24
| | | | llvm-svn: 280718
* DebugInfo: use llvm::DINode::DIFlags type for debug info flagsLeny Kholodov2016-09-061-33/+39
| | | | | | | | | | Use llvm::DINode::DIFlags type (strongly typed enum) for debug flags instead of unsigned int to avoid problems on platforms with sizeof(int) < 4: we already have flags with values > (1 << 16). Patch by: Victor Leschuk <vleschuk@gmail.com> Differential Revision: https://reviews.llvm.org/D23767 llvm-svn: 280701
* [codeview] Don't emit vshape info for classes without vfptrsReid Kleckner2016-08-311-1/+8
| | | | | | | | | | | | Classes with no virtual methods or whose virtual methods were all inherited from virtual bases don't have a vfptr at offset zero. We were crashing attempting to get the layout of that non-existent vftable. We don't need any vshape info in this case because the debugger can infer it from the base class information. The current class may not introduce any virtual methods if we are in this situation. llvm-svn: 280287
* [codeview] Pass through vftable shape informationReid Kleckner2016-08-311-10/+37
| | | | | | | | | | | | | | | The shape is really just the number of methods in the vftable, since we don't support 16 bit far calls. All calls are near. Encode this number in the size of the artificial __vtbl_ptr_type DIDerivedType that we generate. For DWARF, this will be a normal pointer, but for codeview this will be a wide pointer that gets pattern matched into a VFTableShape record. Insert this type into the element list of all dynamic classes when emitting CodeView, so that the backend can emit the shape even if the vptr lives in a primary base class. Fixes PR28150 llvm-svn: 280255
* DebugInfo: Add flag to CU to disable emission of inline debug info into the ↵David Blaikie2016-08-241-1/+2
| | | | | | | | | | skeleton CU In cases where .dwo/.dwp files are guaranteed to be available, skipping the extra online (in the .o file) inline info can save a substantial amount of space - see the original r221306 for more details there. llvm-svn: 279651
* Add comments. NFCAdrian Prantl2016-08-221-0/+2
| | | | llvm-svn: 279490
* Module debug info: Don't assert when encountering an incomplete definitionAdrian Prantl2016-08-221-1/+2
| | | | | | | | | | in isDefinedInClangModule() and assume that the incomplete definition is not defined in the module. This broke the -gmodules self host recently. rdar://problem/27894367 llvm-svn: 279485
* PR29086: DebugInfo: Improve support for fixed array dimensions in variable ↵David Blaikie2016-08-221-0/+5
| | | | | | length arrays llvm-svn: 279445
* Module debug info: Fix a bug in handling record decls without fields.Adrian Prantl2016-08-171-5/+8
| | | | | | | | | | | The previous condition would erroneously mark all CXXRecordDecls that didn't have any fields as being defined in a clang module. This patch fixes the condition to only apply to explicit template instantiations. <rdar://problem/27771823> llvm-svn: 278952
* Debug info: Mark noreturn functions with DIFlagNoReturn.Adrian Prantl2016-08-171-0/+3
| | | | | | | | | | | This affects functions with the C++11 [[ noreturn ]] and C11 _Noreturn specifiers. Patch by Victor Leschuk! https://reviews.llvm.org/D23168 llvm-svn: 278942
* Emit debug info for dynamic classes if they are imported from a DLL.Adrian McCarthy2016-08-161-1/+6
| | | | | | | | | | With -debug-info-kind=limited, we omit debug info for dynamic classes that live in other TUs. This reduces duplicate type information. When statically linked, the type information comes together. But if your binary has a class derived from a base in a DLL, the base class info is not available to the debugger. The decision is made in shouldOmitDefinition (CGDebugInfo.cpp). Per a suggestion from rnk, I've tweaked the decision so that we do include definitions for classes marked as DLL imports. This should be a relatively small number of classes, so we don't pay a large price for duplication of the type info, yet it should cover most cases on Windows. Essentially this makes debug info for DLLs independent, but we still assume that all TUs within the same DLL will be consistently built with (or without) debug info and the debugger will be able to search across the debug info within that scope to resolve any declarations into definitions, etc. llvm-svn: 278861
* PR26423: Assert on valid use of using declaration of a function with an ↵David Blaikie2016-08-051-0/+10
| | | | | | | | | | | | undeduced auto return type For now just disregard the using declaration in this case. Suboptimal, but wiring up the ability to have declarations of functions that are separate from their definition (we currently only do that for member functions) and have differing return types (we don't have any support for that) is more work than seems reasonable to at least fix this crash. llvm-svn: 277852
* [codeview] Skip injected class names in nested record emissionReid Kleckner2016-08-011-0/+3
| | | | | | | | We were already trying to do this, but our check wasn't quite right. Fixes PR28790 llvm-svn: 277367
* [OpenCL] Generate opaque type for sampler_t and function call for the ↵Yaxun Liu2016-07-281-3/+2
| | | | | | | | | | | | | | | | initializer Currently Clang use int32 to represent sampler_t, which have been a source of issue for some backends, because in some backends sampler_t cannot be represented by int32. They have to depend on kernel argument metadata and use IPA to find the sampler arguments and global variables and transform them to target specific sampler type. This patch uses opaque pointer type opencl.sampler_t* for sampler_t. For each use of file-scope sampler variable, it generates a function call of __translate_sampler_initializer. For each initialization of function-scope sampler variable, it generates a function call of __translate_sampler_initializer. Each builtin library can implement its own __translate_sampler_initializer(). Since the real sampler type tends to be architecture dependent, allowing it to be initialized by a library function simplifies backend design. A typical implementation of __translate_sampler_initializer could be a table lookup of real sampler literal values. Since its argument is always a literal, the returned pointer is known at compile time and easily optimized to finally become some literal values directly put into image read instructions. This patch is partially based on Alexey Sotkin's work in Khronos Clang (https://github.com/KhronosGroup/SPIR/commit/3d4eec61623502fc306e8c67c9868be2b136e42b). Differential Revision: https://reviews.llvm.org/D21567 llvm-svn: 277024
* Reroll "Include unreferenced nested types in member list only for CodeView"Adrian McCarthy2016-07-211-3/+18
| | | | | | Another attempt at r276271, hopefully without breaking ModuleDebugInfo test. llvm-svn: 276317
* Revert "Include unreferenced nested types in member list only for CodeView"Adrian McCarthy2016-07-211-18/+3
| | | | | | | | | | Patch broke ModuleDebugInfo test on the build bots (but not locally). Again. svn revision: r276271 This reverts commit 9da8a1b05362bc96f2855fb32b5588b89407685d. llvm-svn: 276279
* Include unreferenced nested types in member list only for CodeViewAdrian McCarthy2016-07-211-3/+18
| | | | | | Unreferenced nested structs and classes were omitted from the debug info. In DWARF, this was intentional, to avoid bloat. But for CodeView, we want this information to be consistent with what Microsoft tools would produce and expect. llvm-svn: 276271
* [CodeGen] Some assorted cleanupsDavid Majnemer2016-07-171-69/+58
| | | | | | | | | | No functional change, just some cleanups: - Use auto when it is appropriate. - There were some strange static_casts which were superfluous. - Use range-based for loops when appropriate. - The dyn_cast_or_null construct was used when null was impossible. llvm-svn: 275699
* [AST] Use ArrayRef in more interfacesDavid Majnemer2016-07-071-4/+2
| | | | | | | | | ArrayRef is a little better than passing around a pointer/length pair. No functional change is intended. llvm-svn: 274732
* Revert "Retry "Include debug info for nested structs and classes""Adrian McCarthy2016-07-061-12/+2
| | | | | | | | | | Reverting because it causes a test failure on build bots (Modules/ModuleDebugInfo.cpp). Failure does not reproduce locally. svn revision: rL274698 This reverts commit 3c5ed6599b086720aab5b8bd6941149d066806a6. llvm-svn: 274706
* Retry "Include debug info for nested structs and classes"Adrian McCarthy2016-07-061-2/+12
| | | | | | | | | | This should work now that the LLVM-side of the change has landed successfully. Original Differential Revision: http://reviews.llvm.org/D21705 This reverts commit a30322e861c387e1088f47065d0438c6bb019879. llvm-svn: 274698
* [CodeGen, DebugInfo] Use hasLocalLinkage instead of hasInternalLinkageDavid Majnemer2016-07-061-3/+3
| | | | | | | | For the purpose of emitting debug info, entities with private linkage should be treated the same as internal linkage. While this doesn't change anything in practice, it makes the code a little less confusing. llvm-svn: 274677
* Revert "Include debug info for nested structs and classes"Adrian McCarthy2016-07-061-12/+2
| | | | | | This reverts commit 0af5ee9631c7c167dc40498b415876553e314c95. llvm-svn: 274633
* Include debug info for nested structs and classesAdrian McCarthy2016-07-061-2/+12
| | | | | | | | This includes nested types in the member list, even if there are no members of that type. Note that structs and classes have themselves as an "implicit struct" as the first member, so we skip implicit ones. Differential Revision: http://reviews.llvm.org/D21705 llvm-svn: 274628
* [CodeView] Include MSVC style names for unnamed typesDavid Majnemer2016-07-011-9/+45
| | | | | | | | The CodeView printer expects to be able to generate fully qualified names from the debug info graph. This means that we need to include the MSVC-style name in the debug info for anonymous types. llvm-svn: 274401
* [DebugInfo] Set DISubprogram ThisAdjustment in the MS ABIReid Kleckner2016-07-011-6/+10
| | | | llvm-svn: 274326
* [codeview] Emit qualified display names if -gline-tables-only is onReid Kleckner2016-06-301-4/+14
| | | | | | | | | | | | | | | | | | When -gmlt is on, we don't emit namespace or class scope information, and the CodeView emission code in LLVM can't compute the fully qualified name. If we know LLVM won't be able to get the name right, go ahead and emit the qualified name in the frontend. We could change our -gmlt emission strategy to include those scopes when emitting codeview, but that would increase memory usage and slow down LTO and add more complexity to debug info emission. The same problem exists when you debug a -gmlt binary with GDB, so we should consider removing '&& EmitCodeView' from the condition here at some point in the future after evaluating the impact on object file size. llvm-svn: 274246
* AMDGPU: Set amdgpu_kernel calling convention for OpenCL kernels.Nikolay Haustov2016-06-301-1/+1
| | | | | | | | | | | | | | | | | | Summary: Summary: Change Clang calling convention SpirKernel to OpenCLKernel. Set calling convention OpenCLKernel for amdgcn as well. Add virtual method .getOpenCLKernelCallingConv() to TargetCodeGenInfo and use it to set target calling convention for AMDGPU and SPIR. Update tests. Reviewers: rsmith, tstellarAMD, Anastasia, yaxunl Subscribers: kzhuravl, cfe-commits Differential Revision: http://reviews.llvm.org/D21367 llvm-svn: 274220
* [CodeView] Implement support for bitfields in ClangDavid Majnemer2016-06-301-34/+55
| | | | | | | | | | | Emit the underlying storage offset in addition to the starting bit position of the field. This fixes PR28162. Differential Revision: http://reviews.llvm.org/D21783 llvm-svn: 274201
* Use more ArrayRefsDavid Majnemer2016-06-241-1/+1
| | | | | | No functional change is intended, just a small refactoring. llvm-svn: 273647
* [codeview] Set the new IntroducedVirtual debug info flagReid Kleckner2016-06-221-0/+9
| | | | llvm-svn: 273454
OpenPOWER on IntegriCloud