summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDebugInfo.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Modules: Use hash of PCM content for SIGNATUREDuncan P. N. Exon Smith2017-03-131-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Change ASTFileSignature from a random 32-bit number to the hash of the PCM content. - Move definition ASTFileSignature to Basic/Module.h so Module and ASTSourceDescriptor can use it. - Change the signature from uint64_t to std::array<uint32_t,5>. - Stop using (saving/reading) the size and modification time of PCM files when there is a valid SIGNATURE. - Add UNHASHED_CONTROL_BLOCK, and use it to store the SIGNATURE record and other records that shouldn't affect the hash. Because implicit modules reuses the same file for multiple levels of -Werror, this includes DIAGNOSTIC_OPTIONS and DIAG_PRAGMA_MAPPINGS. This helps to solve a PCH + implicit Modules dependency issue: PCH files are handled by the external build system, whereas implicit modules are handled by internal compiler build system. This prevents invalidating a PCH when the compiler overwrites a PCM file with the same content (modulo the diagnostic differences). Design and original patch by Manman Ren! llvm-svn: 297655
* [DebugInfo] Append extended dereferencing mechanism to variables' ↵Konstantin Zhuravlyov2017-03-091-2/+26
| | | | | | | | DIExpression for targets that support more than one address space Differential Revision: https://reviews.llvm.org/D29673 llvm-svn: 297397
* [DebugInfo] Add address space when creating DIDerivedTypesKonstantin Zhuravlyov2017-03-081-6/+17
| | | | | | Differential Revision: https://reviews.llvm.org/D29671 llvm-svn: 297321
* [AST/ObjC] Make ObjCCategoryImplDecl consistent with ObjCCategoryDecl and ↵Argyrios Kyrtzidis2017-03-071-2/+2
| | | | | | | | use the category name as its DeclName This also addresses the badness in ObjCCategoryImplDecl's API, which was hiding NamedDecl's APIs with different meaning. llvm-svn: 297131
* PR32042: Create inlined debug info for EmitInlinedInheritingCXXConstructorCall.Adrian Prantl2017-02-271-23/+95
| | | | | | | | | | | | | | | | | | When clang emits an inheriting C++ constructor it may inline code during the CodeGen phase. This patch ensures that any debug info in this inlined code gets a proper inlined location. Otherwise we can end up with invalid debug info metadata, since all inlined local variables and function arguments would be reparented into the call site. Analogous to ApplyInlineLocation this patch introduces a ApplyInlineDebugLocation scoped helper to facilitate entering an inlined scope and cleaning up afterwards. This fixes one of the issues discovered in PR32042. rdar://problem/30679307 llvm-svn: 296388
* Fix assertion failure when generating debug information for a variableRichard Smith2017-02-221-2/+3
| | | | | | | | | | declaration declared using class template argument deduction. Patch by Eric Fiselier (who is busy and asked me to commit this on his behalf)! Differential Revision: https://reviews.llvm.org/D30082 llvm-svn: 295794
* [OpenCL] Correct ndrange_t implementationAnastasia Stulova2017-02-161-2/+0
| | | | | | | | | | | | | | | Removed ndrange_t as Clang builtin type and added as a struct type in the OpenCL header. Use type name to do the Sema checking in enqueue_kernel and modify IR generation accordingly. Review: D28058 Patch by Dmitry Borisenkov! llvm-svn: 295311
* [DebugInfo] Added support to Clang FE for generating debug info for ↵Amjad Aboud2017-02-091-0/+15
| | | | | | | | | | | preprocessor macros. Added "-fdebug-macro" flag (and "-fno-debug-macro" flag) to enable (and to disable) emitting macro debug info. Added CC1 "-debug-info-macro" flag that enables emitting macro debug info. Differential Revision: https://reviews.llvm.org/D16135 llvm-svn: 294637
* Change debug-info-for-profiling from a TargetOption to a function attribute.Dehao Chen2017-02-011-1/+2
| | | | | | | | | | | | | | Summary: cfe change for https://reviews.llvm.org/D29203 Reviewers: echristo, dblaikie Reviewed By: dblaikie Subscribers: mehdi_amini, cfe-commits Differential Revision: https://reviews.llvm.org/D29205 llvm-svn: 293834
* Reapply "DebugInfo: Omit class definitions even in the presence of ↵David Blaikie2017-01-301-10/+20
| | | | | | | | | | | available_externally vtables" Accounts for a case that caused an assertion failure by attempting to query for the vtable linkage of a non-dynamic type.t This reverts commit r292801. llvm-svn: 293462
* PR0091R3: Implement parsing support for using templates as types.Richard Smith2017-01-261-0/+1
| | | | | | | | | | | | | | | This change adds a new type node, DeducedTemplateSpecializationType, to represent a type template name that has been used as a type. This is modeled around AutoType, and shares a common base class for representing a deduced placeholder type. We allow deduced class template types in a few more places than the standard does: in conditions and for-range-declarators, and in new-type-ids. This is consistent with GCC and with discussion on the core reflector. This patch does not yet support deduced class template types being named in typename specifiers. llvm-svn: 293207
* Revert "DebugInfo: Omit class definitions even in the presence of ↵David Blaikie2017-01-231-19/+10
| | | | | | | | | | | | | available_externally vtables" Patch crashing on a bootstrapping sanitizer bot: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/679 Reverting while I investigate. This reverts commit r292768. llvm-svn: 292801
* DebugInfo: Omit class definitions even in the presence of ↵David Blaikie2017-01-231-10/+19
| | | | | | | | | | | | | available_externally vtables To ensure optimization level doesn't pessimize the -fstandalone-debug vtable debug info optimization (where class definitions are only emitted where the vtable is emitted - reducing redundant debug info) ensure the debug info class definition is still omitted when an available_externally vtable definition is emitted for optimization purposes. llvm-svn: 292768
* Add -fdebug-info-for-profiling to emit more debug info for sample pgo ↵Dehao Chen2017-01-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | profile collection Summary: SamplePGO uses profile with debug info to collect profile. Unlike the traditional debugging purpose, sample pgo needs more accurate debug info to represent the profile. We add -femit-accurate-debug-info for this purpose. It can be combined with all debugging modes (-g, -gmlt, etc). It makes sure that the following pieces of info is always emitted: * start line of all subprograms * linkage name of all subprograms * standalone subprograms (functions that has neither inlined nor been inlined) The impact on speccpu2006 binary size (size increase comparing with -g0 binary, also includes data for -g binary, which does not change with this patch): -gmlt(orig) -gmlt(patched) -g 433.milc 4.68% 5.40% 19.73% 444.namd 8.45% 8.93% 45.99% 447.dealII 97.43% 115.21% 374.89% 450.soplex 27.75% 31.88% 126.04% 453.povray 21.81% 26.16% 92.03% 470.lbm 0.60% 0.67% 1.96% 482.sphinx3 5.77% 6.47% 26.17% 400.perlbench 17.81% 19.43% 73.08% 401.bzip2 3.73% 3.92% 12.18% 403.gcc 31.75% 34.48% 122.75% 429.mcf 0.78% 0.88% 3.89% 445.gobmk 6.08% 7.92% 42.27% 456.hmmer 10.36% 11.25% 35.23% 458.sjeng 5.08% 5.42% 14.36% 462.libquantum 1.71% 1.96% 6.36% 464.h264ref 15.61% 16.56% 43.92% 471.omnetpp 11.93% 15.84% 60.09% 473.astar 3.11% 3.69% 14.18% 483.xalancbmk 56.29% 81.63% 353.22% geomean 15.60% 18.30% 57.81% Debug info size change for -gmlt binary with this patch: 433.milc 13.46% 444.namd 5.35% 447.dealII 18.21% 450.soplex 14.68% 453.povray 19.65% 470.lbm 6.03% 482.sphinx3 11.21% 400.perlbench 8.91% 401.bzip2 4.41% 403.gcc 8.56% 429.mcf 8.24% 445.gobmk 29.47% 456.hmmer 8.19% 458.sjeng 6.05% 462.libquantum 11.23% 464.h264ref 5.93% 471.omnetpp 31.89% 473.astar 16.20% 483.xalancbmk 44.62% geomean 16.83% Reviewers: davidxl, andreadb, rob.lougher, dblaikie, echristo Reviewed By: dblaikie, echristo Subscribers: hfinkel, rob.lougher, andreadb, gbedwell, cfe-commits, probinson, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D25435 llvm-svn: 292458
* DebugInfo: Don't include size/alignment on class declarationsDavid Blaikie2016-12-271-6/+0
| | | | | | | | | | This seems like it must've been a leftover by accident - no tests were backing it up & it doesn't make much sense to include size/alignment on class declarations (it'd only be on those declarations for which the definition was available - otherwise the size/alignment would not be known). llvm-svn: 290631
* [DebugInfo] Added support for Checksum debug info feature.Amjad Aboud2016-12-251-5/+44
| | | | | | Differential Revision: https://reviews.llvm.org/D27641 llvm-svn: 290515
* Update for LLVM global variable debug info API change.Adrian Prantl2016-12-201-17/+25
| | | | | | This reapplies r289921. llvm-svn: 290155
* IRGen: Fix assertion failure when creating debug info for an integer ↵Peter Collingbourne2016-12-161-6/+9
| | | | | | constant wider than 64 bits. llvm-svn: 289996
* Revert "Update for LLVM global variable debug info API change."Adrian Prantl2016-12-161-25/+17
| | | | | | This reverts commit r289921. llvm-svn: 289984
* Update for LLVM global variable debug info API change.Adrian Prantl2016-12-161-17/+25
| | | | llvm-svn: 289921
* Revert "Update for LLVM global variable debug info API change."Adrian Prantl2016-12-161-25/+17
| | | | | | This reverts commit 289901 while investigating bot breakage. llvm-svn: 289908
* Update for LLVM global variable debug info API change.Adrian Prantl2016-12-161-17/+25
| | | | llvm-svn: 289901
* [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
OpenPOWER on IntegriCloud