Commit Graph

344 Commits

Author SHA1 Message Date
Amjad Aboud e2aab8c30c [DebugInfo] Added support for Checksum debug info feature.
Differential Revision: https://reviews.llvm.org/D27641

llvm-svn: 290515
2016-12-25 10:12:27 +00:00
Adrian Prantl 5f4740d3e5 Update for LLVM global variable debug info API change.
This reapplies r289921.

llvm-svn: 290155
2016-12-20 02:10:02 +00:00
Adrian Prantl e34d9bc8af Revert "Update for LLVM global variable debug info API change."
This reverts commit r289921.

llvm-svn: 289984
2016-12-16 19:39:18 +00:00
Adrian Prantl db4c86f953 Update for LLVM global variable debug info API change.
llvm-svn: 289921
2016-12-16 04:26:15 +00:00
Adrian Prantl ed4eb86531 Revert "Update for LLVM global variable debug info API change."
This reverts commit 289901 while investigating bot breakage.

llvm-svn: 289908
2016-12-16 01:01:40 +00:00
Adrian Prantl 35bbcefb4b Update for LLVM global variable debug info API change.
llvm-svn: 289901
2016-12-16 00:35:42 +00:00
Amara Emerson 652795db16 Add the loop end location to the loop metadata. This additional information
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
2016-11-10 14:44:30 +00:00
Bob Haarman dff36738d1 [codeview] emit debug info for indirect virtual base classes
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
2016-10-25 22:19:32 +00:00
Victor Leschuk a7ece03b32 DebugInfo: pass alignment value only if it was forced
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
2016-10-20 00:13:19 +00:00
Victor Leschuk b3e7d68d5c Cosmetic fix: deleted unnecessary line break in comment.
llvm-svn: 282846
2016-09-30 06:39:48 +00:00
Manman Ren e6be26c8d4 ObjectiveC generics: Add ObjCTypeParamType in the type system.
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
2016-09-13 17:25:08 +00:00
Peter Collingbourne eeb56abe64 Update Clang for D20147 ("DebugInfo: New metadata representation for global variables.")
Differential Revision: http://reviews.llvm.org/D20415

llvm-svn: 281285
2016-09-13 01:13:19 +00:00
Leny Kholodov 80c047d2c4 DebugInfo: use llvm::DINode::DIFlags type for debug info flags
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
2016-09-06 10:48:04 +00:00
Reid Kleckner dc124996d2 [codeview] Pass through vftable shape information
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
2016-08-31 16:11:43 +00:00
Yaxun Liu 0bc4b2d337 [OpenCL] Generate opaque type for sampler_t and function call for the 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 (3d4eec6162).

Differential Revision: https://reviews.llvm.org/D21567

llvm-svn: 277024
2016-07-28 19:26:30 +00:00
Adrian McCarthy ab1e786503 Reroll "Include unreferenced nested types in member list only for CodeView"
Another attempt at r276271, hopefully without breaking ModuleDebugInfo test.

llvm-svn: 276317
2016-07-21 18:43:20 +00:00
Adrian McCarthy a9a89ae77f Revert "Include unreferenced nested types in member list only for CodeView"
Patch broke ModuleDebugInfo test on the build bots (but not locally).  Again.

svn revision:  r276271

This reverts commit 9da8a1b05362bc96f2855fb32b5588b89407685d.

llvm-svn: 276279
2016-07-21 13:41:25 +00:00
Adrian McCarthy e89c62a102 Include unreferenced nested types in member list only for CodeView
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
2016-07-21 13:16:14 +00:00
Adrian McCarthy 20128d94e5 Revert "Retry "Include debug info for nested structs and classes""
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
2016-07-06 23:28:34 +00:00
Adrian McCarthy 0a8cb648c9 Retry "Include debug info for nested structs and classes"
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
2016-07-06 22:39:15 +00:00
Adrian McCarthy 743f7f1aff Revert "Include debug info for nested structs and classes"
This reverts commit 0af5ee9631c7c167dc40498b415876553e314c95.

