Commit Graph

453 Commits

Author SHA1 Message Date
Adrian Prantl
03bb47e017 Debug info: Emit "global" variables in the top level module as static
variables of SWIFT_ENTRY_POINT_FUNCTION.
<rdar://problem/15805751> Emit top-level variables as DWARF

Swift SVN r12362
2014-01-15 23:56:27 +00:00
Adrian Prantl
10a62788c2 misc cleanups
Swift SVN r12361
2014-01-15 23:56:26 +00:00
Adrian Prantl
6310c07733 Debug info: re-enable mangling of type alias types.
<rdar://problem/15797764> Debug info for $swift.type is confusing

Swift SVN r12187
2014-01-11 01:34:45 +00:00
Adrian Prantl
4bf7a5b0f6 Debug info: Add a reference to the stdlib swiftmodule in the line table
so LLDB can find it even if nothing in the CU references it.

<rdar://problem/15776868> p 32 gives "error: use of undeclared type 'COpaquePointer'"

Swift SVN r12180
2014-01-11 01:08:40 +00:00
Adrian Prantl
946dc5678b Debug info: Provide an in interface for LLDB to mangle types and refactor
some code in IRGenDebugInfo along the way.
This is WIP for rdar://problem/15498877.

Swift SVN r12146
2014-01-10 22:35:53 +00:00
Mark Lacey
079c6fc7cb Add case for UncheckedOptional in debug info generation.
Swift SVN r12132
2014-01-10 20:24:05 +00:00
Adrian Prantl
395bd1eede Debug info: record the module name in DWARF. For the time being this is
done via an DW_TAG_imported_module.
rdar://problem/15711613.

Swift SVN r12035
2014-01-08 02:34:29 +00:00
Chris Lattner
9ae289de46 Drive the semantic wedge harder into lvalues. Now, instead of having one LValueType
with qualifiers on it, we have two distinct types:
 - LValueType(T) aka @lvalue T, which is used for mutable values on the LHS of an
   assignment in the typechecker.
 - InOutType(T) aka @inout T, which is used for @inout arguments, and the implicit
   @inout self argument of mutable methods on value types.  This type is also used
   at the SIL level for address types.

While I detangled a number of cases that were checking for LValueType (without checking
qualifiers) and only meant @inout or @lvalue, there is more to be done here.  Notably,
getRValueType() still strips @inout, which is totally and unbearably wrong.



Swift SVN r11727
2013-12-29 22:23:11 +00:00
Joe Groff
3e30cbcfef SILGen/IRGen: Don't emit top_level_code for libraries.
If there's no script-mode file in a module, don't produce a top_level_code SILFunction for it, and don't consider emitting an LLVM global_ctor for it. We should never emit static constructors from user code anymore.

Swift SVN r11644
2013-12-26 00:18:29 +00:00
Joe Groff
14362cd8e2 IRGen: Lower metatypes respecting SIL's 'thin' bit.
Use the 'thin' bit set by SIL to decide whether a metatype lowers to an empty type or not. In GenPoly we still need to accommodate unlowered metatypes to keep protocol witnesses limping along; hopefully that code can be killed soon. With this change we now lower @cc(witness_method) consistently for static methods.

Swift SVN r11535
2013-12-21 02:05:37 +00:00
Jordan Rose
7a30de2efe Disallow inheritance clauses for concrete typealiases.
typealias MyInt: ForwardIndex = Int

There is no real reason to allow this; it's just a static_assert that Int
conforms to ForwardIndex, which would be better spelled some other way.

This only applies to concrete typealiases, i.e. those that simply alias an
underlying type. Associated types can still have both inheritance clauses
and a (default) underlying type.

Swift SVN r11481
2013-12-19 21:13:54 +00:00
Adrian Prantl
baa048e89a Remove functions from the debug info generator's internal data structures
prior to erasing them from the module. This should fix
<rdar://problem/15700509> ASan reports a use-after-free in IRGen

Swift SVN r11479
2013-12-19 19:37:56 +00:00
Joe Groff
017440165e Fix the weird capitalization of MetaTypeType.
Swift SVN r11475
2013-12-19 18:43:08 +00:00
Connor Wakamo
59f18f9fc0 Renamed irgen::Options and irgen::OutputKind to IRGenOptions and IRGenOutputKind, and move both out of the irgen namespace now that they're in swiftAST.
Swift SVN r11405
2013-12-18 01:17:09 +00:00
Connor Wakamo
3e81830385 Move "include/swift/IRGen/Options.h" to "include/swift/AST/IRGenOptions.h".
This commit only moves the header file; updating the class so that it is no longer in the irgen namespace will be handled separately.

Swift SVN r11404
2013-12-18 01:17:09 +00:00
Adrian Prantl
5dc5f4963c Debug info: set the appropriate scope for box-allocated variables.
Fixes rdar://problem/15638864.

Swift SVN r11321
2013-12-14 23:53:45 +00:00
Chris Lattner
698380d6d3 Introduce a new bit in VarDecl, "isLet". Teach Sema that 'isLet' properties
are not settable (like get-only ones).  Set the 'isLet' bit in various 
places, but not the particularly interesting or useful places yet.



