summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDebugInfo.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Emit the DWARF tag for the RenderScript languagePirama Arumuga Nainar2016-06-211-0/+2
| | | | | | | | | | | | | | Summary: If the RenderScript LangOpt is set, either via '-x renderscript' or the '.rs' file extension, set the DWARF language tag to be that of RenderScript. Reviewers: rsmith Subscribers: cfe-commits, srhines Differential Revision: http://reviews.llvm.org/D21451 llvm-svn: 273321
* [MS] Put member pointer representation flags in our debug infoReid Kleckner2016-06-171-5/+28
| | | | llvm-svn: 273063
* [codeview] Stop emitting fully qualified subprogram display namesReid Kleckner2016-06-171-18/+12
| | | | | | | | This effectively reverts r255744, and leaves the printing option tweaks. We can add the name qualifiers easily in the backend. llvm-svn: 273008
* [DebugInfo] Put the vftable index in the debug infoReid Kleckner2016-06-161-8/+17
| | | | | | | This won't always be enough info to call a virtual method from the debugger, but it's a start. llvm-svn: 272944
* [DebugInfo] Enable generation of unique identifiers for externally visible ↵Reid Kleckner2016-06-161-4/+0
| | | | | | | | MS ABI types We implemented the mangling for this a long time ago. llvm-svn: 272862
* Allow 'nodebug' on local variables.Paul Robinson2016-06-161-0/+4
| | | | | | | | | Parameters and non-static members of aggregates are still excluded, and probably should remain that way. Differential Revision: http://reviews.llvm.org/D19754 llvm-svn: 272859
* [DebugInfo] Add calling conventions to DISubroutineTypeReid Kleckner2016-06-081-7/+46
| | | | | | | | | | | | | | | | | | | | | | | Summary: This should have been a very simple change, but it was greatly complicated by the construction of new Decls during IR generation. In particular, we reconstruct the AST function type in order to get the implicit 'this' parameter into C++ method types. We also have to worry about FunctionDecls whose types are not FunctionTypes because CGBlocks.cpp constructs some dummy FunctionDecls with 'void' type. Depends on D21114 Reviewers: aprantl, dblaikie Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D21141 llvm-svn: 272198
* Enable support for __float128 in Clang and enable it on pertinent platformsNemanja Ivanovic2016-05-091-0/+6
| | | | | | | | | | | | | | | | | | This patch corresponds to reviews: http://reviews.llvm.org/D15120 http://reviews.llvm.org/D19125 It adds support for the __float128 keyword, literals and target feature to enable it. Based on the latter of the two aforementioned reviews, this feature is enabled on Linux on i386/X86 as well as SystemZ. This is also the second attempt in commiting this feature. The first attempt did not enable it on required platforms which caused failures when compiling type_traits with -std=gnu++11. If you see failures with compiling this header on your platform after this commit, it is likely that your platform needs to have this feature enabled. llvm-svn: 268898
* [modules][debuginfo] Only include imported modules when targeting LLDBDavid Blaikie2016-05-031-0/+2
| | | | | | | | | | | | | | | | | These constructs are only applicable to a debugger capable of loading a Clang AST, so omit them for brevity when not doing so. We could potentially propagate more of CodeGenOptions through the ObjectFilePCGContainerOperations for consistency (so the next person who adds some CodeGenOpts feature that tweaks debug info output doesn't get caught by this), so I'm open to objections/alternatives there, but went with this for now. Tested just a couple of basic cases (one direct, one indirect (through the ObjectFilePCHContainerOperations) & fixed up other cases to pass the -debugger-tuning flag as appropriate. llvm-svn: 268460
* Reverting 268055 as it caused PR27579.Amjad Aboud2016-04-301-34/+7
| | | | llvm-svn: 268151
* Recommitted r264281 "Supporting all entities declared in lexical scope in ↵Amjad Aboud2016-04-291-7/+34
| | | | | | | | LLVM debug info." After fixing PR26942 in r267004. llvm-svn: 268055
* PR21823: 'nodebug' attribute on global/static variables.Paul Robinson2016-04-271-0/+6
| | | | | | | | | | Make 'nodebug' on a global/static variable suppress all debug info for the variable. Previously it would only suppress info for the associated initializer function, if any. Differential Revision: http://reviews.llvm.org/D19567 llvm-svn: 267746
* Module debugging: Add an assertion.Adrian Prantl2016-04-261-1/+3
| | | | llvm-svn: 267633
* Module debugging: Also correctly handle typedef'd foward-declared members.Adrian Prantl2016-04-261-7/+6
| | | | | | Thanks again to Richard Smith for pointing this out. llvm-svn: 267630
* Module debugging: Use the definition to determine module-defined types.Adrian Prantl2016-04-261-4/+2
| | | | | | Follow-up to r267464. Thanks to Richard Smith for pointing this out! llvm-svn: 267611
* Module Debugging: Fix the condition for determining whether a templateAdrian Prantl2016-04-251-3/+19
| | | | | | | | | | | | | | | | | | instantiation is in a module. This patch fixes the condition for determining whether the debug info for a template instantiation will exist in an imported clang module by: - checking whether the ClassTemplateSpecializationDecl is complete and - checking that the instantiation was in a module by looking at the first field. I also added a negative check to make sure that a typedef to a forward-declared template (with the definition outside of the module) is handled correctly. http://reviews.llvm.org/D19443 rdar://problem/25553724 llvm-svn: 267464
* DebugInfo: Adapt to loss of DITypeRef in LLVM r267296Duncan P. N. Exon Smith2016-04-231-5/+3
| | | | | | | | | | | | | LLVM stopped using MDString-based type references, and DIBuilder no longer fills 'retainedTypes:' with every DICompositeType that has an 'identifier:' field. There are just minor changes to keep the same behaviour in CFE. Leaving 'retainedTypes:' unfilled has a dramatic impact on the output order of the IR though. There are a huge number of testcase changes, which were unfortunately not really scriptable. llvm-svn: 267297
* Module Debugging: Emit the canonical debug info for Objective-C classesAdrian Prantl2016-04-201-2/+5
| | | | | | | | | | | | | in the compile unit that contains their implementation even if their interface is declared in a module. The private @implementation of an @interface may have additional hidden ivars so we should not defer to the public version of the type that is found in the module. <rdar://problem/25541798> llvm-svn: 266937
* [ObjC++] Fix crash when emitting debug info for a block member capturing this.Adrian Prantl2016-04-181-3/+8
| | | | | | rdar://problem/23871824 llvm-svn: 266698
* DebugInfo: Make DICompositeTypes distinct most of the timeDuncan P. N. Exon Smith2016-04-171-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Since elements of most kinds of DICompositeType have back references, most are involved in uniquing cycles. Except via the ODR 'identifier:' field, which doesn't care about the storage type (see r266549), they have no hope of being uniqued. Distinct nodes are far more efficient, so use them for most kinds of DICompositeType definitions (i.e., when DIType::isForwardDecl is false). The exceptions: - DW_TAG_array_type, since their elements never have back-references and they never have ODR 'identifier:' fields; - DW_TAG_enumeration_type when there is no ODR 'identifier:' field, since their elements usually don't have back-references. This breaks the last major uniquing cycle I'm aware of in the debug info graph. The impact won't be enormous for C++ because references to ODR-uniqued nodes still use string-based DITypeRefs; but this should prevent a regression in C++ when we drop the string-based references. This wouldn't have been reasonable until r266549, when composite types stopped relying on being uniqued by structural equivalence to prevent blow-ups at LTO time. llvm-svn: 266556
* Revert 266186 as it breaks anything that includes type_traits on some platformsNemanja Ivanovic2016-04-151-6/+0
| | | | | | | | | | Since this patch provided support for the __float128 type but disabled it on all platforms by default, some platforms can't compile type_traits with -std=gnu++11 since there is a specialization with __float128. This reverts the patch until D19125 is approved (i.e. we know which platforms need this support enabled). llvm-svn: 266460
* Update to match LLVM changes for PR27284.Adrian Prantl2016-04-151-5/+5
| | | | | | | | | (Reverse the ownership between DICompileUnit and DISubprogram.) http://reviews.llvm.org/D19034 <rdar://problem/25256815> llvm-svn: 266445
* Enable support for __float128 in ClangNemanja Ivanovic2016-04-131-0/+6
| | | | | | | | | | | | | | | | This patch corresponds to review: http://reviews.llvm.org/D15120 It adds support for the __float128 keyword, literals and a target feature to enable it. This support is disabled by default on all targets and any target that has support for this type is free to add it. Based on feedback that I've received from target maintainers, this appears to be the right thing for most targets. I have not heard from the maintainers of X86 which I believe supports this type. I will subsequently investigate the impact of enabling this on X86. llvm-svn: 266186
* [OpenCL] Move OpenCLImageTypes.def from clangAST to clangBasic library.Alexey Bader2016-04-131-1/+1
| | | | | | | | | | Putting OpenCLImageTypes.def to clangAST library violates layering requirement: "It's not OK for a Basic/ header to include an AST/ header". This fixes the modules build. Differential revision: http://reviews.llvm.org/D18954 Reviewers: Richard Smith, Vassil Vassilev. llvm-svn: 266180
* Add a fixme for an old patch I had lying around that I'm not going to finish ↵David Blaikie2016-04-121-0/+5
| | | | | | any time so n llvm-svn: 266127
* Use NoDebug compile units to mark debug metadata used only for sample-basedAdrian Prantl2016-04-081-5/+16
| | | | | | | | | | profiling and optimization remarks and indicate that no debug info shall be emitted for these compile units. http://reviews.llvm.org/D18808 <rdar://problem/25427165> llvm-svn: 265862
* revert SVN r265702, r265640Saleem Abdulrasool2016-04-081-1/+1
| | | | | | | | | | | Revert the two changes to thread CodeGenOptions into the TargetInfo allocation and to fix the layering violation by moving CodeGenOptions into Basic. Code Generation is arguably not particularly "basic". This addresses Richard's post-commit review comments. This change purely does the mechanical revert and will be followed up with an alternate approach to thread the desired information into TargetInfo. llvm-svn: 265806
* [OpenCL] Complete image types support.Alexey Bader2016-04-081-33/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I. Current implementation of images is not conformant to spec in the following points: 1. It makes no distinction with respect to access qualifiers and therefore allows to use images with different access type interchangeably. The following code would compile just fine: void write_image(write_only image2d_t img); kernel void foo(read_only image2d_t img) { write_image(img); } // Accepted code which is disallowed according to s6.13.14. 2. It discards access qualifier on generated code, which leads to generated code for the above example: call void @write_image(%opencl.image2d_t* %img); In OpenCL2.0 however we can have different calls into write_image with read_only and wite_only images. Also generally following compiler steps have no easy way to take different path depending on the image access: linking to the right implementation of image types, performing IR opts and backend codegen differently. 3. Image types are language keywords and can't be redeclared s6.1.9, which can happen currently as they are just typedef names. 4. Default access qualifier read_only is to be added if not provided explicitly. II. This patch corrects the above points as follows: 1. All images are encapsulated into a separate .def file that is inserted in different points where image handling is required. This avoid a lot of code repetition as all images are handled the same way in the code with no distinction of their exact type. 2. The Cartesian product of image types and image access qualifiers is added to the builtin types. This simplifies a lot handling of access type mismatch as no operations are allowed by default on distinct Builtin types. Also spec intended access qualifier as special type qualifier that are combined with an image type to form a distinct type (see statement above - images can't be created w/o access qualifiers). 3. Improves testing of images in Clang. Author: Anastasia Stulova Reviewers: bader, mgrang. Subscribers: pxli168, pekka.jaaskelainen, yaxunl. Differential Revision: http://reviews.llvm.org/D17821 llvm-svn: 265783
OpenPOWER on IntegriCloud