llvm-svn: 274633
2016-07-06 15:15:38 +00:00
Adrian McCarthy 73d726a6cc Include debug info for nested structs and classes
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
2016-07-06 14:46:42 +00:00
David Majnemer b4b671e4a8 [CodeView] Implement support for bitfields in Clang
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
2016-06-30 03:01:59 +00:00
Amjad Aboud dc4531e552 Reverting 268055 as it caused PR27579.
llvm-svn: 268151
2016-04-30 01:44:38 +00:00
Amjad Aboud 0ccbfa3b44 Recommitted r264281 "Supporting all entities declared in lexical scope in LLVM debug info."
After fixing PR26942 in r267004.

llvm-svn: 268055
2016-04-29 16:08:08 +00:00
Alexey Bader b62f14400f [OpenCL] Move OpenCLImageTypes.def from clangAST to clangBasic library.
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
2016-04-13 08:33:41 +00:00
Saleem Abdulrasool 10a4972a8d revert SVN r265702, r265640
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
2016-04-08 16:52:00 +00:00
Alexey Bader 954ba21f85 [OpenCL] Complete image types support.
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
2016-04-08 13:40:33 +00:00
Saleem Abdulrasool 94cfc603d1 Basic: move CodeGenOptions from Frontend
This is a mechanical move of CodeGenOptions from libFrontend to libBasic.  This
fixes the layering violation introduced earlier by threading CodeGenOptions into
TargetInfo.  It should also fix the modules based self-hosting builds.  NFC.

llvm-svn: 265702
2016-04-07 17:49:44 +00:00
Reid Kleckner 00381aa142 Revert "Recommitted r263425 "Supporting all entities declared in lexical scope in LLVM debug info." After fixing PR26942 (the fix is included in this commit)."
This reverts commit r264281.

This change breaks building Chromium for iOS. We'll upload a reproducer
to the PR soon.

llvm-svn: 264333
2016-03-24 20:38:43 +00:00
Amjad Aboud abb04956b6 Recommitted r263425 "Supporting all entities declared in lexical scope in LLVM debug info."
After fixing PR26942 (the fix is included in this commit).

Differential Revision: http://reviews.llvm.org/D18350

llvm-svn: 264281
2016-03-24 13:30:41 +00:00
Benjamin Kramer 35bc38af20 Revert "Recommitted r261634 "Supporting all entities declared in lexical scope in LLVM debug info." After fixing PR26715 at r263379."
This reverts commit r263425. Breaks self-host.

llvm-svn: 263436
2016-03-14 14:58:28 +00:00
Amjad Aboud 22c997deb6 Recommitted r261634 "Supporting all entities declared in lexical scope in LLVM debug info."
After fixing PR26715 at r263379.

llvm-svn: 263425
2016-03-14 12:03:55 +00:00
Hans Wennborg 8a118b63d8 Revert r261634 "Supporting all entities declared in lexical scope in LLVM debug info." and r261657
r261634 and r261633 seems to have caused PR26715. r261657 depends on the former two.

llvm-svn: 261670
2016-02-23 19:10:16 +00:00
Amjad Aboud 30e7a8f694 Supporting all entities declared in lexical scope in LLVM debug info.
Differential Revision: http://reviews.llvm.org/D15977

llvm-svn: 261634
2016-02-23 13:37:18 +00:00
Craig Topper c8ad41ed35 Fix typo in comment. NFC
llvm-svn: 260020
2016-02-07 06:39:23 +00:00
Benjamin Kramer 8c30592e18 Move DebugInfoKind into its own header to cut the cyclic dependency edge from Driver to Frontend.
llvm-svn: 259489
2016-02-02 11:06:51 +00:00
Adrian Prantl aa5d08d04b Module debugging: Create a parent DIModule with the PCH name for types
emitted into a precompiled header to mirror the debug info emitted for
object files importing the PCH.