Swift SVN r11121
2013-12-11 06:45:40 +00:00
Adrian Prantl
1bcbaedcd0 Debug info: get rid of intrinsickind.
Swift SVN r11101
2013-12-10 23:53:18 +00:00
Adrian Prantl
1f927d9ffc Overhaul the handling of return locations for auto-generated code.
- change SILGenFunction to use Cleanup and Implicit return locations for
  auto-generated cleanups/returns where sensible.
- Fix a bug in where ConstructorDecl that would return the wrong
  source range.
- Move the expected locations of some errors to the end of the function
  where they should belong.

Fixes <rdar://problem/15609768> Line tables for classes that don't have
init but just initialize ivars are odd

Swift SVN r11086
2013-12-10 19:23:34 +00:00
Adrian Prantl
22f1d8c7a6 Debug info: Repair emission of the swift.type type after introducing the
_Tta mangling.
Fixes <rdar://problem/15599592> Type for $swift.type arguments is now Builtin.RawPointer.metatype

Swift SVN r11046
2013-12-09 23:09:43 +00:00
Adrian Prantl
e385446593 Debug info: Get the storage size of basic types from llvm::DataLayout.
Swift SVN r10925
2013-12-06 18:15:39 +00:00
Adrian Prantl
bc9cb71c10 Debug info: An Int1 still occupies 8 bits.
Fixes rdar://problem/15474135.

Swift SVN r10903
2013-12-06 02:08:11 +00:00
Joe Groff
0ff977d407 Add a 'WitnessMethod' enumerator to AbstractCC.
We'll use this to represent the slightly-different polymorphic calling convention used for passing Self into protocol witnesses.

Swift SVN r10898
2013-12-06 01:32:35 +00:00
Adrian Prantl
2055386e0c Debug Info: Move the argument ordering logic into IRGenSILFunction and
get rid of the hack that used to be in IRGenDebugInfo.
This commit also adds a bunch of interesting testcases for function args.
Fixes <rdar://problem/15464454> Arguments sometimes go missing.

Swift SVN r10873
2013-12-05 18:51:07 +00:00
Jordan Rose
417b5d3982 Merge TranslationUnit into Module, and eliminate the term "translation unit".
This completes the FileUnit refactoring. A module consists of multiple
FileUnits, which provide decls from various file-like sources. I say
"file-like" because the Builtin module is implemented with a single
BuiltinUnit, and imported Clang modules are just a single FileUnit source
within a module.

Most modules, therefore, contain a single file unit; only the main module
will contain multiple source files (and eventually partial AST files).

The term "translation unit" has been scrubbed from the project. To refer
to the context of declarations outside of any other declarations, use
"top-level" or "module scope". To refer to a .swift file or its DeclContext,
use "source file". To refer to a single unit of compilation, use "module",
since the model is that an entire module will be compiled with a single
driver call. (It will still be possible to compile a single source file
through the direct-to-frontend interface, but only in the context of the
whole module.)

Swift SVN r10837
2013-12-05 01:51:15 +00:00
Jordan Rose
5dda63aa82 Remove LoadedModule, and strip ModuleLoader down to just loading things.
Now that everything is done in terms of FileUnits, we don't need LoadedModule
anymore, and now that FileUnits just use virtual dispatch, we don't need to
indirect through ModuleLoader to distinguish them.

This doesn't quite simplify as much as it could, because the next change is
going to combine TranslationUnit and Module.

Swift SVN r10836
2013-12-05 01:51:12 +00:00
Jordan Rose
8b8cc8ee62 Turn SerializedModule into SerializedASTFile.
Part of the FileUnit restructuring. A serialized module is now represented as
a TranslationUnit containing a single SerializedASTFile.

As part of this change, the FileUnit interface has been made virtual, rather
than switching on the Kind in every accessor. We think the operations
performed on files are sufficiently high-level that this shouldn't affect us.

A nice side effect of all this is that we now properly model the visibility
of modules imported into source files. Previously, we would always consider
the top-level imports of all files within a target, whether re-exported or
not.

We may still end up wanting to distinguish properties of a complete Swift
module file from a partial AST file, but we can do that within
SerializedModuleLoader.

Swift SVN r10832
2013-12-05 01:51:09 +00:00
Adrian Prantl
a5cd7834c7 Remove redundant code
Swift SVN r10792
2013-12-04 21:45:18 +00:00
Adrian Prantl
41e92af7ae Mangler: Add a DWARF-only mangling for type aliases that includes the
decl context of the type alias.
This implements <rdar://problem/15290346> "typealias sugar needs to be
mangled into debug info mangled type names".

Swift SVN r10749
2013-12-03 17:15:18 +00:00
Adrian Prantl
a822eca987 use SmallStrings instead of std::string
Swift SVN r10741
2013-12-03 00:25:57 +00:00
Adrian Prantl
f2e8e4b08f Debug info: Emit L-Values as indirect would be redundant, because they are
already reference types.

