diff options
| author | Andrew Wilkins <axwalk@gmail.com> | 2016-03-15 05:36:43 +0000 |
|---|---|---|
| committer | Andrew Wilkins <axwalk@gmail.com> | 2016-03-15 05:36:43 +0000 |
| commit | 6436a4abd7a2f3a60b230453295dba199d8a59c3 (patch) | |
| tree | 125aef80fc2cf46c5d1758a8ece1fde14e7b13fd /llgo/third_party/gofrontend/libgo/go/bytes/bytes.go | |
| parent | 36761bf92427846ce40fdd849615732c852e44dd (diff) | |
| download | bcm5719-llvm-6436a4abd7a2f3a60b230453295dba199d8a59c3.tar.gz bcm5719-llvm-6436a4abd7a2f3a60b230453295dba199d8a59c3.zip | |
[llgo] Roll gofrontend forward
Switch gofrontend to using go.googlesource.com, and
update to 81eb6a3f425b2158c67ee32c0cc973a72ce9d6be.
There are various changes required to update to the
go 1.5 runtime:
typemap.go is changed to accommodate the change in representation for equal/hash algorithms, and the removal of the zero value/type.
CMakeLists.txt is updated to add the build tree to the package search path, so internal packages, which are not installed, are found.
various files changes due to removal of __go_new_nopointers; the same change as in D11863, but with NoUnwindAttribute added to the added runtime functions which are called with "callOnly".
minor cleanups in ssa.go while investigating issues with unwinding/panic handling.
Differential Revisision: http://reviews.llvm.org/D15188
llvm-svn: 263536
Diffstat (limited to 'llgo/third_party/gofrontend/libgo/go/bytes/bytes.go')
| -rw-r--r-- | llgo/third_party/gofrontend/libgo/go/bytes/bytes.go | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/llgo/third_party/gofrontend/libgo/go/bytes/bytes.go b/llgo/third_party/gofrontend/libgo/go/bytes/bytes.go index 7634707b3cb..b86824087e5 100644 --- a/llgo/third_party/gofrontend/libgo/go/bytes/bytes.go +++ b/llgo/third_party/gofrontend/libgo/go/bytes/bytes.go @@ -23,7 +23,7 @@ func equalPortable(a, b []byte) bool { return true } -// explode splits s into a slice of UTF-8 sequences, one per Unicode character (still slices of bytes), +// explode splits s into a slice of UTF-8 sequences, one per Unicode code point (still slices of bytes), // up to a maximum of n byte slices. Invalid UTF-8 sequences are chopped into individual bytes. func explode(s []byte, n int) [][]byte { if n <= 0 { @@ -47,6 +47,7 @@ func explode(s []byte, n int) [][]byte { } // Count counts the number of non-overlapping instances of sep in s. +// If sep is an empty slice, Count returns 1 + the number of Unicode code points in s. func Count(s, sep []byte) int { n := len(sep) if n == 0 { @@ -137,6 +138,16 @@ func LastIndex(s, sep []byte) int { return -1 } +// LastIndexByte returns the index of the last instance of c in s, or -1 if c is not present in s. +func LastIndexByte(s []byte, c byte) int { + for i := len(s) - 1; i >= 0; i-- { + if s[i] == c { + return i + } + } + return -1 +} + // IndexRune interprets s as a sequence of UTF-8-encoded Unicode code points. // It returns the byte index of the first occurrence in s of the given rune. // It returns -1 if rune is not present in s. @@ -442,7 +453,7 @@ func isSeparator(r rune) bool { // Title returns a copy of s with all Unicode letters that begin words // mapped to their title case. // -// BUG: The rule Title uses for word boundaries does not handle Unicode punctuation properly. +// BUG(rsc): The rule Title uses for word boundaries does not handle Unicode punctuation properly. func Title(s []byte) []byte { // Use a closure here to remember state. // Hackish but effective. Depends on Map scanning in order and calling |