rdar://problem/24290667

llvm-svn: 258555
2016-01-22 21:14:41 +00:00
Xiuli Pan 9c14e28211 [OpenCL] Pipe type support
Summary:
Support for OpenCL 2.0 pipe type.
This is a bug-fix version for bader's patch reviews.llvm.org/D14441


Reviewers: pekka.jaaskelainen, Anastasia

Subscribers: bader, Anastasia, cfe-commits

Differential Revision: http://reviews.llvm.org/D15603

llvm-svn: 257254
2016-01-09 12:53:17 +00:00
Eric Christopher be5286629f Fix funciton->function typo.
llvm-svn: 255840
2015-12-16 23:10:46 +00:00
Benjamin Kramer 2811b04874 Put back doxygen comment accidentally dropped in r250418.
llvm-svn: 250428
2015-10-15 16:46:25 +00:00
Benjamin Kramer c2d2b4259c [CodeGen] Remove dead code. NFC.
llvm-svn: 250418
2015-10-15 15:29:40 +00:00
Saleem Abdulrasool 436256a713 Support Debug Info path remapping
Add support for the `-fdebug-prefix-map=` option as in GCC.  The syntax is
`-fdebug-prefix-map=OLD=NEW`.  When compiling files from a path beginning with
OLD, change the debug info to indicate the path as start with NEW.  This is
particularly helpful if you are preprocessing in one path and compiling in
another (e.g. for a build cluster with distcc).

Note that the linearity of the implementation is not as terrible as it may seem.
This is normally done once per file with an expectation that the map will be
small (1-2) entries, making this roughly linear in the number of input paths.

Addresses PR24619.

llvm-svn: 250094
2015-10-12 20:21:08 +00:00
Hans Wennborg 59dbe86325 Fix Clang-tidy modernize-use-nullptr warnings in headers and generated files; other minor cleanups.
By Eugene Zelenko!

Differential Revision: http://reviews.llvm.org/D13187

llvm-svn: 248828
2015-09-29 20:56:43 +00:00
Adrian Prantl eb66a263c2 Debug Info: Use the module pointer as key for the module cache.
This way we don't need to rebuild the full module name for every decl.

llvm-svn: 248510
2015-09-24 16:10:04 +00:00
Adrian Prantl a5206ce72a Module Debugging: Use the clang module signature as the module's dwo_id
when building a module. Clang already records the module signature when
building a skeleton CU to reference a clang module.

Matching the id in the skeleton with the one in the module allows a DWARF
consumer to verify that they found the correct version of the module
without them needing to know about the clang module format.

llvm-svn: 248345
2015-09-22 23:26:43 +00:00
Adrian Prantl 9402cef0ae Module debugging: Support submodules in the PCM/PCH debug info.
llvm-svn: 248127
2015-09-20 16:51:35 +00:00
Adrian Prantl 666892051c CGDebugInfo: Make creating a skeleton CU in getOrCreateModuleRef optional.
We don't want a skeleton CU when generating debug info for the module
itself.

NFC.

llvm-svn: 248062
2015-09-18 23:01:45 +00:00
Adrian Prantl 201e10d007 Debug Info: Use the full module name as a key when caching DIModules.
The signature may not have been computed at the time the module reference
is generated (e.g.: in the future while emitting debug info for a clang
module). Using the full module name is safe because each clang module may
only have a single definition.

NFC.

llvm-svn: 248037
2015-09-18 21:06:14 +00:00
Alexey Bader 9c8453fb4b [OpenCL] Add new types for OpenCL 2.0.
Patch by Pedro Ferreira.
Reviewers: pekka.jaaskelainen
Differential Revision: http://reviews.llvm.org/D12855

llvm-svn: 247676
2015-09-15 11:18:52 +00:00