Swift SVN r10740
2013-12-03 00:25:55 +00:00
Adrian Prantl
b0276bda79 Debug info: Emit the names of struct members when emitting their types.
I'm somewhat surprised no one complained about this before.

Swift SVN r10666
2013-11-22 22:17:43 +00:00
Adrian Prantl
84b649e92c Cleanup: construct the names of builtin types on the fly.
Swift SVN r10648
2013-11-22 00:23:44 +00:00
Adrian Prantl
d2cc658a26 Debug info: typeargs are always direct values even if they are shadow-copied.
<rdar://problem/15476354> $swift.type arguments emitted as 'deref' in DWARF

Swift SVN r10643
2013-11-21 23:53:20 +00:00
Adrian Prantl
4244463b44 Debug info: don't crash when handling enum-like enums.
<rdar://problem/15418642> Swift compiler crashes when producing debug information

Swift SVN r10601
2013-11-20 18:48:30 +00:00
Adrian Prantl
7fca2d8142 Debug info: Encode the provenance of types imported from Objective-C in
the debug info.
<rdar://problem/15414884> Debug information must indicate location of Objective-C types

Swift SVN r10580
2013-11-20 03:38:21 +00:00
John McCall
f2edd610cb Don't give IRGenDebugInfo privileged access to the TypeConverter.
Now that it's using the public routines for getting a TypeInfo,
make sure it's actually lowering types appropriately.

Swift SVN r10571
2013-11-20 00:14:19 +00:00
John McCall
20e58dcf93 Change the type of function values in SIL to SILFunctionType.
Perform major abstraction remappings in SILGen.  Introduce
thunking functions as necessary to map between abstraction
patterns.

Swift SVN r10562
2013-11-19 22:55:09 +00:00
Adrian Prantl
eb8122ea4d Debug info: Types should not be in the scope of the first variable that is
using them.

Swift SVN r10506
2013-11-15 23:24:48 +00:00
Adrian Prantl
a1c17f2410 Add a pretty name for 1-bit integers.
Swift SVN r10504
2013-11-15 23:24:46 +00:00
Joe Groff
19457c12ea Give Builtin.Word an abstract size.
Instead of hardcoding Builtin.Word to be an alias for Builtin.Int64, make it its own type of abstract pointer width.

- Change BuiltinIntegerType's width representation to accommodate abstract widths.

- In the AST and in SIL, store values of the types as the greatest supported size for the abstract width (64 bits for a pointer).

- Add some type safety to the ([sz]ext|trunc)(OrBitCast)? builtins that they're used appropriately given the upper and lower bounds of the abstract sizes they're working with.

- Now that Builtin.Word is a distinct type, give it its own mangling.

- In IRGen, lower pointer-sized BuiltinIntegerType appropriately for the target, and truncate lowered SIL values if necessary.

Fixes <rdar://problem/15367913>.

Swift SVN r10467
2013-11-14 19:56:26 +00:00
Joe Groff
4f2adbe7ed AST: Include 'static' bit in VarDecls.
And track the 'static' SourceLoc in the PatternBindingDecl. This lets isInstanceMember return the right thing for static vars.

Swift SVN r10369
2013-11-12 06:16:48 +00:00
Adrian Prantl
2abe03fda0 Debug Info: Emit a shadow copy of the type metadata in an alloca at -O0
so we can emit persistent debug info for it.
Fixes <rdar://problem/15428758> dbg.value doesn't make it into the .o file.

Swift SVN r10354
2013-11-12 01:24:12 +00:00
Adrian Prantl
44bdefa040 Debug info for Archetypes: Get rid of the typedef for the type variable
used by the programmer. It's no longer needed, LLDB can get to it from
the AST.

Swift SVN r9885
2013-11-01 23:30:16 +00:00
Adrian Prantl
459db73092 Debug info: Move the logic for emitting type metadata arguments to
GenProto, and emit both the mangled name and the type variable used by the
programmer for archetypes.
Fixes <rdar://problem/15346134> The $swift.type metadata arguments do not show up anymore

Swift SVN r9844
2013-10-31 04:50:33 +00:00
Adrian Prantl
d83c5525f2 Debug info: Simplification.
Swift SVN r9743
2013-10-28 23:14:42 +00:00
Adrian Prantl
5bbe0afb9f Debug info: Properly handle the function prologue in the line table.
Introduces a new flag in SILLocation: InPrologue to mark instructions
that setup the stack and allocate storage for local variables/arguments.

Fixes rdar://problem/15290023: Breakpoint set on prologue - crash ensues.

Swift SVN r9686
2013-10-26 00:12:20 +00:00
Adrian Prantl
29ae59ee1c Debug info: some refactoring to make emitVariableDeclaration more flexible.
Swift SVN r9608
2013-10-23 00:38:57 +00:00
Adrian Prantl
9ea487e4af Debug info: Emit local variables without storage as local variables constant 0.
Fixes rdar://problem/14802771.

Swift SVN r9575
2013-10-22 01:53:14 +00:00
Adrian Prantl
5cf8999985 Debug info: some more refactoring for rdar://problem/14845534.
Swift SVN r9571
2013-10-21 23:38:18 +00:00