mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Break "NSUTF16" as "NSUTF, 16", not "NSUT, F16".
Previously, this declaration:
typedef NS_OPTIONS(NSUInteger, NSABitmapFormat5) {
NSAA16d,
NSAB32d,
};
...would import with members .A16d and .B32d, which is not necessarily
correct. (Is it "NS_AA_16d", or "NSA_A_16d"?) Be more conservative here.
Swift SVN r17125
This commit is contained in:
@@ -59,7 +59,7 @@ void WordIterator::computeNextPosition() const {
|
||||
// If we hit the end of the string, that's it. Otherwise, this
|
||||
// word ends at the last uppercase letter, so that the next word
|
||||
// starts with the last uppercase letter.
|
||||
NextPosition = i == n? i : i-1;
|
||||
NextPosition = (i == n || !clang::isLowercase(String[i])) ? i : i-1;
|
||||
NextPositionValid = true;
|
||||
return;
|
||||
}
|
||||
@@ -86,7 +86,7 @@ void WordIterator::computePrevPosition() const {
|
||||
// If we hit the beginning of the string, that's it. Otherwise,
|
||||
// this word starts at the uppercase letter that terminated the
|
||||
// search above.
|
||||
PrevPosition = i == 0 ? 0 : i-1;
|
||||
PrevPosition = (i == 0 || !clang::isLowercase(String[i])) ? i : i-1;
|
||||
PrevPositionValid = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "swift/AST/Stmt.h"
|
||||
#include "swift/AST/Types.h"
|
||||
#include "swift/ClangImporter/ClangModule.h"
|
||||
#include "swift/Parse/Lexer.h"
|
||||
#include "clang/AST/ASTContext.h"
|
||||
#include "clang/AST/Attr.h"
|
||||
#include "clang/AST/DeclVisitor.h"
|
||||
@@ -319,13 +320,22 @@ static StringRef getCommonWordPrefix(StringRef a, StringRef b) {
|
||||
auto aI = aWords.begin(), aE = aWords.end(),
|
||||
bI = bWords.begin(), bE = bWords.end();
|
||||
|
||||
unsigned prevLength = 0;
|
||||
unsigned prefixLength = 0;
|
||||
for ( ; aI != aE && bI != bE; ++aI, ++bI) {
|
||||
if (*aI != *bI)
|
||||
break;
|
||||
|
||||
prevLength = prefixLength;
|
||||
prefixLength = aI.getPosition() + aI->size();
|
||||
}
|
||||
|
||||
// Avoid creating a prefix where the rest of the string starts with a number.
|
||||
if ((aI != aE && !Lexer::isIdentifier(*aI)) ||
|
||||
(bI != bE && !Lexer::isIdentifier(*bI))) {
|
||||
prefixLength = prevLength;
|
||||
}
|
||||
|
||||
return a.slice(0, prefixLength);
|
||||
}
|
||||
|
||||
|
||||
@@ -245,6 +245,17 @@ typedef NS_OPTIONS(NSUInteger, NSBitmapFormat) {
|
||||
NS32BitBigEndianBitmapFormat /*NS_ENUM_AVAILABLE_MAC(10_10)*/ = (1 << 11)
|
||||
};
|
||||
|
||||
typedef NS_OPTIONS(NSUInteger, NSBitmapFormatReversed) {
|
||||
NS16BitLittleEndianBitmapFormatR /*NS_ENUM_AVAILABLE_MAC(10_10)*/ = (1 << 8),
|
||||
NS32BitLittleEndianBitmapFormatR /*NS_ENUM_AVAILABLE_MAC(10_10)*/ = (1 << 9),
|
||||
NS16BitBigEndianBitmapFormatR /*NS_ENUM_AVAILABLE_MAC(10_10)*/ = (1 << 10),
|
||||
NS32BitBigEndianBitmapFormatR /*NS_ENUM_AVAILABLE_MAC(10_10)*/ = (1 << 11),
|
||||
|
||||
NSAlphaFirstBitmapFormatR = 1 << 0, // 0 means is alpha last (RGBA, CMYKA, etc.)
|
||||
NSAlphaNonpremultipliedBitmapFormatR = 1 << 1, // 0 means is premultiplied
|
||||
NSFloatingPointSamplesBitmapFormatR = 1 << 2, // 0 is integer
|
||||
};
|
||||
|
||||
typedef NS_OPTIONS(NSUInteger, NSBitmapFormat2) {
|
||||
NSU16a,
|
||||
NSU32a,
|
||||
@@ -262,6 +273,11 @@ typedef NS_OPTIONS(NSUInteger, NSUBitmapFormat4) {
|
||||
NSU32c,
|
||||
};
|
||||
|
||||
typedef NS_OPTIONS(NSUInteger, NSABitmapFormat5) {
|
||||
NSAA16d,
|
||||
NSAB32d,
|
||||
};
|
||||
|
||||
|
||||
@protocol NSWobbling
|
||||
-(void)wobble;
|
||||
|
||||
Reference in New Issue
Block a user