From ebdd5265291b27377112db0b1749c1b475065eeb Mon Sep 17 00:00:00 2001 From: Leo Shimonaka Date: Fri, 4 Dec 2015 21:10:29 -0500 Subject: [PATCH 01/10] Fix spelling error in documentation / comments while reading source. No code change (shouldn't break anything) --- docs/proposals/OptimizerEffects.rst | 4 ++-- docs/proposals/containers_value_type.html | 2 +- docs/proposals/valref.rst | 2 +- include/swift/Parse/Lexer.h | 2 +- include/swift/SILAnalysis/LoopRegionAnalysis.h | 2 +- lib/IRGen/GenDecl.cpp | 2 +- lib/IRGen/IRGenDebugInfo.h | 2 +- lib/SILPasses/ARC/GlobalARCPairingAnalysis.h | 2 +- lib/SILPasses/IPO/CapturePromotion.cpp | 2 +- lib/SILPasses/Loop/ArrayBoundsCheckOpts.cpp | 1 + lib/SILPasses/Loop/COWArrayOpt.cpp | 2 +- lib/Sema/CSDiag.cpp | 2 +- lib/Sema/ConstraintSystem.h | 1 + lib/Serialization/DeserializeSIL.cpp | 2 +- stdlib/public/stubs/Stubs.cpp | 2 +- utils/benchmark/Richards/richards.swift | 2 +- 16 files changed, 17 insertions(+), 15 deletions(-) diff --git a/docs/proposals/OptimizerEffects.rst b/docs/proposals/OptimizerEffects.rst index ae4ec5ded155f..62cda039cbca8 100644 --- a/docs/proposals/OptimizerEffects.rst +++ b/docs/proposals/OptimizerEffects.rst @@ -20,7 +20,7 @@ Introduction This document formalizes the effects that functions have on program state for the purpose of facilitating compiler optimization. By modeling more precise function effects, the optimizer can make more -assumptions leading to more agressive transformation of the program. +assumptions leading to more aggressive transformation of the program. Function effects may be deduced by the compiler during program analyis. However, in certain situations it is helpful to directly @@ -919,5 +919,5 @@ Generally, a default-safe policy provides a much better user model from some effects. For example, we could decide that functions cannot affect unspecified state by default. If the user accesses globals, they then need to annotate their function. However, default safety -dictates that any neccessary annotations should be introduced before +dictates that any necessary annotations should be introduced before declaring API stability. diff --git a/docs/proposals/containers_value_type.html b/docs/proposals/containers_value_type.html index 6599a83cc84c0..ff7855e29e464 100644 --- a/docs/proposals/containers_value_type.html +++ b/docs/proposals/containers_value_type.html @@ -347,7 +347,7 @@

archives is an in-out argument. And just as importantly, that archivePath is not to be modified within _checkPathForArchiveAndAddToArray. However if -archivePath is a mutable object with reference semantics, we loose +archivePath is a mutable object with reference semantics, we lose that ability to locally reason about this code, even in Swift.

diff --git a/docs/proposals/valref.rst b/docs/proposals/valref.rst index 6266129ffd804..0d69d0f82e6ba 100644 --- a/docs/proposals/valref.rst +++ b/docs/proposals/valref.rst @@ -150,7 +150,7 @@ Instance variables can be explicitly declared ``val`` or ``ref``:: When a value is copied, all of its instance variables declared ``val`` (implicitly or explicitly) are copied. Instance variables declared ``ref`` merely have their reference counts incremented (i.e. the -refrence is copied). Therefore, when the defaults are in play, the +reference is copied). Therefore, when the defaults are in play, the semantic rules already defined for Swift are preserved. The new rules are as follows: diff --git a/include/swift/Parse/Lexer.h b/include/swift/Parse/Lexer.h index b1b01802b9092..f6f4afa4d7abe 100644 --- a/include/swift/Parse/Lexer.h +++ b/include/swift/Parse/Lexer.h @@ -241,7 +241,7 @@ class Lexer { } /// \brief Retrieve the source location that points just past the - /// end of the token refered to by \c Loc. + /// end of the token referred to by \c Loc. /// /// \param SM The source manager in which the given source location /// resides. diff --git a/include/swift/SILAnalysis/LoopRegionAnalysis.h b/include/swift/SILAnalysis/LoopRegionAnalysis.h index 12207027fc995..0ed4474564b83 100644 --- a/include/swift/SILAnalysis/LoopRegionAnalysis.h +++ b/include/swift/SILAnalysis/LoopRegionAnalysis.h @@ -395,7 +395,7 @@ class LoopRegion { llvm::SmallVector Subregions; /// A map from RPO number of a subregion loop's preheader to a subloop - /// regions id. This is neccessary since we represent a loop in the + /// regions id. This is necessary since we represent a loop in the /// Subregions array by the RPO number of its header. llvm::SmallVector, 2> Subloops; diff --git a/lib/IRGen/GenDecl.cpp b/lib/IRGen/GenDecl.cpp index e98663f08961f..6500ca64798d7 100644 --- a/lib/IRGen/GenDecl.cpp +++ b/lib/IRGen/GenDecl.cpp @@ -743,7 +743,7 @@ void IRGenModuleDispatcher::emitGlobalTopLevel() { } void IRGenModule::finishEmitAfterTopLevel() { - // Emit the implicit import of the swift standard libary. + // Emit the implicit import of the swift standard library. if (DebugInfo) { std::pair AccessPath[] = { { Context.StdlibModuleName, swift::SourceLoc() } diff --git a/lib/IRGen/IRGenDebugInfo.h b/lib/IRGen/IRGenDebugInfo.h index 51521bccb33de..611a24c3c00d1 100644 --- a/lib/IRGen/IRGenDebugInfo.h +++ b/lib/IRGen/IRGenDebugInfo.h @@ -100,7 +100,7 @@ class IRGenDebugInfo { Location LastDebugLoc; /// The last location that was emitted. const SILDebugScope *LastScope; /// The scope of that last location. - bool IsLibrary; /// Whether this is a libary or a top level module. + bool IsLibrary; /// Whether this is a library or a top level module. #ifndef NDEBUG /// The basic block where the location was last changed. llvm::BasicBlock *LastBasicBlock; diff --git a/lib/SILPasses/ARC/GlobalARCPairingAnalysis.h b/lib/SILPasses/ARC/GlobalARCPairingAnalysis.h index fe7a63a01b13d..3bc6a5b4644f1 100644 --- a/lib/SILPasses/ARC/GlobalARCPairingAnalysis.h +++ b/lib/SILPasses/ARC/GlobalARCPairingAnalysis.h @@ -43,7 +43,7 @@ struct ARCMatchingSet { llvm::SetVector Increments; /// An insertion point for an increment means the earliest point in the - /// program after the increment has occured that the increment can be moved to + /// program after the increment has occurred that the increment can be moved to /// without moving the increment over an instruction that may decrement a /// reference count. llvm::SetVector IncrementInsertPts; diff --git a/lib/SILPasses/IPO/CapturePromotion.cpp b/lib/SILPasses/IPO/CapturePromotion.cpp index cdb534283db52..b23d091768a31 100644 --- a/lib/SILPasses/IPO/CapturePromotion.cpp +++ b/lib/SILPasses/IPO/CapturePromotion.cpp @@ -257,7 +257,7 @@ void ReachabilityInfo::compute() { if (!Changed) { // If we have not detected a change yet, then calculate new // reachabilities into a new bit vector so we can determine if any - // change has occured. + // change has occurred. NewSet = CurSet; for (auto PI = BB.pred_begin(), PE = BB.pred_end(); PI != PE; ++PI) { unsigned PredID = BlockMap[*PI]; diff --git a/lib/SILPasses/Loop/ArrayBoundsCheckOpts.cpp b/lib/SILPasses/Loop/ArrayBoundsCheckOpts.cpp index 47a9d5e3c4ed0..be25df5bb53b6 100644 --- a/lib/SILPasses/Loop/ArrayBoundsCheckOpts.cpp +++ b/lib/SILPasses/Loop/ArrayBoundsCheckOpts.cpp @@ -1070,6 +1070,7 @@ static bool hoistBoundsChecks(SILLoop *Loop, DominanceInfo *DT, SILLoopInfo *LI, auto *Preheader = Loop->getLoopPreheader(); if (!Preheader) { // TODO: create one if neccessary. + // TODO: create one if necessary. return false; } diff --git a/lib/SILPasses/Loop/COWArrayOpt.cpp b/lib/SILPasses/Loop/COWArrayOpt.cpp index 5584d7c770f42..4a44a5df89dfe 100644 --- a/lib/SILPasses/Loop/COWArrayOpt.cpp +++ b/lib/SILPasses/Loop/COWArrayOpt.cpp @@ -2235,7 +2235,7 @@ void ArrayPropertiesSpecializer::specializeLoopNest() { auto *CheckBlock = splitBasicBlockAndBranch(B, HoistableLoopPreheader->getTerminator(), DomTree, nullptr); - // Get the exit blocks of the orignal loop. + // Get the exit blocks of the original loop. auto *Header = CheckBlock->getSingleSuccessor(); assert(Header); diff --git a/lib/Sema/CSDiag.cpp b/lib/Sema/CSDiag.cpp index ffa25b0bb118b..0a23a1b6d0902 100644 --- a/lib/Sema/CSDiag.cpp +++ b/lib/Sema/CSDiag.cpp @@ -2252,7 +2252,7 @@ diagnoseUnviableLookupResults(MemberLookupResult &result, Type baseObjTy, return; } -// In the absense of a better conversion constraint failure, point out the +// In the absence of a better conversion constraint failure, point out the // inability to find an appropriate overload. bool FailureDiagnosis::diagnoseGeneralOverloadFailure(Constraint *constraint) { Constraint *bindOverload = constraint; diff --git a/lib/Sema/ConstraintSystem.h b/lib/Sema/ConstraintSystem.h index 510a05f37433f..fc3995dd1d3b0 100644 --- a/lib/Sema/ConstraintSystem.h +++ b/lib/Sema/ConstraintSystem.h @@ -1146,6 +1146,7 @@ class ConstraintSystem { Constraint *failedConstraint = nullptr; /// \brief Failures that occured while solving. + /// \brief Failures that occurred while solving. /// /// FIXME: We really need to track overload sets and type variable bindings /// to make any sense of this data. Also, it probably belongs within diff --git a/lib/Serialization/DeserializeSIL.cpp b/lib/Serialization/DeserializeSIL.cpp index e94c411697285..abad107aa5bb2 100644 --- a/lib/Serialization/DeserializeSIL.cpp +++ b/lib/Serialization/DeserializeSIL.cpp @@ -538,7 +538,7 @@ SILFunction *SILDeserializer::readSILFunction(DeclID FID, // If CurrentBB is empty, just return fn. The code in readSILInstruction // assumes that such a situation means that fn is a declaration. Thus it // is using return false to mean two different things, error a failure - // occured and this is a declaration. Work around that for now. + // occurred and this is a declaration. Work around that for now. if (!CurrentBB) return fn; diff --git a/stdlib/public/stubs/Stubs.cpp b/stdlib/public/stubs/Stubs.cpp index c1307fd12ee17..3dabfad3a09ff 100644 --- a/stdlib/public/stubs/Stubs.cpp +++ b/stdlib/public/stubs/Stubs.cpp @@ -186,7 +186,7 @@ extern "C" uint64_t swift_float80ToString(char *Buffer, size_t BufferLength, /// line. Can be NULL if no characters were read. /// /// \returns Size of character data returned in \c LinePtr, or -1 -/// if an error occured, or EOF was reached. +/// if an error occurred, or EOF was reached. extern "C" ssize_t swift_stdlib_readLine_stdin(char **LinePtr) { size_t Capacity = 0; return getline(LinePtr, &Capacity, stdin); diff --git a/utils/benchmark/Richards/richards.swift b/utils/benchmark/Richards/richards.swift index b5349b0da5602..55518ac0d2fdc 100644 --- a/utils/benchmark/Richards/richards.swift +++ b/utils/benchmark/Richards/richards.swift @@ -339,7 +339,7 @@ struct Richards { if v2.count == 0 { return holdself() } - // Orignal C impl masks with MAXINT. Why? + // Original C impl masks with MAXINT. Why? if (v1.taskid & 1) == 0 { v1 = Task.Val1.TaskID(v1.taskid >> 1) return release(TIDevA) From b270e7e3909b089f292634809a312aeb3469ecbb Mon Sep 17 00:00:00 2001 From: Leo Shimonaka Date: Fri, 4 Dec 2015 21:27:58 -0500 Subject: [PATCH 02/10] Fix method names: 2 occurrences of "occured" --- include/swift/SIL/Dominance.h | 4 ++-- lib/SIL/Dominance.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/swift/SIL/Dominance.h b/include/swift/SIL/Dominance.h index 03a1b307e1136..a98cee032c69f 100644 --- a/include/swift/SIL/Dominance.h +++ b/include/swift/SIL/Dominance.h @@ -41,7 +41,7 @@ class DominanceInfo : public llvm::DominatorTreeBase { /// Return true if the other dominator tree does not match this dominator /// tree. - inline bool errorOccuredOnComparison(const DominanceInfo &Other) const { + inline bool errorOccurredOnComparison(const DominanceInfo &Other) const { const auto *R = getRootNode(); const auto *OtherR = Other.getRootNode(); @@ -131,7 +131,7 @@ class PostDominanceInfo : public llvm::DominatorTreeBase { /// Return true if the other dominator tree does not match this dominator /// tree. - inline bool errorOccuredOnComparison(const PostDominanceInfo &Other) const { + inline bool errorOccurredOnComparison(const PostDominanceInfo &Other) const { const auto *R = getRootNode(); const auto *OtherR = Other.getRootNode(); diff --git a/lib/SIL/Dominance.cpp b/lib/SIL/Dominance.cpp index 907b928f0dc6d..15901cdddafe3 100644 --- a/lib/SIL/Dominance.cpp +++ b/lib/SIL/Dominance.cpp @@ -55,7 +55,7 @@ void DominanceInfo::verify() const { DominanceInfo OtherDT(F); // And compare. - if (errorOccuredOnComparison(OtherDT)) { + if (errorOccurredOnComparison(OtherDT)) { llvm::errs() << "DominatorTree is not up to date!\nComputed:\n"; print(llvm::errs()); llvm::errs() << "\nActual:\n"; From be7097b7fa514a5192df2c573d1cb643d9a5af3c Mon Sep 17 00:00:00 2001 From: Leo Shimonaka Date: Fri, 4 Dec 2015 21:37:26 -0500 Subject: [PATCH 03/10] Oops, missed one. Fix build failure --- lib/SIL/Dominance.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/SIL/Dominance.cpp b/lib/SIL/Dominance.cpp index 15901cdddafe3..7fe21ac8750e8 100644 --- a/lib/SIL/Dominance.cpp +++ b/lib/SIL/Dominance.cpp @@ -102,7 +102,7 @@ void PostDominanceInfo::verify() const { PostDominanceInfo OtherDT(F); // And compare. - if (errorOccuredOnComparison(OtherDT)) { + if (errorOccurredOnComparison(OtherDT)) { llvm::errs() << "PostDominatorTree is not up to date!\nComputed:\n"; print(llvm::errs()); llvm::errs() << "\nActual:\n"; From 2992de71c2b46f33079f70668276d2b216aa2429 Mon Sep 17 00:00:00 2001 From: Leo Shimonaka Date: Fri, 4 Dec 2015 22:04:06 -0500 Subject: [PATCH 04/10] Re-commit ones ST missed --- lib/SILPasses/Loop/ArrayBoundsCheckOpts.cpp | 2 +- lib/Sema/ConstraintSystem.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/SILPasses/Loop/ArrayBoundsCheckOpts.cpp b/lib/SILPasses/Loop/ArrayBoundsCheckOpts.cpp index be25df5bb53b6..3adbbfa71df36 100644 --- a/lib/SILPasses/Loop/ArrayBoundsCheckOpts.cpp +++ b/lib/SILPasses/Loop/ArrayBoundsCheckOpts.cpp @@ -1069,8 +1069,8 @@ static bool hoistBoundsChecks(SILLoop *Loop, DominanceInfo *DT, SILLoopInfo *LI, auto *Preheader = Loop->getLoopPreheader(); if (!Preheader) { - // TODO: create one if neccessary. // TODO: create one if necessary. + return false; } diff --git a/lib/Sema/ConstraintSystem.h b/lib/Sema/ConstraintSystem.h index fc3995dd1d3b0..1e5708d2ba4cb 100644 --- a/lib/Sema/ConstraintSystem.h +++ b/lib/Sema/ConstraintSystem.h @@ -1145,7 +1145,6 @@ class ConstraintSystem { Constraint *failedConstraint = nullptr; - /// \brief Failures that occured while solving. /// \brief Failures that occurred while solving. /// /// FIXME: We really need to track overload sets and type variable bindings From f8fe71bfae3a8020d7f7e23d995920c4c5e85c12 Mon Sep 17 00:00:00 2001 From: Leo Shimonaka Date: Fri, 4 Dec 2015 23:18:16 -0500 Subject: [PATCH 05/10] Remove newline --- lib/SILPasses/Loop/ArrayBoundsCheckOpts.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/SILPasses/Loop/ArrayBoundsCheckOpts.cpp b/lib/SILPasses/Loop/ArrayBoundsCheckOpts.cpp index 3adbbfa71df36..5f4bb296a464c 100644 --- a/lib/SILPasses/Loop/ArrayBoundsCheckOpts.cpp +++ b/lib/SILPasses/Loop/ArrayBoundsCheckOpts.cpp @@ -1070,7 +1070,6 @@ static bool hoistBoundsChecks(SILLoop *Loop, DominanceInfo *DT, SILLoopInfo *LI, auto *Preheader = Loop->getLoopPreheader(); if (!Preheader) { // TODO: create one if necessary. - return false; } From 2cf5d542e6453b7f28c7ae2ff39e92c487942a7d Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Fri, 4 Dec 2015 14:06:18 +0100 Subject: [PATCH 06/10] Don't rely on cmark internals The cmark_node struct and the node.h header are private. --- lib/Markup/Markup.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/lib/Markup/Markup.cpp b/lib/Markup/Markup.cpp index 985e526116191..b49e2a5b98ad1 100644 --- a/lib/Markup/Markup.cpp +++ b/lib/Markup/Markup.cpp @@ -16,7 +16,6 @@ #include "swift/Markup/LineList.h" #include "swift/Markup/Markup.h" #include "cmark.h" -#include "node.h" using namespace llvm; using namespace markup; @@ -60,15 +59,7 @@ StringRef getLiteralContent(MarkupContext &MC, LineList &LL, cmark_node *Node) { // its parent. auto Literal = cmark_node_get_literal(Node); assert(Literal != nullptr); - size_t Length = 0; - switch (cmark_node_get_type(Node)) { - case CMARK_NODE_CODE_BLOCK: - Length = Node->as.code.literal.len; - break; - default: - Length = Node->as.literal.len; - } - return MC.allocateCopy(StringRef(Literal, Length)); + return MC.allocateCopy(StringRef(Literal)); } ParseResult From 3c54a6e73cf796a5764495a9a8e9ec75add9fc74 Mon Sep 17 00:00:00 2001 From: Jordan Rose Date: Fri, 4 Dec 2015 18:36:04 -0800 Subject: [PATCH 07/10] [test] Add a Radar to the tests I disabled in f869e9e6. I filed this under Radar rather than bugs.swift.org because it's /only/ our CI system that's failing, and external contributors have no insight into that anyway. Hopefully I'll be able to get to the bottom of this soon. --- test/Driver/environment.swift | 1 + test/Driver/options-interpreter.swift | 1 + 2 files changed, 2 insertions(+) diff --git a/test/Driver/environment.swift b/test/Driver/environment.swift index 04938cf1a5226..b891e1a6a07da 100644 --- a/test/Driver/environment.swift +++ b/test/Driver/environment.swift @@ -1,4 +1,5 @@ // FIXME: This is failing on some of Apple's internal CI. +// FIXME: Fix test/Driver/{environment.swift,options-interpreter.swift} // REQUIRES: disabled // RUN: %swift_driver -target x86_64-apple-macosx10.9 -L/foo/ -driver-use-frontend-path %S/Inputs/print-var.sh %s DYLD_LIBRARY_PATH | FileCheck %s diff --git a/test/Driver/options-interpreter.swift b/test/Driver/options-interpreter.swift index 690c7e8f3cde6..d7cd351b40b50 100644 --- a/test/Driver/options-interpreter.swift +++ b/test/Driver/options-interpreter.swift @@ -1,4 +1,5 @@ // FIXME: This is failing on some of Apple's internal CI. +// FIXME: Fix test/Driver/{environment.swift,options-interpreter.swift} // REQUIRES: disabled // RUN: not %swift_driver -deprecated-integrated-repl -emit-module 2>&1 | FileCheck -check-prefix=IMMEDIATE_NO_MODULE %s From ee2d390fc44592ac9f92c1f410b5b426684f2168 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Fri, 4 Dec 2015 18:40:46 -0800 Subject: [PATCH 08/10] Runtime: Reinstate _stdlib_demangleName hook. This is needed for Xcode support, even though it appeared dead within the Swift repo itself. --- stdlib/public/core/Misc.swift | 24 ++++++++++++++++++++++++ stdlib/public/runtime/Reflection.mm | 14 ++++++++++++++ test/1_stdlib/Runtime.swift | 10 ++++++++++ 3 files changed, 48 insertions(+) diff --git a/stdlib/public/core/Misc.swift b/stdlib/public/core/Misc.swift index 51ad4203b7064..6a2eb92828522 100644 --- a/stdlib/public/core/Misc.swift +++ b/stdlib/public/core/Misc.swift @@ -83,6 +83,30 @@ func _typeName(type: Any.Type, qualified: Bool = true) -> String { input: UnsafeBufferPointer(start: stringPtr, count: count)) } +@warn_unused_result +@_silgen_name("swift_stdlib_demangleName") +func _stdlib_demangleNameImpl( + mangledName: UnsafePointer, + _ mangledNameLength: UInt, + _ demangledName: UnsafeMutablePointer) + +// NB: This function is not used directly in the Swift codebase, but is +// exported for Xcode support. Please coordinate before changing. +@warn_unused_result +public // @testable +func _stdlib_demangleName(mangledName: String) -> String { + let mangledNameUTF8 = Array(mangledName.utf8) + return mangledNameUTF8.withUnsafeBufferPointer { + (mangledNameUTF8) in + let (_, demangledName) = _withUninitializedString { + _stdlib_demangleNameImpl( + mangledNameUTF8.baseAddress, UInt(mangledNameUTF8.endIndex), + $0) + } + return demangledName + } +} + /// Returns `floor(log(x))`. This equals to the position of the most /// significant non-zero bit, or 63 - number-of-zeros before it. /// diff --git a/stdlib/public/runtime/Reflection.mm b/stdlib/public/runtime/Reflection.mm index 245a0938cf2f4..dcc722a6f4bb6 100644 --- a/stdlib/public/runtime/Reflection.mm +++ b/stdlib/public/runtime/Reflection.mm @@ -1264,3 +1264,17 @@ static Mirror ObjC_getMirrorForSuperclass(Class sup, T->vw_destroy(value); return MirrorReturn(result); } + +// NB: This function is not used directly in the Swift codebase, but is +// exported for Xcode support. Please coordinate before changing. +extern "C" void swift_stdlib_demangleName(const char *mangledName, + size_t mangledNameLength, + String *demangledName) { + auto options = Demangle::DemangleOptions(); + options.DisplayDebuggerGeneratedModule = false; + auto result = + Demangle::demangleSymbolAsString(mangledName, + mangledNameLength, + options); + new (demangledName) String(result.data(), result.size()); +} diff --git a/test/1_stdlib/Runtime.swift b/test/1_stdlib/Runtime.swift index 3c4dfd450ce8d..2c78916f78581 100644 --- a/test/1_stdlib/Runtime.swift +++ b/test/1_stdlib/Runtime.swift @@ -665,6 +665,16 @@ Runtime.test("typeName") { expectEqual("protocol<>.Protocol", _typeName(a.dynamicType)) } +Runtime.test("demangleName") { + expectEqual("", _stdlib_demangleName("")) + expectEqual("abc", _stdlib_demangleName("abc")) + expectEqual("\0", _stdlib_demangleName("\0")) + expectEqual("Swift.Double", _stdlib_demangleName("_TtSd")) + expectEqual("x.a : x.Foo, x.Foo>, x.Foo, x.Foo>>", + _stdlib_demangleName("_Tv1x1aGCS_3FooGS0_GS0_SiSi_GS0_SiSi__GS0_GS0_SiSi_GS0_SiSi___")) + expectEqual("Foobar", _stdlib_demangleName("_TtC13__lldb_expr_46Foobar")) +} + Runtime.test("_stdlib_atomicCompareExchangeStrongPtr") { typealias IntPtr = UnsafeMutablePointer var origP1 = IntPtr(bitPattern: 0x10101010) From a75fb69259eac8458d4fd6fbb918791a1637a728 Mon Sep 17 00:00:00 2001 From: Rob Hudson Date: Fri, 4 Dec 2015 22:48:17 -0500 Subject: [PATCH 09/10] Fix typo --- stdlib/public/core/String.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/public/core/String.swift b/stdlib/public/core/String.swift index 8169af68829cd..057b49c85c327 100644 --- a/stdlib/public/core/String.swift +++ b/stdlib/public/core/String.swift @@ -102,7 +102,7 @@ import SwiftShims /// any sequence of mutating operations causes elements to be copied /// into unique, contiguous storage which may cost `O(N)` time and /// space, where `N` is the length of the string representation (or -/// more, if the underlying `NSString` is has unusual performance +/// more, if the underlying `NSString` has unusual performance /// characteristics). public struct String { /// An empty `String`. From 70e66973eee61b563df83b0deed59475f3ef8ef2 Mon Sep 17 00:00:00 2001 From: Leo Shimonaka Date: Fri, 4 Dec 2015 23:18:16 -0500 Subject: [PATCH 10/10] Fix spelling error in documentation / comments / method name --- docs/proposals/OptimizerEffects.rst | 4 ++-- docs/proposals/containers_value_type.html | 2 +- docs/proposals/valref.rst | 2 +- include/swift/Parse/Lexer.h | 2 +- include/swift/SIL/Dominance.h | 4 ++-- include/swift/SILAnalysis/LoopRegionAnalysis.h | 2 +- lib/IRGen/GenDecl.cpp | 2 +- lib/IRGen/IRGenDebugInfo.h | 2 +- lib/SIL/Dominance.cpp | 4 ++-- lib/SILPasses/ARC/GlobalARCPairingAnalysis.h | 2 +- lib/SILPasses/IPO/CapturePromotion.cpp | 2 +- lib/SILPasses/Loop/ArrayBoundsCheckOpts.cpp | 2 +- lib/SILPasses/Loop/COWArrayOpt.cpp | 2 +- lib/Sema/CSDiag.cpp | 2 +- lib/Sema/ConstraintSystem.h | 2 +- lib/Serialization/DeserializeSIL.cpp | 2 +- stdlib/public/stubs/Stubs.cpp | 2 +- utils/benchmark/Richards/richards.swift | 2 +- 18 files changed, 21 insertions(+), 21 deletions(-) diff --git a/docs/proposals/OptimizerEffects.rst b/docs/proposals/OptimizerEffects.rst index ae4ec5ded155f..62cda039cbca8 100644 --- a/docs/proposals/OptimizerEffects.rst +++ b/docs/proposals/OptimizerEffects.rst @@ -20,7 +20,7 @@ Introduction This document formalizes the effects that functions have on program state for the purpose of facilitating compiler optimization. By modeling more precise function effects, the optimizer can make more -assumptions leading to more agressive transformation of the program. +assumptions leading to more aggressive transformation of the program. Function effects may be deduced by the compiler during program analyis. However, in certain situations it is helpful to directly @@ -919,5 +919,5 @@ Generally, a default-safe policy provides a much better user model from some effects. For example, we could decide that functions cannot affect unspecified state by default. If the user accesses globals, they then need to annotate their function. However, default safety -dictates that any neccessary annotations should be introduced before +dictates that any necessary annotations should be introduced before declaring API stability. diff --git a/docs/proposals/containers_value_type.html b/docs/proposals/containers_value_type.html index 6599a83cc84c0..ff7855e29e464 100644 --- a/docs/proposals/containers_value_type.html +++ b/docs/proposals/containers_value_type.html @@ -347,7 +347,7 @@

