Commit Graph

1032 Commits

Author SHA1 Message Date
Peter Collingbourne c6358e5569 CodeGen: Update for debug info API change.
Differential Revision: http://reviews.llvm.org/D14266

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252220 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-05 22:04:14 +00:00
Douglas Gregor 249d7a566d Stop back-patching 'readonly' Objective-C properties with 'readwrite' ones.
A 'readonly' Objective-C property declared in the primary class can
effectively be shadowed by a 'readwrite' property declared within an
extension of that class, so long as the types and attributes of the
two property declarations are compatible.

Previously, this functionality was implemented by back-patching the
original 'readonly' property to make it 'readwrite', destroying source
information and causing some hideously redundant, incorrect
code. Simplify the implementation to express how this should actually
be modeled: as a separate property declaration in the extension that
shadows (via the name lookup rules) the declaration in the primary
class. While here, correct some broken Fix-Its, eliminate a pile of
redundant code, clean up the ARC migrator's handling of properties
declared in extensions, and fix debug info's naming of methods that
come from categories.

A wonderous side effect of doing this write is that it eliminates the
"AddedObjCPropertyInClassExtension" method from the AST mutation
listener, which in turn eliminates the last place where we rewrite
entire declarations in a chained PCH file or a module file. This
change (which fixes rdar://problem/18475765) will allow us to
eliminate the rewritten-decls logic from the serialization library,
and fixes a crash (rdar://problem/23247794) illustrated by the
test/PCH/chain-categories.m example.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251874 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-03 01:15:46 +00:00
Benjamin Kramer aa1247dbae [CodeGen] Remove dead code. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250418 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-15 15:29:40 +00:00
Eric Christopher f3dafc4617 Update clang for DIBuilder::createSubroutineType API change.
Patch by Amaury Sechet!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250373 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-15 06:56:08 +00:00
Saleem Abdulrasool cc4221bf16 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250094 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-12 20:21:08 +00:00
Adrian Prantl 191d76ccf9 Module Debugging: Emit (ObjC) function declarations in the module scope
when building a module.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249282 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-04 23:23:04 +00:00
Adrian Prantl b79caa0e7b Module debugging: Don't emit forward declarations in module scopes.
A forward declaration inside a module header does not belong to the module.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249157 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-02 17:36:14 +00:00
Adrian Prantl b3c237670d Remove unused variable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249155 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-02 17:36:03 +00:00
Adrian Prantl 4ff9270301 Module debugging: Also emit Objective-C interfaces forward declarations
in their module scope when building a clang module.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249031 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-01 16:57:02 +00:00
Adrian Prantl b23407aab1 Module debugging: Emit Objective-C interfaces in their module scope when
building a clang module.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248974 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-01 00:48:51 +00:00
Adrian Prantl 81c359b957 CGDebugInfo: Don't reuse a reference into a DenseMap if the DenseMap may
be modified in between. (NFC)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248826 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-29 20:44:46 +00:00
Adrian Prantl 50edddde19 Module Debugging: Emit submodules as nested DW_TAG_modules.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248511 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-24 16:10:10 +00:00
Adrian Prantl 3ea7b1c1a4 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248510 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-24 16:10:04 +00:00
Adrian Prantl 5be843617b Refactor ASTSourceDescriptor to not store copies of all strings. (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248509 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-24 16:10:00 +00:00
Adrian Prantl 73315f72a2 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248345 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-22 23:26:43 +00:00
Adrian Prantl 9345c88c02 Debug Info: When building a module, emit skeleton CUs for imported modules.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248184 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-21 17:48:37 +00:00
Adrian Prantl a83de9f778 Module debugging: Support submodules in the PCM/PCH debug info.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248127 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-20 16:51:35 +00:00
Adrian Prantl 9e767ddcc6 Further simplify CGDebugInfo::getOrCreateModuleRef().
DIBuilder ignoers DICompileUnits that are passed in as scopes anyway.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248077 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-19 00:59:22 +00:00
Adrian Prantl 883c10b4e1 Rename ASTSourceDescriptor::ModuleName to FullModuleName for clarity.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248070 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-19 00:10:37 +00:00
Adrian Prantl 3fb6a64655 Refactor ASTReader::getSourceDescriptor(const Module &) into a constructor
of ASTSourceDescriptor. It was effectively a static function.

NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248069 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-19 00:10:32 +00:00
Adrian Prantl c15da610ac 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248062 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-18 23:01:45 +00:00
Adrian Prantl 4dd66d0704 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248037 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-18 21:06:14 +00:00
Alexey Bader a3e40c774f [OpenCL] Add new types for OpenCL 2.0.
Patch by Pedro Ferreira.
Reviewers: pekka.jaaskelainen
Differential Revision: http://reviews.llvm.org/D12855

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247676 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-15 11:18:52 +00:00
Adrian Prantl 1955dea373 Remove an unnecessary check. NFC
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247448 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 18:54:31 +00:00
Adrian Prantl 221aabd028 Remove a redundant check from CGDebugInfo::shouldOmitDefinition() (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247447 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 18:54:28 +00:00
Adrian Prantl 7a7433b56a Cleanup: Get rid of a bunch of unnecessary invocations of internString()
in CGDebugInfo.cpp: MDString::get() copies its arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247445 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 18:45:02 +00:00
Adrian Prantl 2532f2149e Module Debugging: Emit forward declarations for types that are defined in
clang modules, if -dwarf-ext-refs (DebugTypesExtRefs) is specified.

This reimplements r247369 in about a third of the amount of code.
Thanks to David Blaikie pointing this out in post-commit review!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247432 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 17:23:08 +00:00
Adrian Prantl d5dd152695 Revert "Module Debugging: Emit forward declarations for types that are defined in"
This reverts commit r247369 to facilitate reviewing of the following patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247431 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 17:23:03 +00:00
Adrian Prantl 53a314a227 Module Debugging: Emit forward declarations for types that are defined in
clang modules, if -dwarf-ext-refs (DebugTypesExtRefs) is specified.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247369 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 01:03:26 +00:00
Adrian Prantl 3a2252c1af Cleanup: Let CGDebugInfo::ModuleRefCache use a TrackingMDNode (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247368 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 01:03:19 +00:00
David Majnemer 2affb95d6d [MS ABI] Make member pointers return true for isIncompleteType
The type of a member pointer is incomplete if it has no inheritance
model.  This lets us reuse more general logic already embedded in clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247346 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 21:52:00 +00:00
Adrian Prantl 62c5ac0410 Add a getDeclContextDescriptor() helper function to CGDebugInfo. (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247319 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 18:39:45 +00:00
Adrian Prantl 5dcf1edb28 Remove unneeded #include.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247081 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-08 22:06:40 +00:00
Adrian Prantl d9178eb887 Module Debugging: Emit debug type information into clang ObjC modules.
When -fmodule-format is set to "obj", emit debug info for all types
declared in a module or referenced by a declaration into the module's
object file container.

This patch adds support for Objective-C types and methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247068 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-08 20:41:52 +00:00
Adrian Prantl d2e47e291c CGDebugInfo: Instead of uniquing RetainedTypes, just refrain from retaining
them more than once. (NFC)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246231 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-27 22:56:46 +00:00
Adrian Prantl 0a32cc28cd CGDebugInfo: Factor out a getOrCreateStandaloneType() method.
Usually debug info is created on the fly while during codegen.
With this API it becomes possible to create standalone debug info
for types that are not referenced by any code, such as emitting debug info
for a clang module or for implementing something like -gfull.
Because on-the-fly debug info generation may still insert retained types
on top of them, all RetainedTypes are uniqued in CGDebugInfo::finalize().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246210 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-27 21:21:19 +00:00
Adrian Prantl 7bbf57e36a Add a -gmodules option to the driver and a -dwarf-ext-refs to cc1
to enable the use of external type references in the debug info
(a.k.a. module debugging).

The driver expands -gmodules to "-g -fmodule-format=obj -dwarf-ext-refs"
and passes that to cc1. All this does at the moment is set a flag
codegenopts.

http://reviews.llvm.org/D11958

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246192 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-27 19:46:20 +00:00
Duncan P. N. Exon Smith eb6222eaad DI: Clarify meaning of createTempFunctionFwdDecl() arg, NFC
I stared at `false /*declaration*/` for quite some time before giving up
and checking the actual function to see what it meant.  Replacing with
`/* isDefinition = */ false` to save myself effort later.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246095 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-26 22:21:09 +00:00
Yaron Keren f49d6b8491 Remove and forbid raw_svector_ostream::flush() calls.
After r244870 flush() will only compare two null pointers and return,
doing nothing but wasting run time. The call is not required any more
as the stream and its SmallString are always in sync.

Thanks to David Blaikie for reviewing.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244928 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-13 18:12:56 +00:00
David Blaikie bc09bae0bc Wdeprecated: ApplyDebugLocation is returned by value yet if it is ever copied (rather than RVO'd) that would be broken, make it movable instead
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244838 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-12 23:49:57 +00:00
Duncan P. N. Exon Smith aca5ead72a DI: Update for LLVM API change for local variables
Adjust to LLVM DIBuilder API changes in r243764, using
`createAutoVariable()` and `createParameterVariable()` in place of
`createLocalVariable()`.  No real functionality change here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243765 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-31 17:56:14 +00:00
Duncan P. N. Exon Smith 8b3103c132 DI: Make getOrCreateLimitedType() return DICompositeType, NFC
Change `getOrCreateLimitedType()` to return a `DICompositeType` and
remove the casts from its callers.  Inside, I've strengthened a `cast`
from `DICompositeTypeBase`, but the casts in the callers already prove
that this is safe.  There should be no functionality change here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243155 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-24 20:34:41 +00:00
Duncan P. N. Exon Smith 71b79a5c01 DI: Make StaticDataMemberCache type-safe, NFC
Change `StaticDataMemberCache` to store references to `DIDerivedType`
directly, and remove now-unnecessary casts from the accessors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243129 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-24 18:05:58 +00:00
Adrian Prantl 1e53f23050 Cleanup the doxygen comments in CGDebugInfo.cpp according to the coding
standards. Remove several hilariously out-of-date and redundant comments
and move the non-redundant ones into the header file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241733 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-08 21:18:34 +00:00
Adrian Prantl 27cac9536c Debug info: Emit distinct __block_literal_generic types for blocks with
different function signatures. (Previously clang would emit all block
pointer types with the type of the first block pointer in the compile
unit.)

rdar://problem/21602473

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241534 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-07 00:49:35 +00:00
Adrian Prantl 5f8a176ddf Debug info: Don't emit a bogus location for the global block pointer type
(__block_literal_generic).

The arbitrary nature of the location confuses lldb and prevents type
uniquing.

rdar://problem/21602473

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241511 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-06 21:31:35 +00:00
David Blaikie ef109b2e27 Revert "[DebugInfo] Fix debug info generation for function static variables, typedefs, and records"
Caused PR24008.

This reverts commit r241154.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241177 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-01 18:07:22 +00:00
Michael Kuperstein 979403f2e3 [DebugInfo] Fix debug info generation for function static variables, typedefs, and records
Function static variables, typedefs and records (class, struct or union) declared inside
a lexical scope were associated with the function as their parent scope, rather than the
lexical scope they are defined or declared in.

This fixes PR19238

Patch by: amjad.aboud@intel.com
Differential Revision: http://reviews.llvm.org/D9760

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241154 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-01 12:34:39 +00:00
Adrian Prantl d2eec01cea Use an early exit to improve readability. (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241088 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-30 18:01:05 +00:00
Adrian Prantl e9ad7b24fe Debug Info: Emit debug info for @import declarations.
This allows a module-aware debugger such as LLDB to import the currently
visible modules before dropping into the expression evaluator.

rdar://problem/20965932

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241084 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-30 17:39:51 +00:00