Skip to content

Commit 304d8ca

Browse files
committed
Fix spacing, indentation, capitalization
1 parent 22d98a1 commit 304d8ca

File tree

3 files changed

+33
-35
lines changed

3 files changed

+33
-35
lines changed

lib/ClangImporter/ImportDecl.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,10 @@ getSwiftStdlibType(const clang::TypedefNameDecl *D,
312312

313313
case MappedCTypeKind::VaList:
314314

315-
if (ClangTypeSize != ClangCtx.getTypeSize(ClangCtx.VoidPtrTy)){
316-
if(ClangCtx.getTargetInfo().getBuiltinVaListKind() != clang::TargetInfo::AArch64ABIBuiltinVaList)
317-
return std::make_pair(Type(), "");
315+
if (ClangTypeSize != ClangCtx.getTypeSize(ClangCtx.VoidPtrTy)) {
316+
if (ClangCtx.getTargetInfo().getBuiltinVaListKind() !=
317+
clang::TargetInfo::AArch64ABIBuiltinVaList)
318+
return std::make_pair(Type(), "");
318319
}
319320

320321
break;

stdlib/public/core/CTypes.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,7 @@ extension UInt {
227227
}
228228
}
229229

230-
#if arch(arm64) && !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS))
231-
230+
#if arch(arm64) && !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(Windows))
232231
@_fixed_layout
233232
public struct CVaListPointer {
234233
@_versioned // FIXME(sil-serialize-all)
@@ -270,7 +269,6 @@ extension CVaListPointer : CustomDebugStringConvertible {
270269
return value.debugDescription
271270
}
272271
}
273-
274272
#endif
275273

276274
@_versioned

stdlib/public/core/VarArgs.swift

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -86,28 +86,29 @@ internal let _countGPRegisters = 16
8686
@_versioned
8787
internal let _registerSaveWords = _countGPRegisters
8888

89-
#elseif arch(arm64)
89+
#elseif arch(arm64) && !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(Windows))
9090

91-
// ARM IHI 0055B
92-
// va_list may refer to any paramenter may be in one of three memory locations:
91+
// ARM Procedure Call Standard for aarch64. (IHI0055B)
92+
// The va_list type may refer to any parameter in a parameter list may be in one
93+
// of three memory locations depending on its type and position in the argument
94+
// list :
9395
// 1. GP register save area x0 - x7
9496
// 2. FP/SIMD register save area q0 - q7
9597
// 3. Stack argument area
96-
//
9798

9899
@_versioned
99100
internal let _countGPRegisters = 8
100101

101102
@_versioned
102103
internal let _countFPRegisters = 8
103104

104-
//128bit, 2 64bit word
105105
@_versioned
106-
internal let _fpRegisterWords = 2
106+
internal let _fpRegisterWords =
107+
MemoryLayout<Double>.size / MemoryLayout<Int>.size
107108

108109
@_versioned
109-
internal let _registerSaveWords = _countGPRegisters + (_countFPRegisters * _fpRegisterWords)
110-
110+
internal let _registerSaveWords =
111+
_countGPRegisters + (_countFPRegisters * _fpRegisterWords)
111112

112113
#endif
113114

@@ -491,20 +492,18 @@ final internal class _VaListBuilder {
491492
internal var storage: ContiguousArray<Int>
492493
}
493494

494-
#elseif arch(arm64) && !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS))
495-
495+
#elseif arch(arm64) && !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(Windows))
496496

497497
@_fixed_layout // FIXME(sil-serialize-all)
498498
@_versioned // FIXME(sil-serialize-all)
499499
final internal class _VaListBuilder {
500-
501500
@_inlineable // FIXME(sil-serialize-all)
502501
@_versioned // FIXME(sil-serialize-all)
503502
internal init() {
504-
// prepare the register save area
503+
// Prepare the register save area.
505504
allocated = _registerSaveWords
506505
storage = allocStorage(wordCount: allocated)
507-
// append stack arguments after register save area
506+
// Append stack arguments after register save area.
508507
count = allocated
509508
}
510509

@@ -523,21 +522,21 @@ final internal class _VaListBuilder {
523522

524523
if arg is _CVarArgPassedAsDouble
525524
&& fpRegistersUsed < _countFPRegisters {
526-
var startIndex = (fpRegistersUsed * _fpRegisterWords)
527-
for w in encoded {
528-
storage[startIndex] = w
529-
startIndex += 1
530-
}
531-
fpRegistersUsed += 1
532-
}else if encoded.count == 1
533-
&& !(arg is _CVarArgPassedAsDouble)
534-
&& gpRegistersUsed < _countGPRegisters {
535-
var startIndex = ( _fpRegisterWords * _countFPRegisters) + gpRegistersUsed
536-
storage[startIndex] = encoded[0]
537-
gpRegistersUsed += 1
538-
}else{
539-
//arguments in stack slot
540-
appendWords(encoded)
525+
var startIndex = (fpRegistersUsed * _fpRegisterWords)
526+
for w in encoded {
527+
storage[startIndex] = w
528+
startIndex += 1
529+
}
530+
fpRegistersUsed += 1
531+
} else if encoded.count == 1
532+
&& !(arg is _CVarArgPassedAsDouble)
533+
&& gpRegistersUsed < _countGPRegisters {
534+
var startIndex = ( _fpRegisterWords * _countFPRegisters) + gpRegistersUsed
535+
storage[startIndex] = encoded[0]
536+
gpRegistersUsed += 1
537+
} else {
538+
// Arguments in stack slot.
539+
appendWords(encoded)
541540
}
542541
}
543542

@@ -563,7 +562,7 @@ final internal class _VaListBuilder {
563562
allocated = max(newCount, allocated * 2)
564563
let newStorage = allocStorage(wordCount: allocated)
565564
storage = newStorage
566-
// count is updated below
565+
// Count is updated below.
567566

568567
if let allocatedOldStorage = oldStorage {
569568
newStorage.moveInitialize(from: allocatedOldStorage, count: oldCount)

0 commit comments

Comments
 (0)