Commit Graph

1768 Commits

Author SHA1 Message Date
Michael Gottesman
d0219b6f7a [stlextras] Add overloads for binary_search that take containers. 2019-11-15 12:57:39 -08:00
Robert Widmann
f4d333d066 Sink a bunch of semantic options into TypeCheckerOptions
Sink
- DebugConstraintSolver
- DebugConstraintSolverAttempt
- DebugConstraintSolverOnLines
- DebugGenericSignatures
- DebugForbidTypecheckPrefix
- SolverMemoryThreshold
- SolverBindingThreshold
- SolverShrinkUnsolvedThreshold
- SolverDisableShrink
- EnableOperatorDesignatedTypes
- DisableConstraintSolverPerformanceHacks
- SolverEnableOperatorDesignatedTypes
2019-11-12 22:39:49 -08:00
Robert Widmann
097726717e Absorb the TypeCheckerFlags into the Frontend
De-duplicate TypeCheckingFlags, TypeChecker's Options, and the TypeChecker-Oriented FrontendOptions into a dedicated TypeCheckerOptions type.  This moves a bunch of configuration state out of the type checker and into the ASTContext where it belongs.
2019-11-12 09:54:06 -08:00
Owen Voorhees
ac05a66938 [Diagnostics] Introduce "Educational Notes" for diagnostics
Educational notes are small pieces of documentation which explain a concept
relevant to some diagnostic message. If -enable-descriptive-diagnostics is
passed, they will be printed after a diagnostic message if available.

Educational notes can be found at /usr/share/doc/diagnostics in a
toolchain, and are associated with specific compiler diagnostics in
EducationalNotes.def.
2019-11-07 13:18:35 -08:00
Joe Groff
4d6392b8ad Add an option to stage in substituted type lowering for function values 2019-11-05 11:32:34 -08:00
Hamish Knight
7077a68b83 [Sema] Diagnose unsound pointer conversions
Diagnose ephemeral conversions that are passed to @_nonEphemeral
parameters. Currently, this defaults to a warning with a frontend flag
to upgrade to an error. Hopefully this will become an error by default
in a future language version.
2019-11-03 08:42:25 -08:00
Saleem Abdulrasool
e45574e507 Merge pull request #27999 from compnerd/documentation
Basic: add a comment about the "complex" code
2019-11-01 18:42:49 -07:00
Brent Royal-Gordon
17169fc1fe Merge pull request #27950 from brentdax/dumpster-fire
[NFC] Standardize dump() methods in frontend
2019-10-31 20:36:26 -07:00
Brent Royal-Gordon
99faa033fc [NFC] Standardize dump() methods in frontend
By convention, most structs and classes in the Swift compiler include a `dump()` method which prints debugging information. This method is meant to be called only from the debugger, but this means they’re often unused and may be eliminated from optimized binaries. On the other hand, some parts of the compiler call `dump()` methods directly despite them being intended as a pure debugging aid. clang supports attributes which can be used to avoid these problems, but they’re used very inconsistently across the compiler.

This commit adds `SWIFT_DEBUG_DUMP` and `SWIFT_DEBUG_DUMPER(<name>(<params>))` macros to declare `dump()` methods with the appropriate set of attributes and adopts this macro throughout the frontend. It does not pervasively adopt this macro in SILGen, SILOptimizer, or IRGen; these components use `dump()` methods in a different way where they’re frequently called from debugging code. Nor does it adopt it in runtime components like swiftRuntime and swiftReflection, because I’m a bit worried about size.

