Commit Graph

22 Commits

Author SHA1 Message Date
Chris Lattner
b8596ffccb move the stdlib to the new syntax for @autoclosure attribute.
Swift SVN r24048
2014-12-20 00:16:36 +00:00
Dmitri Hrybenko
7fa402868d stdlib comments: remove a false statement that fatalError is a no-op
outside of debug mode

rdar://18614211

Swift SVN r22821
2014-10-17 23:37:35 +00:00
Doug Gregor
a54452f34c De-Gyb Assert.swift.gyb
Swift SVN r22140
2014-09-19 18:01:12 +00:00
Dmitri Hrybenko
142a32a944 stdlib/Assert: allow string interpolation in assertion messages
rdar://17248446


Swift SVN r20892
2014-08-01 13:44:38 +00:00
Dmitri Hrybenko
a79339ee8f stdlib/Assert: adopt new names for trapping functions:
assert() / assertionFailure() -- debug mode
precondition() / preconditionFailure() -- debug and release modes
fatalError() -- always traps


Swift SVN r20890
2014-08-01 10:22:23 +00:00
Dmitri Hrybenko
f75968d9cd stdlib: add a trap() function that traps in debug and release modes
rdar://17792445


Swift SVN r20620
2014-07-28 11:30:42 +00:00
Dmitri Hrybenko
ca07053adc stdlib: rename fatalError() to debugTrap()
Part of rdar://17792445


Swift SVN r20619
2014-07-28 11:14:52 +00:00
Dmitri Hrybenko
61e5cbb805 stdlib: coding style: don't hide 'public' at the end of line with attributes
Swift SVN r20394
2014-07-23 13:44:42 +00:00
Dmitri Hrybenko
d14f17beef Change 'getLogicValue()' into a property 'boolValue'; change
'getArrayBoundValue()' into a property 'arrayBoundValue'.

rdar://17156123


Swift SVN r20304
2014-07-22 12:08:10 +00:00
Chris Lattner
bc481f0fe1 implement <rdar://problem/16859927> remove the underscore in "auto_closure"
autoclosure is one work, not two.



Swift SVN r20253
2014-07-21 15:23:50 +00:00
Dave Abrahams
cbcf9aba21 s/LogicValueType/BooleanType/
We're moving toward using that protocol for straight-up Bool types

Swift SVN r19884
2014-07-12 18:58:18 +00:00
Dave Abrahams
6d1095f44e Protocol names end in "Type," "ible," or "able"
Mechanically add "Type" to the end of any protocol names that don't end
in "Type," "ible," or "able."  Also, drop "Type" from the end of any
associated type names, except for those of the *LiteralConvertible
protocols.

There are obvious improvements to make in some of these names, which can
be handled with separate commits.

Fixes <rdar://problem/17165920> Protocols `Integer` etc should get
uglier names.

Swift SVN r19883
2014-07-12 17:29:57 +00:00
Jordan Rose
da29f099f0 Update stdlib for accessibility modifiers becoming context-sensitive keywords.
Swift SVN r19672
2014-07-08 02:17:46 +00:00
Jordan Rose
cca27d02a0 Tag everything in the standard library with accessibility attributes.
Keep calm: remember that the standard library has many more public exports
than the average target, and that this contains ALL of them at once.
I also deliberately tried to tag nearly every top-level decl, even if that
was just to explicitly mark things @internal, to make sure I didn't miss
something.

This does export more than we might want to, mostly for protocol conformance
reasons, along with our simple-but-limiting typealias rule. I tried to also
mark things private where possible, but it's really going to be up to the
standard library owners to get this right. This is also only validated
against top-level access control; I haven't fully tested against member-level
access control yet, and none of our semantic restrictions are in place.

Along the way I also noticed bits of stdlib cruft; to keep this patch
understandable, I didn't change any of them.

Swift SVN r19145
2014-06-24 21:32:18 +00:00
Arnold Schwaighofer
93f871e5e3 Get rid of some control flow for precondition checks
We can use cond_fail instead of control flow and int_trap. This should help
avoid some control flow in release builds.

Swift SVN r18940
2014-06-16 23:44:30 +00:00
Dmitri Hrybenko
f51ebe8444 stdlib/Assert: fix typo in internal API name
Swift SVN r18436
2014-05-19 22:47:57 +00:00
Dmitri Hrybenko
bbc6a92a4c stdlib/Assert: don't print stdlib filename and line number in stdlib traps
rdar://16958193


Swift SVN r18431
2014-05-19 21:37:51 +00:00
Dmitri Hrybenko
432961f652 stdlib/Assert: extinguish \brief
Swift SVN r18215
2014-05-16 21:36:12 +00:00
Arnold Schwaighofer
da6d9152b6 Differentiate between user assertion and preconditions and the like
assert() and fatalError()
These functions are meant to be used in user code. They are enabled in debug
mode and disabled in release or fast mode.

_precondition() and _preconditionFailure()
These functions are meant to be used in library code to check preconditions at
the api boundry. They are enabled in debug mode (with a verbose message) and
release mode (trap). In fast mode they are disabled.

_debugPrecondition() and _debugPreconditionFailure()
These functions are meant to be used in library code to check preconditions that
are not neccesarily comprehensive for safety (UnsafePointer can be null or an
invalid pointer but we can't check both). They are enabled only in debug mode.

_sanityCheck() and _fatalError()
These are meant to be used for internal consistency checks. They are only
enabled when the library is build with -DSWIFT_STDLIB_INTERNAL_CHECKS=ON.

I modified the code in the standard library to the best of my judgement.

rdar://16477198

Swift SVN r18212
2014-05-16 20:49:54 +00:00
Arnold Schwaighofer
ddb874e045 Rename _isDebug and friends to _isDebugAssertConfiguration
Really we want those nullary functions be computed properties using enums.

  var _assertConfiguration : _AssertConfiguration {
    let assertConfig = Int32(Builtin.assert_configuration())
    if assertConfig == 0 {
      return .Debug
    }
    if assertConfig == 1 {
      return .Release
    }
    return .Fast
  }

  if _assertConfiguration == .Debug {
    _fatal_error_message("assertion failed", message, file, line)
  }

In my tests the enums were not optimized away. So for the short term leave
these functions as nullary functions.

Swift SVN r18211
2014-05-16 20:49:50 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Dmitri Hrybenko
29cebdf797 Splitting the standard library: step 1: move stdlib -> stdlib/core
Swift SVN r5864
2013-06-28 02:31:01 +00:00