Commit Graph

1174 Commits

Author SHA1 Message Date
Adrian Prantl
d1c9f71a73 Enhance SILLocation so it can hold separate locations for diagnostics
and debug info. Drop most of the special SILLocation handling from
IRGenDebugInfo and eliminate lots of redundant code.

Swift SVN r22781
2014-10-15 23:05:57 +00:00
Adrian Prantl
a64a2691b1 Debug info: Use the end of a call expression as the location for a call.
Swift SVN r22740
2014-10-15 00:26:45 +00:00
Adrian Prantl
d6e5caf634 Assert monotonically increasing line numbers within the same basic block
at -Onone. This is currently turned off by default because it
also reports false positives, but it is an incredibly useful mechanism
to find linetable bugs.

Swift SVN r22738
2014-10-15 00:26:33 +00:00
Adrian Prantl
807434e4a8 Work around an elusive crash in DwarfDebug::endFunction().
<rdar://problem/18592152> Unchecked Swift builder is sometimes crashing in AsmPrinter::EmitFunctionBody

DIBuilder adds all DIVariables to a temporary named MDNode in
order to add them to the variables field in their parent
DISubprogram in DIBuilder::finalize(). In the absence of an
llvm::Function DIBuilder uses the human-readable name as a name
for this temporary MDnode, which in the case of specialized
generic functions (which are then SILinlining and thus
zombiefied, making them loose their llvm::Function) is not
unique, because the specialization is not encoded in the
human-readable name. Until either of these problems are fixed,
use the mangled name as human-readable name IR-less functions
here.
Work is underway to upstream an assertion in LLVM that will
ensure this won't regress.

Swift SVN r22687
2014-10-11 04:07:31 +00:00
Doug Gregor
7d6ca8c2b8 Reinstate r22662 "Preserve the names of zombie functions and use them as linkage names in the debug info.""
It looks like Xcode badness caused the build breakage. Sorry, Erik!

Swift SVN r22677
2014-10-10 22:03:58 +00:00
Doug Gregor
5338a29f7f Revert "Preserve the names of zombie functions and use them as linkage names in the debug info."
This reverts commit r22662, which is causing the stdlib build to crash.

Swift SVN r22670
2014-10-10 17:46:30 +00:00
Erik Eckstein
bdfb461569 Preserve the names of zombie functions and use them as linkage names in the debug info.
Swift SVN r22662
2014-10-10 13:26:28 +00:00
Adrian Prantl
aa6c57fc6b Remove special-casing of avaliable_externally functions when emitting
debug info for them and unconditionally emit debug info for all
functions.

Swift SVN r22653
2014-10-10 03:47:32 +00:00
Adrian Prantl
16f0bf1859 Add additional sanity checks to the debug scope creation while
fixing an off-by-one error in the boolean condition.

Swift SVN r22631
2014-10-09 20:16:42 +00:00
Dave Abrahams
8bd164610c Revert "Add additional sanity checks to the debug scope creation."
This reverts r22625 as it breaks my
RelWithDebInfo/SWIFT_OPTIMIZED=NO/INTERNAL_CHECKS=ON build:

Assertion failed: (DS->SILFn != Parent->SILFn && "non-inlined parent scope from different function?"), function parentScopesAreSane, file swift/lib/IRGen/IRGenDebugInfo.cpp, line 383.
...
1.	While emitting IR SIL function @_TFSs10minElementUSs12SequenceType_USs13GeneratorType_Ss10Comparable__FQ_QQQ_9Generator7Element for 'minElement' at /Users/dave/src/s/swift/stdlib/core/Algorithm.swift:12:8

Swift SVN r22630
2014-10-09 18:51:22 +00:00
Adrian Prantl
17c16c71a2 remove redundant check.
Swift SVN r22626
2014-10-09 18:04:34 +00:00
Adrian Prantl
cad7462342 Add additional sanity checks to the debug scope creation.
Swift SVN r22625
2014-10-09 18:04:34 +00:00
Adrian Prantl
689621e34a Debug Info: Make several soft assertions into hard ones.
Swift SVN r22613
2014-10-09 03:21:17 +00:00
Adrian Prantl
0420d9f2a2 Make the intention of the fallback logic for computing the linkage name
of a function clearer.

Swift SVN r22610
2014-10-09 02:14:57 +00:00
Adrian Prantl
d39d5702e9 Debug info: Stop abusing the Local flag for the calling convention.
The calling convention is encoded into the mangled name.

Swift SVN r22591
2014-10-08 01:13:13 +00:00
Adrian Prantl
f477b2685c Fix two IR correctness bugs related to not using the LLVM datatype in
DebugTypeInfo.