Despite the large number of files and lines affected, this change is NFC.
2019-10-31 18:37:42 -07:00
Saleem Abdulrasool
dae4f207a0 Basic: add a comment about the "complex" code
This addresses comments from Joe to document the special behaviour that
we do in the `addSubsitution` functions which cause a subtle failure on
Windows.
2019-10-31 15:41:05 -07:00
Saleem Abdulrasool
41e28a8c3d Basic: avoid an assertion on Windows
The order of evaluation of the subscript operator would increase the
count of map, resulting in the decoration to be off by one.  This
enables building the swift standard library on Windows again.
2019-10-31 10:44:27 -07:00
Robert Widmann
28b66f6225 Switch DeclValidation Counter to Request Counter
Now that validateDecl is gone, stop duplicating work here and use the
request counter instead.
2019-10-28 15:36:50 -07:00
Pavel Yaskevich
0c1502163b Merge pull request #27781 from owenv/descriptive-diagnostics-flag
[Diagnostics] Add -enable-experimental-descriptive-diagnostics frontend flag
2019-10-18 19:53:33 -07:00
Owen Voorhees
0a84879c74 [Diagnostics] Add -enable-experimental-descriptive-diagnostics frontend flag
This flag will feature-gate work on producing more descriptive diagnostic messages.
It will remain a hidden frontend option until these improvements are ready to ship.
2019-10-18 18:13:19 -07:00
Xi Ge
7d600eb27a ABI/API checker: teach the tool to emit diagnostics to serialized source location for decls 2019-10-17 16:31:56 -07:00
Jordan Rose
0f071e28ea Simplify getPrepositionKind to isPreposition
No one was distinguishing directional and non-directional prepositions
anymore. No functionality change.
2019-10-16 19:55:46 -07:00
Xi Ge
76f269586b SourceManager: avoid using additional buffer Id map for external source buffers
SourceManager may outlive ASTContext where external source file paths are managed.
Therefore, we should use the identifier from the memory buffer as the key instead of
using a pointer from an ASTContext.
2019-10-15 16:48:20 -07:00
Xi Ge
c6035f68f0 AST: cache serialized source locations in Decl 2019-10-15 16:05:28 -07:00
Xi Ge
1e22e7c8aa AST: teach Decl::getLoc() to return serialized source loc.
When Decl::getLoc() is called upon a serialized AST and the
serialized source location is available, we lazily open the
external buffer and return a valid SourceLoc instance pointing
into the buffer.
2019-10-15 16:05:28 -07:00
Doug Gregor
43da5c9744 Remove dead flag disable-tsan-inout-instrumentation 2019-10-14 21:42:33 -07:00
Doug Gregor
14be78d54d Remove -(enable|disable)-function-builder-one-way-constraints
Remove the staging flags for unidirectional constraints in function
builders. We're not going back!
2019-10-14 21:22:28 -07:00
Jordan Rose
171ff440fc Remove swift::reversed in favor of llvm::reverse (#27610)
The former predates the latter, but we don't need it anymore! The
latter has more features anyway.

No functionality change.
2019-10-10 17:16:09 -07:00
Jordan Rose
42f7a35c4d omitNeedlessWords: sink helper enum into .cpp file
No functionality change.
2019-10-10 10:48:12 -07:00
Jordan Rose
3fdbd1b154 omitNeedlessWords: split out BaseNameSelf omission
This is the only omission kind that needs to look in the middle of a
name rather than just at the start or the end. So, handle that
explicitly instead to simplify all the other code.
2019-10-10 10:48:12 -07:00
Jordan Rose
a1ea211f22 Add llvm::iterator_range to LLVM.h
If we're going to get rid of swift::IteratorRange, let's make
llvm::iterator_range easy to use.

No functionality change.
2019-10-08 15:24:06 -07:00
Jordan Rose
7b0d081965 Remove IteratorRange in favor of llvm::iterator_range
Now that llvm::iterator_range has 'empty', there's not enough reason to
keep our own version of it in the Swift repo.

No functionality change.
2019-10-08 11:23:28 -07:00
Jordan Rose
5d817d9d58 [ClangImporter] Save a bit of malloc traffic with BumpPtrAllocator (#27552)
No functionality change.
2019-10-08 10:44:26 -07:00
Dan Zheng
f6226d926c [AutoDiff upstream] Add -enable-experimental-differentiable-programming frontend flag. (#27446)
This flag will enable all experimental differentiable programming features.
The default will be `true` on tensorflow branch but `false` on master branch.

Features will first be updated on tensorflow branch to use this flag, before
being upstreamed to master. The goal is to achieve a minimal code diff between
the two branches.

The [TF-820](https://bugs.swift.org/browse/TF-820) master issue tracks upstreaming differentiable programming.

---

Rationale: we chose to add a frontend flag rather than a `build-script`/CMake flag for easier testing. Differentiable programming `lit` tests can be run by specifying this additional flag without recompiling the compiler and standard library.

[Forum discussion on upstreaming differentiable programming.](https://forums.swift.org/t/upstreaming-differentiable-attribute-and-differentiable-protocol/26821)
2019-10-07 19:17:40 -07:00
Jordan Rose
b32e82c720 More idiomatic use of llvm::hash_combine in many places (#27497)
- No need to hash input values first
- Pass many values to a single hash_combine to save on intermediates
- Use hash_combine_range instead of a loop of hash_combines

No functionality change.
2019-10-04 13:08:24 -07:00
Jordan Rose
262f6864c2 Remove unused swift::FilterIterator and swift::FilterRange
No functionality change ("unused")
2019-10-02 10:23:19 -07:00
Jordan Rose
8b8c88e258 Improve swift::TransformRange enough to delete TransformArrayRef
We have a lot of "transform a range" types already:
llvm::mapped_iterator, swift::TransformRange and
swift::TransformIterator, and swift::ArrayRefView for static
transformations. This gets rid of one more layer without losing
any real functionality.
2019-10-02 10:23:05 -07:00
swift-ci
4e5ee3c6c0 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-30 09:03:42 -07:00
Joe Groff
4012a207c8 MetadataReader: Add an API for reading absolute pointers.
Pointer data in some remote reflection targets may required relocation, or may not be
fully resolvable, such as when we're dumping info from a single image on disk that
references other dynamic libraries. Add a `RemoteAbsolutePointer` type that can hold a
symbol, offset, or combination of both, and add APIs to `MemoryReader` and `MetadataReader`
for reading pointers that can get unresolved relocation info from an image, or apply
relocations to pointer information. MetadataReader can use the symbol name information to
fill in demanglings of symbolic-reference-bearing mangled names by using the information
from the symbol name to fill in the name even though the context descriptors are not
available.

For now, this is NFC (MemoryReader::resolvePointer just forwards the pointer data), but
lays the groundwork for implementation of relocation in ObjectMemoryReader.
2019-09-28 16:53:34 -07:00
swift-ci
e010cb4cd4 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-24 20:43:47 -07:00
Xi Ge
3103b5cec1 Frontend: set up output file .swiftsourceinfo
This patch will focus on teaching driver and frontend to emit this file.
The actual content and de-serialization parts will come later.

More details: https://forums.swift.org/t/proposal-emitting-source-information-file-during-compilation/28794
2019-09-24 13:52:17 -07:00
swift-ci
e2182dc166 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-22 20:44:27 -07:00
swift-ci
25488fea80 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-22 19:24:20 -07:00
David Ungar
4a265a91d7 Turn on ASTScopes 2019-09-22 19:17:49 -07:00
David Ungar
a9a9069591 change compare-to-astScope-lookup to crosscheck-unqualified-lookup 2019-09-22 17:59:39 -07:00
swift-ci
a2684816bb Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-14 19:04:01 -07:00
David Ungar
c7be2def90 Merge pull request #27143 from davidungar/A-9-12-eager-off
[NFC NameLookup ASTScope] Fixes for large app, eager primary tree creation, memberCount fix.
2019-09-14 18:46:17 -07:00
David Ungar
3afd6a7146 add flag to stress scope creation 2019-09-13 22:30:49 -07:00
swift-ci
a9e39bdb21 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-13 21:03:33 -07:00
Harlan Haskins
c82c9b8210 [ModuleInterfaces] Remove references to 'parseable' interfaces everywhere
Now that we've settled on Module Interface as the name, let's remove the
vestiges of "Parseable Interfaces"
2019-09-13 14:55:48 -07:00
Brent Royal-Gordon
8734092923 Merge branch 'master' into master-rebranch
# Conflicts:
#	lib/IRGen/GenExistential.cpp
2019-09-11 20:12:03 -07:00
Jordan Rose
111fb37f74 Remove swift::DoAtScopeExit in favor of llvm::make_scope_exit (#27113)
Keep the SWIFT_DEFER macro, though, which is what everyone in the
Swift codebase actually uses. No functionality change.
2019-09-10 18:30:30 -07:00
swift-ci
5aeb95af94 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-09 19:24:21 -07:00
Michael Gottesman
8e110108d3 [semantic-arc-opts] Eliminate dead trivial instructions /after/ the main loop to avoid issues around adding/removing things from the worklist.
rdar://55127027
2019-09-09 14:52:36 -07:00
swift-ci
866e20ad6a Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-07 02:23:41 -07:00
Michael Gottesman
4c803c9583 [gardening] LLVM has its own enumerate impl now. Use that and delete the one swift had.
NFCI.
2019-09-07 00:13:29 -07:00