summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDebugInfo.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Honor -fdebug-prefix-map when creating function names for the debug info.Adrian Prantl2018-12-051-0/+3
| | | | | | | | | | | | | This adds a callback to PrintingPolicy to allow CGDebugInfo to remap file paths according to -fdebug-prefix-map. Otherwise the debug info (particularly function names for C++ lambdas) may contain paths that should have been remapped in the debug info. <rdar://problem/46128056> Differential Revision: https://reviews.llvm.org/D55137 llvm-svn: 348397
* Revert: Honor -fdebug-prefix-map when creating function names for the debug ↵Renato Golin2018-12-051-3/+0
| | | | | | | | | info. This commit reverts r348060 and r348062 due to it breaking the AArch64 Full buildbot: https://bugs.llvm.org/show_bug.cgi?id=39892 llvm-svn: 348364
* Revert "Avoid emitting redundant or unusable directories in DIFile metadata ↵Ilya Biryukov2018-12-041-38/+9
| | | | | | | | | | entries." This reverts commit r348154 and follow-up commits r348211 and r3248213. Reason: the original commit broke compiler-rt tests and a follow-up fix (r348203) broke our integrate and was reverted. llvm-svn: 348280
* Avoid emitting redundant or unusable directories in DIFile metadata entries.Adrian Prantl2018-12-031-9/+38
| | | | | | | | | | | | | | | | | | | | | | | As discussed on llvm-dev recently, Clang currently emits redundant directories in DIFile entries, such as .file 1 "/Volumes/Data/llvm" "/Volumes/Data/llvm/tools/clang/test/CodeGen/debug-info-abspath.c" This patch looks at any common prefix between the compilation directory and the (absolute) file path and strips the redundant part. More importantly it leaves the compilation directory empty if the two paths have no common prefix. After this patch the above entry is (assuming a compilation dir of "/Volumes/Data/llvm/_build"): .file 1 "/Volumes/Data/llvm" "tools/clang/test/CodeGen/debug-info-abspath.c" When building the FileCheck binary with debug info, this patch makes the build artifacts ~1kb smaller. Differential Revision: https://reviews.llvm.org/D55085 llvm-svn: 348154
* Honor -fdebug-prefix-map when creating function names for the debug info.Adrian Prantl2018-12-011-0/+3
| | | | | | | | | | | | | This adds a callback to PrintingPolicy to allow CGDebugInfo to remap file paths according to -fdebug-prefix-map. Otherwise the debug info (particularly function names for C++ lambdas) may contain paths that should have been remapped in the debug info. <rdar://problem/46128056> Differential Revision: https://reviews.llvm.org/D55137 llvm-svn: 348060
* Revert "Revert r347417 "Re-Reinstate 347294 with a fix for the failures.""Fangrui Song2018-11-301-3/+3
| | | | | | | | | It seems the two failing tests can be simply fixed after r348037 Fix 3 cases in Analysis/builtin-functions.cpp Delete the bad CodeGen/builtin-constant-p.c for now llvm-svn: 348053
* Revert r347417 "Re-Reinstate 347294 with a fix for the failures."Fangrui Song2018-11-301-3/+3
| | | | | | | | | | Kept the "indirect_builtin_constant_p" test case in test/SemaCXX/constant-expression-cxx1y.cpp while we are investigating why the following snippet fails: extern char extern_var; struct { int a; } a = {__builtin_constant_p(extern_var)}; llvm-svn: 348039
* Re-commit r347417 "Re-Reinstate 347294 with a fix for the failures."Hans Wennborg2018-11-281-3/+3
| | | | | | | This was reverted in r347656 due to me thinking it caused a miscompile of Chromium. Turns out it was the Chromium code that was broken. llvm-svn: 347756
* Revert r347417 "Re-Reinstate 347294 with a fix for the failures."Hans Wennborg2018-11-271-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This caused a miscompile in Chrome (see crbug.com/908372) that's illustrated by this small reduction: static bool f(int *a, int *b) { return !__builtin_constant_p(b - a) || (!(b - a)); } int arr[] = {1,2,3}; bool g() { return f(arr, arr + 3); } $ clang -O2 -S -emit-llvm a.cc -o - g() should return true, but after r347417 it became false for some reason. This also reverts the follow-up commits. r347417: > Re-Reinstate 347294 with a fix for the failures. > > Don't try to emit a scalar expression for a non-scalar argument to > __builtin_constant_p(). > > Third time's a charm! r347446: > The result of is.constant() is unsigned. r347480: > A __builtin_constant_p() returns 0 with a function type. r347512: > isEvaluatable() implies a constant context. > > Assume that we're in a constant context if we're asking if the expression can > be compiled into a constant initializer. This fixes the issue where a > __builtin_constant_p() in a compound literal was diagnosed as not being > constant, even though it's always possible to convert the builtin into a > constant. r347531: > A "constexpr" is evaluated in a constant context. Make sure this is reflected > if a __builtin_constant_p() is a part of a constexpr. llvm-svn: 347656
* [AArch64] Add aarch64_vector_pcs function attribute to ClangSander de Smalen2018-11-261-0/+1
| | | | | | | | | | | | | | | | | | | | This is the Clang patch to complement the following LLVM patches: https://reviews.llvm.org/D51477 https://reviews.llvm.org/D51479 More information describing the vector ABI and procedure call standard can be found here: https://developer.arm.com/products/software-development-tools/\ hpc/arm-compiler-for-hpc/vector-function-abi Patch by Kerry McLaughlin. Reviewed By: rjmccall Differential Revision: https://reviews.llvm.org/D54425 llvm-svn: 347571
* Re-Reinstate 347294 with a fix for the failures.Bill Wendling2018-11-211-3/+3
| | | | | | | | | Don't try to emit a scalar expression for a non-scalar argument to __builtin_constant_p(). Third time's a charm! llvm-svn: 347417
* Revert r347364 again, the fix was incomplete.Nico Weber2018-11-211-3/+3
| | | | llvm-svn: 347389
* Reinstate 347294 with a fix for the failures.Bill Wendling2018-11-201-3/+3
| | | | | | | EvaluateAsInt() is sometimes called in a constant context. When that's the case, we need to specify it as so. llvm-svn: 347364
* [DebugInfo] DISubprogram flags get their own flags word. NFC.Paul Robinson2018-11-191-18/+30
| | | | | | | | | | | | | This will hold flags specific to subprograms. In the future we could potentially free up scarce bits in DIFlags by moving subprogram-specific flags from there to the new flags word. This patch does not change IR/bitcode formats, that will be done in a follow-up. Differential Revision: https://reviews.llvm.org/D54597 llvm-svn: 347239
* [Clang] - Add '-gsplit-dwarf[=split,=single]' version for '-gsplit-dwarf' ↵George Rimar2018-11-141-2/+5
| | | | | | | | | | | | | | | | | | | | option. The DWARF5 specification says(Appendix F.1): "The sections that do not require relocation, however, can be written to the relocatable object (.o) file but ignored by the linker or they can be written to a separate DWARF object (.dwo) file that need not be accessed by the linker." The first part describes a single file split DWARF feature and there is no way to trigger this behavior atm. Fortunately, no many changes are required to keep *.dwo sections in a .o, the patch does that. Differential revision: https://reviews.llvm.org/D52296 llvm-svn: 346837
* DebugInfo: Add a driver flag for DWARF debug_ranges base address specifier use.David Blaikie2018-11-131-1/+2
| | | | | | | | | | | | | | | Summary: This saves a lot of relocations in optimized object files (at the cost of some cost/increase in linked executable bytes), but gold's 32 bit gdb-index support has a bug ( https://sourceware.org/bugzilla/show_bug.cgi?id=21894 ) so we can't switch to this unconditionally. (& even if it weren't for that bug, one might argue that some users would want to optimize in one direction or the other - prioritizing object size or linked executable size) Differential Revision: https://reviews.llvm.org/D54243 llvm-svn: 346789
* Revert "Revert rL346454: Fix a use-after-free introduced by r344915."Adrian Prantl2018-11-091-1/+1
| | | | | | This un-reverts commit 346454 with a relaxed CHECK for Windows. llvm-svn: 346556
* Revert rL346454: Fix a use-after-free introduced by r344915.Simon Pilgrim2018-11-091-1/+1
| | | | | | | | | | | | | | r344915 added a call to ApplyDebugLocation to the sanitizer check function emitter. Some of the sanitizers are emitted in the function epilogue though and the LexicalScopeStack is emptied out before. By detecting this situation and early-exiting from ApplyDebugLocation the fallback location is used, which is equivalent to the return location. rdar://problem/45859802 ........ Causes EXPENSIVE_CHECKS build bot failures: http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win llvm-svn: 346549
* Fix a use-after-free introduced by r344915.Adrian Prantl2018-11-091-1/+1
| | | | | | | | | | | | r344915 added a call to ApplyDebugLocation to the sanitizer check function emitter. Some of the sanitizers are emitted in the function epilogue though and the LexicalScopeStack is emptied out before. By detecting this situation and early-exiting from ApplyDebugLocation the fallback location is used, which is equivalent to the return location. rdar://problem/45859802 llvm-svn: 346454
* [OpenCL] Add support of cl_intel_device_side_avc_motion_estimation extensionAndrew Savonichev2018-11-081-0/+4
| | | | | | | | | | | | | | | | | | Summary: Documentation can be found at https://www.khronos.org/registry/OpenCL/extensions/intel/cl_intel_device_side_avc_motion_estimation.txt Patch by Kristina Bessonova Reviewers: Anastasia, yaxunl, shafik Reviewed By: Anastasia Subscribers: arphaman, sidorovd, AlexeySotkin, krisb, bader, asavonic, cfe-commits Differential Revision: https://reviews.llvm.org/D51484 llvm-svn: 346392
* Revert r346326 [OpenCL] Add support of ↵Andrew Savonichev2018-11-071-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | cl_intel_device_side_avc_motion_estimation This patch breaks Index/opencl-types.cl LIT test: Script: -- : 'RUN: at line 1'; stage1/bin/c-index-test -test-print-type llvm/tools/clang/test/Index/opencl-types.cl -cl-std=CL2.0 | stage1/bin/FileCheck llvm/tools/clang/test/Index/opencl-types.cl -- Command Output (stderr): -- llvm/tools/clang/test/Index/opencl-types.cl:3:26: warning: unsupported OpenCL extension 'cl_khr_fp16' - ignoring [-Wignored-pragmas] llvm/tools/clang/test/Index/opencl-types.cl:4:26: warning: unsupported OpenCL extension 'cl_khr_fp64' - ignoring [-Wignored-pragmas] llvm/tools/clang/test/Index/opencl-types.cl:8:9: error: use of type 'double' requires cl_khr_fp64 extension to be enabled llvm/tools/clang/test/Index/opencl-types.cl:11:8: error: declaring variable of type 'half' is not allowed llvm/tools/clang/test/Index/opencl-types.cl:15:3: error: use of type 'double' requires cl_khr_fp64 extension to be enabled llvm/tools/clang/test/Index/opencl-types.cl:16:3: error: use of type 'double4' (vector of 4 'double' values) requires cl_khr_fp64 extension to be enabled llvm/tools/clang/test/Index/opencl-types.cl:26:26: warning: unsupported OpenCL extension 'cl_khr_gl_msaa_sharing' - ignoring [-Wignored-pragmas] llvm/tools/clang/test/Index/opencl-types.cl:35:44: error: use of type '__read_only image2d_msaa_t' requires cl_khr_gl_msaa_sharing extension to be enabled llvm/tools/clang/test/Index/opencl-types.cl:36:49: error: use of type '__read_only image2d_array_msaa_t' requires cl_khr_gl_msaa_sharing extension to be enabled llvm/tools/clang/test/Index/opencl-types.cl:37:49: error: use of type '__read_only image2d_msaa_depth_t' requires cl_khr_gl_msaa_sharing extension to be enabled llvm/tools/clang/test/Index/opencl-types.cl:38:54: error: use of type '__read_only image2d_array_msaa_depth_t' requires cl_khr_gl_msaa_sharing extension to be enabled llvm-svn: 346338
* [OpenCL] Add support of cl_intel_device_side_avc_motion_estimation extensionAndrew Savonichev2018-11-071-0/+4
| | | | | | | | | | | | | | | | | | Summary: Documentation can be found at https://www.khronos.org/registry/OpenCL/extensions/intel/cl_intel_device_side_avc_motion_estimation.txt Patch by Kristina Bessonova Reviewers: Anastasia, yaxunl, shafik Reviewed By: Anastasia Subscribers: arphaman, sidorovd, AlexeySotkin, krisb, bader, asavonic, cfe-commits Differential Revision: https://reviews.llvm.org/D51484 llvm-svn: 346326
* NFC: Remove the ObjC1/ObjC2 distinction from clang (and related projects)Erik Pilkington2018-10-301-3/+3
| | | | | | | | | | We haven't supported compiling ObjC1 for a long time (and never will again), so there isn't any reason to keep these separate. This patch replaces LangOpts::ObjC1 and LangOpts::ObjC2 with LangOpts::ObjC. Differential revision: https://reviews.llvm.org/D53547 llvm-svn: 345637
* Debug Info (-gmodules): emit full types for non-anchored template ↵Adrian Prantl2018-10-241-0/+9
| | | | | | | | | | | | | | | | | specializations Before this patch, clang would emit a (module-)forward declaration for template instantiations that are not anchored by an explicit template instantiation, but still are guaranteed to be available in an imported module. Unfortunately detecting the owning module doesn't reliably work when local submodule visibility is enabled and the template is inside a cross-module namespace. This make clang debuggable again with -gmodules and LSV enabled. rdar://problem/41552377 llvm-svn: 345109
* Revert r345009 "[DebugInfo] Generate debug information for labels. (After ↵Hans Wennborg2018-10-231-26/+0
| | | | | | | | | | | | | | | | | | | | | fix PR39094)" This broke the Chromium build. See https://bugs.chromium.org/p/chromium/issues/detail?id=898152#c1 for the reproducer. > Generate DILabel metadata and call llvm.dbg.label after label > statement to associate the metadata with the label. > > After fixing PR37395. > After fixing problems in LiveDebugVariables. > After fixing NULL symbol problems in AddressPool when enabling > split-dwarf-file. > After fixing PR39094. > > Differential Revision: https://reviews.llvm.org/D45045 llvm-svn: 345026
* [DebugInfo] Generate debug information for labels. (After fix PR39094)Hsiangkai Wang2018-10-231-0/+26
| | | | | | | | | | | | | | | Generate DILabel metadata and call llvm.dbg.label after label statement to associate the metadata with the label. After fixing PR37395. After fixing problems in LiveDebugVariables. After fixing NULL symbol problems in AddressPool when enabling split-dwarf-file. After fixing PR39094. Differential Revision: https://reviews.llvm.org/D45045 llvm-svn: 345009
* [DebugInfo] Add support for DWARF5 call site-related attributesVedant Kumar2018-10-051-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DWARF v5 introduces DW_AT_call_all_calls, a subprogram attribute which indicates that all calls (both regular and tail) within the subprogram have call site entries. The information within these call site entries can be used by a debugger to populate backtraces with synthetic tail call frames. Tail calling frames go missing in backtraces because the frame of the caller is reused by the callee. Call site entries allow a debugger to reconstruct a sequence of (tail) calls which led from one function to another. This improves backtrace quality. There are limitations: tail recursion isn't handled, variables within synthetic frames may not survive to be inspected, etc. This approach is not novel, see: https://gcc.gnu.org/wiki/summit2010?action=AttachFile&do=get&target=jelinek.pdf This patch adds an IR-level flag (DIFlagAllCallsDescribed) which lowers to DW_AT_call_all_calls. It adds the minimal amount of DWARF generation support needed to emit standards-compliant call site entries. For easier deployment, when the debugger tuning is LLDB, the DWARF requirement is adjusted to v4. Testing: Apart from check-{llvm, clang}, I built a stage2 RelWithDebInfo clang binary. Its dSYM passed verification and grew by 1.4% compared to the baseline. 151,879 call site entries were added. rdar://42001377 Differential Revision: https://reviews.llvm.org/D49887 llvm-svn: 343883
* Add template type and value parameter metadata nodes to template variable ↵Matthew Voss2018-10-031-5/+51
| | | | | | | | | | | | | | | | | | specializations Summary: Add an optional attribute referring to a tuple of type and value template parameter nodes to the DIGlobalVariable node. This allows us to record the parameters of template variable specializations. Reviewers: dblaikie, aprantl, probinson, JDevlieghere, clayborg, jingham Reviewed By: JDevlieghere Subscribers: cfe-commits Tags: #debug-info Differential Revision: https://reviews.llvm.org/D52058 llvm-svn: 343707
* Revert "[DebugInfo] Generate debug information for labels."Vitaly Buka2018-09-271-26/+0
| | | | | | | | This reverts commit r343148. It crashes on sanitizer-x86_64-linux-autoconf. llvm-svn: 343183
* [DebugInfo] Generate debug information for labels.Hsiangkai Wang2018-09-261-0/+26
| | | | | | | | | | | | | | Generate DILabel metadata and call llvm.dbg.label after label statement to associate the metadata with the label. After fixing PR37395. After fixing problems in LiveDebugVariables. After fixing NULL symbol problems in AddressPool when enabling split-dwarf-file. Differential Revision: https://reviews.llvm.org/D45045 llvm-svn: 343148
* [CodeGen] Revert commit https://reviews.llvm.org/rL342717Calixte Denizet2018-09-241-15/+11
| | | | llvm-svn: 342912
* [CodeGen] Add to emitted DebugLoc information about coverage when it's requiredCalixte Denizet2018-09-211-11/+15
| | | | | | | | | | | | | | | | | | | | Summary: Some lines have a hit counter where they should not have one. Cleanup stuff is located to the last line of the body which is most of the time a '}'. And Exception stuff is added at the beginning of a function and at the end (represented by '{' and '}'). So in such cases, the DebugLoc used in GCOVProfiling.cpp must be marked as not covered. This patch is a followup of https://reviews.llvm.org/D49915. Tests in projects/compiler_rt are fixed by: https://reviews.llvm.org/D49917 Reviewers: marco-c, davidxl Reviewed By: marco-c Subscribers: dblaikie, cfe-commits, sylvestre.ledru Differential Revision: https://reviews.llvm.org/D49916 llvm-svn: 342717
* Remove all uses of DIFlagBlockByrefStructAdrian Prantl2018-09-101-17/+15
| | | | | | | | | | | | This patch removes the last reason why DIFlagBlockByrefStruct from Clang by directly implementing the drilling into the member type done in DwarfDebug::DbgVariable::getType() into the frontend. rdar://problem/31629055 Differential Revision: https://reviews.llvm.org/D51807 llvm-svn: 341842
* Revert "[DebugInfo] Generate debug information for labels. (Fix PR37395)"Sam McCall2018-09-061-26/+0
| | | | | | | | | This reverts commit r341519, which generates debug info that causes backend crashes. (with -split-dwarf-file) Details in https://reviews.llvm.org/D50495 llvm-svn: 341549
* [DebugInfo] Generate debug information for labels. (Fix PR37395)Hsiangkai Wang2018-09-061-0/+26
| | | | | | | | | | | | Generate DILabel metadata and call llvm.dbg.label after label statement to associate the metadata with the label. After fixing PR37395. After fixing problems in LiveDebugVariables. Differential Revision: https://reviews.llvm.org/D45045 llvm-svn: 341519
* [DEBUGINFO] Add support for emission of the debug directives only.Alexey Bataev2018-08-311-0/+3
| | | | | | | | | | | | | | | | Summary: Added option -gline-directives-only to support emission of the debug directives only. It behaves very similar to -gline-tables-only, except that it sets llvm debug info emission kind to llvm::DICompileUnit::DebugDirectivesOnly. Reviewers: echristo Subscribers: aprantl, fedor.sergeev, JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D51177 llvm-svn: 341212
* DebugInfo: Add the ability to disable DWARF name tables entirelyDavid Blaikie2018-08-201-3/+2
| | | | | | | | | | | | | | | | | | This changes the current default behavior (from emitting pubnames by default, to not emitting them by default) & moves to matching GCC's behavior* with one significant difference: -gno(-gnu)-pubnames disables pubnames even in the presence of -gsplit-dwarf (though -gsplit-dwarf still by default enables -ggnu-pubnames). This allows users to disable pubnames (& the new DWARF5 accelerated access tables) when they might not be worth the size overhead. * GCC's behavior is that -ggnu-pubnames and -gpubnames override each other, and that -gno-gnu-pubnames and -gno-pubnames act as synonyms and disable either kind of pubnames if they come last. (eg: -gpubnames -gno-gnu-pubnames causes no pubnames (neither gnu or standard) to be emitted) llvm-svn: 340206
* Update comments in CGDebugInfo to reflect changes in the MS mangler, NFCReid Kleckner2018-08-171-12/+26
| | | | | | | I've tried to elaborate on the purpose of these type identifiers and why and when clang uses them. llvm-svn: 340080
* Disable pubnames in NVPTX debug info using metadataDavid Blaikie2018-08-161-2/+5
| | | | llvm-svn: 339968
* Update for LLVM API changeDavid Blaikie2018-08-161-1/+2
| | | | llvm-svn: 339941
* [DebugInfo][OpenCL] Address post-commit review for r338299Scott Linder2018-08-081-55/+81
| | | | | | | | NFC refactor of code to generate debug info for OpenCL 2.X blocks. Differential Revision: https://reviews.llvm.org/D50099 llvm-svn: 339265
* Revert "[DebugInfo] Generate debug information for labels. (Fix PR37395)"Hsiangkai Wang2018-08-061-26/+0
| | | | | | | | | | | Build failed in http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/27258 In lib/CodeGen/LiveDebugVariables.cpp:589, it uses std::prev(MBBI) to get DebugValue's SlotIndex. however, the previous instruction may be also a debug instruction. llvm-svn: 338992
* [DebugInfo] Generate debug information for labels. (Fix PR37395)Hsiangkai Wang2018-08-061-0/+26
| | | | | | | | | | | Generate DILabel metadata and call llvm.dbg.label after label statement to associate the metadata with the label. After fixing PR37395. Differential Revision: https://reviews.llvm.org/D45045 llvm-svn: 338989
* Revert "Add a definition for FieldSize that seems to make sense here."Eric Christopher2018-07-301-1/+0
| | | | | | This reverts commit r338327, the problem was previously fixed in r338321. llvm-svn: 338328
* Add a definition for FieldSize that seems to make sense here.Eric Christopher2018-07-301-0/+1
| | | | | | This could be sunk out of the if statements, but fix the warning for now. llvm-svn: 338327
* Fix use of uninitialized variable in r338299Scott Linder2018-07-301-1/+1
| | | | llvm-svn: 338321
* [DebugInfo][OpenCL] Generate correct block literal debug info for OpenCLScott Linder2018-07-301-34/+48
| | | | | | | | | OpenCL block literal structs have different fields which are now correctly identified in the debug info. Differential Revision: https://reviews.llvm.org/D49930 llvm-svn: 338299
* Revert "[DebugInfo] Generate debug information for labels. (Fix PR37395)"Shiva Chen2018-07-241-26/+0
| | | | | | This reverts commit 4288dd3bf082482e02c8a044c611c18168cb0180. llvm-svn: 337803
* [DebugInfo] Generate debug information for labels. (Fix PR37395)Shiva Chen2018-07-241-0/+26
| | | | | | | | | | | | | Generate DILabel metadata and call llvm.dbg.label after label statement to associate the metadata with the label. After fixing PR37395. Differential Revision: https://reviews.llvm.org/D45045 Patch by Hsiangkai Wang. llvm-svn: 337800
* [CodeGen] Record if a C++ record is a trivial typeAaron Smith2018-07-231-0/+4
| | | | | | | | | | | | | | Summary: This has a dependence on D45122 Reviewers: rnk, zturner, llvm-commits, aleksandr.urakov Reviewed By: rnk Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D45124 llvm-svn: 337736
OpenPOWER on IntegriCloud