Swift SVN r22567
2014-10-07 17:33:39 +00:00
Joe Groff
cac5807ae2 SILGen: Emit "main" as a SIL function.
Eliminate the intermediate top_level_code function. Now that SIL is expressive enough to express a "main" function, there's no reason for it, and this eliminates a bunch of mystery code in IRGen to thunk from main to top_level_code by reaching for hardcoded symbol names. Demystify the special code for setting up C_ARGC and C_ARGV by having SILGen look for a transparent "_didEnterMain" hook in the stdlib and emit a call to it.

Swift SVN r22525
2014-10-05 04:13:24 +00:00
Adrian Prantl
d769498ccd Update for upstream LLVM API change.
Swift SVN r22456
2014-10-02 01:33:24 +00:00
Dmitri Hrybenko
e16e29b660 Update for upstream LLVM API changes
Swift SVN r22350
2014-09-29 13:17:35 +00:00
Erik Eckstein
35cfa7d2a0 fix a memory corruption introduced in r22301
(Don't increment refcounts of inlined SILFunctions for the purpose of debug info generation.)



Swift SVN r22349
2014-09-29 09:12:27 +00:00
Erik Eckstein
92dc4ee237 Don't increment refcounts of inlined SILFunctions for the purpose of debug info generation.
This prevented dead function removal of inlined dead functions. Beside the stdlib it's mostly
an issue of SIL size (and therefore compiletime), because llvm did remove such functions anyway.



Swift SVN r22301
2014-09-26 16:07:26 +00:00
John McCall
16cb523c3a AST support for accessors.
Swift SVN r22228
2014-09-23 20:34:19 +00:00
John McCall
75050f8166 Generate an implicit 'materializeForSet' accessor
along with getters and setters.

Just generate it for now.

Swift SVN r22011
2014-09-17 08:08:03 +00:00
Adrian Prantl
4dca38a8b3 Debug info: Remove the special handling of AnyFunctionType to add an extra
OpDeref to function objects (since Swift doesn't have function *pointer*
types). It confuses the debugger and is inconsistent with how we handle
other types such as classes.

<rdar://problem/18272602> Function pointers in local variables have incorrect DWARF locations

Swift SVN r21792
2014-09-08 23:39:27 +00:00
Adrian Prantl
3de439e574 Support debug info when compiling textual SIL files.
- Use SILFileLocations when compiling .sil with -g.
- Fix a crash when trying to find the Builtin module.

Part of <rdar://problem/17999350> `swiftc -g` crashes in some Swift tests

Swift SVN r21425
2014-08-22 22:48:12 +00:00
Dmitri Hrybenko
e45fe991b0 Update for upstream LLVM API changes in debug info gerenation
Swift SVN r21408
2014-08-22 08:27:57 +00:00
Jordan Rose
903cfacfa5 [DebugInfo] When looking up an imported module, don't include the scope.
i.e. for "import func Darwin.C.sqrt", use the module path "Darwin.C",
not the full path "Darwin.C.sqrt".

<rdar://problem/17895650>

Swift SVN r21097
2014-08-07 21:26:34 +00:00
Adrian Prantl
9fafa1c13c Make deserialized locations default to line 0, which tells the debugger
to ignore them, while still referencing the module file needed to perform
type lookups, etc.
<rdar://problem/17648201> After setting a breakpoint, the first step action is malfunctioning

Swift SVN r20801
2014-07-31 01:39:12 +00:00
Erik Eckstein
3751991798 Adapt to llvm debuginfo change: use DITypeArray instead of DIArray in some places
Swift SVN r20672
2014-07-29 15:13:21 +00:00
Adrian Prantl
f205552b61 [LLVM sync] Adopt the new API introduced in LLVM r214115.
Swift SVN r20651
2014-07-28 22:41:10 +00:00
Adrian Prantl
0d2d2d32b1 Debug info: Improve handling of storage-less variables.
Swift SVN r20546
2014-07-25 16:47:59 +00:00
Adrian Prantl
b4b2b31dd1 Remove debug code that was accidentally committed.
Swift SVN r20504
2014-07-24 18:34:16 +00:00
Jordan Rose
b6818046a8 Eliminate optimization levels 0-3 in favor of -Onone/-O/-Ofast.
We were already effectively doing this everywhere /except/ when building
the standard library (which used -O2), so just use the model we want going
forward.

Swift SVN r20455
2014-07-24 01:12:59 +00:00
Dmitri Hrybenko
e7b4e6c370 Punycode encoder/decoder: separate core and parts that depend on UTF8
encoder/decoder


Swift SVN r20309
2014-07-22 15:01:12 +00:00
Dmitri Hrybenko
734c0a9ba1 Revert "Punycode encoder/decoder: separate core and parts that depend on UTF8"
It broke tests.

Swift SVN r20308
2014-07-22 14:44:20 +00:00
Dmitri Hrybenko
56342b0cfa Punycode encoder/decoder: separate core and parts that depend on UTF8
encoder/decoder


Swift SVN r20307
2014-07-22 14:37:37 +00:00
Dmitri Hrybenko
e33bb4c8de Demangler: remove SmallVector from punycode encoder and decoder interface
Swift SVN r20250
2014-07-21 14:37:16 +00:00
Joe Groff
45eec9a2e9 Remove 'interface' from the method names of SILFunctionType.
SILFunctionTypes are always interface types now. NFC.

Swift SVN r19952
2014-07-14 22:03:46 +00:00
Adrian Prantl
400f1774e9 Add support for a #line directive.
This patch extends the syntax with a new #line directive that is inspired
by the homonymous CPP directive. It can be specified in all locations a #if
is legal (Stmt, Decl).

Semantics
---------

#line 42 "file.swift"
This makes diagnostics and debug information behave as if the subsequent
lines came from file.swift+42.

#line // without arguments
This switches back to the main source file and the switches back to the
normal line numbering. Any previous #line directives will result in gaps
in the main file.

Rationale
---------

LLDB and the REPL need this for making expressions that are entered into
the expression evaluator or REPL debugable. For more info see
<rdar://problem/17441710> Need #line directive or something similar so we can enhance the debugging of expressions and REPL

Also, I believe the stdlib would benefit from this and it would allow us
to get rid of the line-directive wrapper script.

Swift SVN r19384
2014-06-30 23:50:11 +00:00
Adrian Prantl
3ae5326d21 Tweak the scope guessing for instructions without SILDebugScopes to reuse
the scope of the previous instruction.

<rdar://problem/17021591> Gap in lexical block coincides with the first line-table entry for a line => no variables at that line

Swift SVN r19318
2014-06-28 02:08:26 +00:00
Doug Gregor
07a7059934 Preserve dictionary type sugar in the type system.
Another piece of <rdar://problem/17460972>.


Swift SVN r19253
2014-06-26 21:12:19 +00:00
Greg Clayton
707505f3f5 Revert fix for being able to generate debug info in JIT'ed expressions until we can pass all regression tests.
Swift SVN r19111
2014-06-24 00:12:18 +00:00
Greg Clayton
cddae42bac Don't crash (via assert) when trying to enable debug info in Swift JIT'ed expressions.
Swift SVN r19102
2014-06-23 22:21:44 +00:00
Adrian Prantl
b1a7a7af1b Reference-count inlined functions to keep them alive until we emit debug
info for them and generally clean up the inline scope handling a bit.
Fix the debug scope handling for all clients of SILCloner, especially
the SIL-level spezializers and inliners.
This also adds a ton of additional assertions that will ensure that
future optimization passes won't mess with the debug info in a way that
could confuse the LLVM backend.

Swift SVN r18984
2014-06-18 22:34:10 +00:00
Jordan Rose
574054b8fd Distance SourceManager from llvm::SourceMgr.
...in preparation for non-source locations, i.e. locations that don't come
frome source buffers.

No functionality change, but a fair bit of SourceManager API and idioms have
changed.

Swift SVN r18942
2014-06-17 01:15:47 +00:00
Michael Gottesman
9b72aa0e47 Revert "Update to ToT which removed std::error_code"
This reverts commit r18853. This was already fixed by the previous
commit.

Swift SVN r18855
2014-06-13 04:34:18 +00:00
Pete Cooper
676b005839 Update to ToT which removed std::error_code
Swift SVN r18853
2014-06-13 03:50:33 +00:00
Justin Bogner
a0c0dc25be Use std::error_code rather than llvm::error_code
std::error_code is no longer available via the llvm namespace as of
r210835.

Swift SVN r18851
2014-06-13 02:54:07 +00:00
Bob Wilson
2df66cf8c4 Implement inline scopes for the performance inliner.
Mandatory-inlined (aka transparent functions) are still treated as if they
had the location and scope of the call site. <rdar://problem/14845844>
Support inline scopes once we have an optimizing SIL-based inliner

Patch by Adrian Prantl.

Swift SVN r18835
2014-06-12 19:48:43 +00:00
Bob Wilson
9ab1136ba8 Update error_code usage to match llvm trunk.
LLVM's system_error.h has been changed to forward to the standard
version of the same. Update usage for the minor API changes that this
entails.

Based in part on a patch by Justin Bogner.

Swift SVN r18832
2014-06-12 19:48:39 +00:00