Commit Graph

33 Commits

Author SHA1 Message Date
Josh Soref
66663b1286 Spelling basic (#42541)
* spelling: add

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: attributes

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: bridging

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: deserialization

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: initialize

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: invariants

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: lazily

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: occurred

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: offset

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: optimization

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: our

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: process

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: substitution

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: the operation

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: the

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-05-04 14:53:24 -07:00
Dan Zheng
eaad4fc780 Mark IntRange::iterator::operator{==,!=} as const. (#28390)
`IntRange::iterator::operator==` must be marked as `const` in order to use
`OptionalTransformRange<IntRange<...>, ...>::empty` under specific conditions.
2019-11-20 18:24:38 -08: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
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
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
Sho Ikeda
9c3e4848bf [gardening][Basic] Replace typedef with using 2018-03-28 21:27:26 +09:00
John McCall
4fdccaf737 Allow IntRange to range over enum values. 2017-09-25 02:05:23 -04:00
John McCall
b233e872dc Fix the type-checker's recursive value type checking.
Track the types we've seen instead of the type declarations we've
passed through, which eliminates some holes relating to generic types.
Detect infinite expansions by imposing an arbitrary limit.

Fixes rdar://30355804
2017-04-12 15:55:45 -04:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Michael Gottesman
b95a34a797 Add a new utility called reverse_range(start, end) that returns a reverse range from (start, end]. 2017-01-03 17:01:20 -08:00
Michael Gottesman
3fae2be5b6 Format doxygen comment correctly. 2017-01-03 17:01:19 -08:00
Michael Gottesman
35edd1364a [gardening] Remove unneeded implementations of none_of/count_if/count.
These are now provided upstream by LLVM.
2016-12-04 03:50:00 -08:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Dan Raviv
29d76f3b68 Canonize swift header files headers and footers
- Added missing ifdef guard in PointerIntEnum header
- Consistent naming convention for ifdef guards
- Consistent 'end namespace swift'
- Consistent single EOL at end of header files
2016-03-23 09:04:12 +02:00
Michael Gottesman
ef6ff01fd8 Use perfect forwarding on the Predicate passed into none_of/count_if.
This ensures that if one wishes to pass an std::moved, std::function into the
functions, one can do that.
2016-03-08 15:07:27 -08:00
Michael Gottesman
5f72810ad3 Add a range adaptor for std::count and update various trivial usages in the compiler to use this API instead. 2016-03-08 14:58:13 -08:00
Michael Gottesman
6f64082bc5 Clean up count_if/none in STLExtras.
Specifically this change:

1. Changed the input collection to be a const T & instead of T.
2. The return type of count_if is now properly the difference_type of the input range's iterators.
2016-03-08 14:00:24 -08:00
Michael Gottesman
28d63479ba Use upstream versions of the any_of/all_of range adapters now that they are in LLVM's STLExtras. 2016-02-06 11:22:26 -08:00
practicalswift
1339b5403b Consistent use of header comment format.
Correct format:
//===--- Name of file - Description ----------------------------*- Lang -*-===//
2016-01-04 13:26:31 +01:00
Michael Gottesman
389238e801 Add support for multiple @_semantics attributes at the SIL level.
This is something that we have wanted for a long time and will enable us to
remove some hacks from the compiler (i.e. how we determine in the ARC optimizer
that we have "fatalError" like function) and also express new things like
"noarc".
2016-01-02 04:17:07 -06:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Michael Gottesman
1b784bc8b0 Add a python like range(...) function that enables easy, concise creations of IntRanges.
Now one can do something like:

  for (unsigned i : range(9)) {
    ...
  }

This will cause one to iterate over [0, 9). Or one can do this:

  for (unsigned i : range(start, end)) {
    ...
  }
2015-12-09 14:40:26 -08:00
Michael Gottesman
f7db1c1e13 Add adaptors for std::{any_of,all_of,none_of} for ranges. 2015-11-02 16:06:29 -08:00
Michael Gottesman
ca8d27e737 Add in EnumeratorRange<T> and swift::enumerate().
This commit provides an enumerator that yields both the index of an element in a
random access collection and the index itself. This is useful when one wants the
post order and or rpo number of an element and the element itself.

Swift SVN r32102
2015-09-20 22:41:12 +00:00
Michael Gottesman
216eaeb7bd Add operator-- support for IntRange. This enables one to perform the operation reverse(indices(Collection)) and get a reverse order of indices.
Swift SVN r31551
2015-08-28 02:50:10 +00:00
Dmitri Hrybenko
37a4335b88 Replace swift::Range with llvm::iterator_range
Due to inreased use of llvm::make_range in LLVM headers and ADL for
types defined in the swift namespace, some of the LLVM headers started
to trigger ambiguity errors between llvm::make_range and
swift::make_range.

Swift SVN r29700
2015-06-25 22:01:39 +00:00
Michael Gottesman
aaab6d4668 When emitting sorted SIL, emit BBs in RPOT order.
This makes it easier to diff and read SIL output. Since it is behind the -emit-sorted-sil
flag, there is no effect on normal compilation.

Swift SVN r26101
2015-03-13 15:56:26 +00:00
Dmitri Hrybenko
fbfed25468 Qualify call to make_range to avoid ambiguity between {swift,llvm}::make_range
Swift SVN r16204
2014-04-11 09:06:54 +00:00
John McCall
d715c2c7de Provide a simple IntRange class as well as an 'indices'
function for getting the indices of a vector or array.

Swift SVN r10049
2013-11-08 20:51:05 +00:00
Joe Groff
c0a44f71c9 IRGen: Reify SpecializeInst thunks.
Teach IRGen how to emit thunks for SpecializeInsts that aren't immediately called and actually get used as values. This allows generic function instance to get passed around as values (again), and is a step along the way to making closures in generic contexts work (so we can specialize the local function, then partially apply its specialized context).

This doesn't work yet if we specialize to local archetypes--SIL needs to learn that we need a [thick]-typed thunk for local archetype specializations, in order to pack the metadata and wtables for the local type variables.

Swift SVN r5083
2013-05-07 23:39:06 +00:00
Joe Groff
bfd2f85b5c Parse 'fallthrough' statements.
Create a new FallthroughStmt, which transfers control from a 'case' or 'default' block to the next 'case' or 'default' block within a switch. Implement parsing and sema for FallthroughStmt, which syntactically consists of a single 'fallthrough' keyword. Sema verifies that 'fallthrough' actually appears inside a switch statement and that there is a following case or default block to pass control to.

SILGen/IRGen support forthcoming.

Swift SVN r4653
2013-04-10 17:30:42 +00:00
Joe Groff
b105e02534 IRGen: Lower SIL bb arguments to LLVM phi nodes.
Swift SVN r4493
2013-03-27 17:07:17 +00:00
John McCall
2bf56a3a2e Add a Range type which just bundles two iterators together and
lets you iterate that.

Swift SVN r4463
2013-03-21 05:29:16 +00:00