archives is an in-out argument. And just as importantly, that archivePath is not to be modified within _checkPathForArchiveAndAddToArray. However if -archivePath is a mutable object with reference semantics, we loose +archivePath is a mutable object with reference semantics, we lose that ability to locally reason about this code, even in Swift.

diff --git a/docs/proposals/valref.rst b/docs/proposals/valref.rst index 6266129ffd804..0d69d0f82e6ba 100644 --- a/docs/proposals/valref.rst +++ b/docs/proposals/valref.rst @@ -150,7 +150,7 @@ Instance variables can be explicitly declared ``val`` or ``ref``:: When a value is copied, all of its instance variables declared ``val`` (implicitly or explicitly) are copied. Instance variables declared ``ref`` merely have their reference counts incremented (i.e. the -refrence is copied). Therefore, when the defaults are in play, the +reference is copied). Therefore, when the defaults are in play, the semantic rules already defined for Swift are preserved. The new rules are as follows: diff --git a/include/swift/Parse/Lexer.h b/include/swift/Parse/Lexer.h index b1b01802b9092..f6f4afa4d7abe 100644 --- a/include/swift/Parse/Lexer.h +++ b/include/swift/Parse/Lexer.h @@ -241,7 +241,7 @@ class Lexer { } /// \brief Retrieve the source location that points just past the - /// end of the token refered to by \c Loc. + /// end of the token referred to by \c Loc. /// /// \param SM The source manager in which the given source location /// resides. diff --git a/include/swift/SIL/Dominance.h b/include/swift/SIL/Dominance.h index 03a1b307e1136..a98cee032c69f 100644 --- a/include/swift/SIL/Dominance.h +++ b/include/swift/SIL/Dominance.h @@ -41,7 +41,7 @@ class DominanceInfo : public llvm::DominatorTreeBase { /// Return true if the other dominator tree does not match this dominator /// tree. - inline bool errorOccuredOnComparison(const DominanceInfo &Other) const { + inline bool errorOccurredOnComparison(const DominanceInfo &Other) const { const auto *R = getRootNode(); const auto *OtherR = Other.getRootNode(); @@ -131,7 +131,7 @@ class PostDominanceInfo : public llvm::DominatorTreeBase { /// Return true if the other dominator tree does not match this dominator /// tree. - inline bool errorOccuredOnComparison(const PostDominanceInfo &Other) const { + inline bool errorOccurredOnComparison(const PostDominanceInfo &Other) const { const auto *R = getRootNode(); const auto *OtherR = Other.getRootNode(); diff --git a/include/swift/SILAnalysis/LoopRegionAnalysis.h b/include/swift/SILAnalysis/LoopRegionAnalysis.h index 12207027fc995..0ed4474564b83 100644 --- a/include/swift/SILAnalysis/LoopRegionAnalysis.h +++ b/include/swift/SILAnalysis/LoopRegionAnalysis.h @@ -395,7 +395,7 @@ class LoopRegion { llvm::SmallVector Subregions; /// A map from RPO number of a subregion loop's preheader to a subloop - /// regions id. This is neccessary since we represent a loop in the + /// regions id. This is necessary since we represent a loop in the /// Subregions array by the RPO number of its header. llvm::SmallVector, 2> Subloops; diff --git a/lib/IRGen/GenDecl.cpp b/lib/IRGen/GenDecl.cpp index e98663f08961f..6500ca64798d7 100644 --- a/lib/IRGen/GenDecl.cpp +++ b/lib/IRGen/GenDecl.cpp @@ -743,7 +743,7 @@ void IRGenModuleDispatcher::emitGlobalTopLevel() { } void IRGenModule::finishEmitAfterTopLevel() { - // Emit the implicit import of the swift standard libary. + // Emit the implicit import of the swift standard library. if (DebugInfo) { std::pair AccessPath[] = { { Context.StdlibModuleName, swift::SourceLoc() } diff --git a/lib/IRGen/IRGenDebugInfo.h b/lib/IRGen/IRGenDebugInfo.h index 51521bccb33de..611a24c3c00d1 100644 --- a/lib/IRGen/IRGenDebugInfo.h +++ b/lib/IRGen/IRGenDebugInfo.h @@ -100,7 +100,7 @@ class IRGenDebugInfo { Location LastDebugLoc; /// The last location that was emitted. const SILDebugScope *LastScope; /// The scope of that last location. - bool IsLibrary; /// Whether this is a libary or a top level module. + bool IsLibrary; /// Whether this is a library or a top level module. #ifndef NDEBUG /// The basic block where the location was last changed. llvm::BasicBlock *LastBasicBlock; diff --git a/lib/SIL/Dominance.cpp b/lib/SIL/Dominance.cpp index 907b928f0dc6d..7fe21ac8750e8 100644 --- a/lib/SIL/Dominance.cpp +++ b/lib/SIL/Dominance.cpp @@ -55,7 +55,7 @@ void DominanceInfo::verify() const { DominanceInfo OtherDT(F); // And compare. - if (errorOccuredOnComparison(OtherDT)) { + if (errorOccurredOnComparison(OtherDT)) { llvm::errs() << "DominatorTree is not up to date!\nComputed:\n"; print(llvm::errs()); llvm::errs() << "\nActual:\n"; @@ -102,7 +102,7 @@ void PostDominanceInfo::verify() const { PostDominanceInfo OtherDT(F); // And compare. - if (errorOccuredOnComparison(OtherDT)) { + if (errorOccurredOnComparison(OtherDT)) { llvm::errs() << "PostDominatorTree is not up to date!\nComputed:\n"; print(llvm::errs()); llvm::errs() << "\nActual:\n"; diff --git a/lib/SILPasses/ARC/GlobalARCPairingAnalysis.h b/lib/SILPasses/ARC/GlobalARCPairingAnalysis.h index fe7a63a01b13d..3bc6a5b4644f1 100644 --- a/lib/SILPasses/ARC/GlobalARCPairingAnalysis.h +++ b/lib/SILPasses/ARC/GlobalARCPairingAnalysis.h @@ -43,7 +43,7 @@ struct ARCMatchingSet { llvm::SetVector Increments; /// An insertion point for an increment means the earliest point in the - /// program after the increment has occured that the increment can be moved to + /// program after the increment has occurred that the increment can be moved to /// without moving the increment over an instruction that may decrement a /// reference count. llvm::SetVector IncrementInsertPts; diff --git a/lib/SILPasses/IPO/CapturePromotion.cpp b/lib/SILPasses/IPO/CapturePromotion.cpp index cdb534283db52..b23d091768a31 100644 --- a/lib/SILPasses/IPO/CapturePromotion.cpp +++ b/lib/SILPasses/IPO/CapturePromotion.cpp @@ -257,7 +257,7 @@ void ReachabilityInfo::compute() { if (!Changed) { // If we have not detected a change yet, then calculate new // reachabilities into a new bit vector so we can determine if any - // change has occured. + // change has occurred. NewSet = CurSet; for (auto PI = BB.pred_begin(), PE = BB.pred_end(); PI != PE; ++PI) { unsigned PredID = BlockMap[*PI]; diff --git a/lib/SILPasses/Loop/ArrayBoundsCheckOpts.cpp b/lib/SILPasses/Loop/ArrayBoundsCheckOpts.cpp index 47a9d5e3c4ed0..5f4bb296a464c 100644 --- a/lib/SILPasses/Loop/ArrayBoundsCheckOpts.cpp +++ b/lib/SILPasses/Loop/ArrayBoundsCheckOpts.cpp @@ -1069,7 +1069,7 @@ static bool hoistBoundsChecks(SILLoop *Loop, DominanceInfo *DT, SILLoopInfo *LI, auto *Preheader = Loop->getLoopPreheader(); if (!Preheader) { - // TODO: create one if neccessary. + // TODO: create one if necessary. return false; } diff --git a/lib/SILPasses/Loop/COWArrayOpt.cpp b/lib/SILPasses/Loop/COWArrayOpt.cpp index 5584d7c770f42..4a44a5df89dfe 100644 --- a/lib/SILPasses/Loop/COWArrayOpt.cpp +++ b/lib/SILPasses/Loop/COWArrayOpt.cpp @@ -2235,7 +2235,7 @@ void ArrayPropertiesSpecializer::specializeLoopNest() { auto *CheckBlock = splitBasicBlockAndBranch(B, HoistableLoopPreheader->getTerminator(), DomTree, nullptr); - // Get the exit blocks of the orignal loop. + // Get the exit blocks of the original loop. auto *Header = CheckBlock->getSingleSuccessor(); assert(Header); diff --git a/lib/Sema/CSDiag.cpp b/lib/Sema/CSDiag.cpp index ffa25b0bb118b..0a23a1b6d0902 100644 --- a/lib/Sema/CSDiag.cpp +++ b/lib/Sema/CSDiag.cpp @@ -2252,7 +2252,7 @@ diagnoseUnviableLookupResults(MemberLookupResult &result, Type baseObjTy, return; } -// In the absense of a better conversion constraint failure, point out the +// In the absence of a better conversion constraint failure, point out the // inability to find an appropriate overload. bool FailureDiagnosis::diagnoseGeneralOverloadFailure(Constraint *constraint) { Constraint *bindOverload = constraint; diff --git a/lib/Sema/ConstraintSystem.h b/lib/Sema/ConstraintSystem.h index 510a05f37433f..1e5708d2ba4cb 100644 --- a/lib/Sema/ConstraintSystem.h +++ b/lib/Sema/ConstraintSystem.h @@ -1145,7 +1145,7 @@ class ConstraintSystem { Constraint *failedConstraint = nullptr; - /// \brief Failures that occured while solving. + /// \brief Failures that occurred while solving. /// /// FIXME: We really need to track overload sets and type variable bindings /// to make any sense of this data. Also, it probably belongs within diff --git a/lib/Serialization/DeserializeSIL.cpp b/lib/Serialization/DeserializeSIL.cpp index e94c411697285..abad107aa5bb2 100644 --- a/lib/Serialization/DeserializeSIL.cpp +++ b/lib/Serialization/DeserializeSIL.cpp @@ -538,7 +538,7 @@ SILFunction *SILDeserializer::readSILFunction(DeclID FID, // If CurrentBB is empty, just return fn. The code in readSILInstruction // assumes that such a situation means that fn is a declaration. Thus it // is using return false to mean two different things, error a failure - // occured and this is a declaration. Work around that for now. + // occurred and this is a declaration. Work around that for now. if (!CurrentBB) return fn; diff --git a/stdlib/public/stubs/Stubs.cpp b/stdlib/public/stubs/Stubs.cpp index c1307fd12ee17..3dabfad3a09ff 100644 --- a/stdlib/public/stubs/Stubs.cpp +++ b/stdlib/public/stubs/Stubs.cpp @@ -186,7 +186,7 @@ extern "C" uint64_t swift_float80ToString(char *Buffer, size_t BufferLength, /// line. Can be NULL if no characters were read. /// /// \returns Size of character data returned in \c LinePtr, or -1 -/// if an error occured, or EOF was reached. +/// if an error occurred, or EOF was reached. extern "C" ssize_t swift_stdlib_readLine_stdin(char **LinePtr) { size_t Capacity = 0; return getline(LinePtr, &Capacity, stdin); diff --git a/utils/benchmark/Richards/richards.swift b/utils/benchmark/Richards/richards.swift index b5349b0da5602..55518ac0d2fdc 100644 --- a/utils/benchmark/Richards/richards.swift +++ b/utils/benchmark/Richards/richards.swift @@ -339,7 +339,7 @@ struct Richards { if v2.count == 0 { return holdself() } - // Orignal C impl masks with MAXINT. Why? + // Original C impl masks with MAXINT. Why? if (v1.taskid & 1) == 0 { v1 = Task.Val1.TaskID(v1.taskid >> 1) return release(TIDevA)