@@ -473,7 +473,8 @@ void ASTContext::setLazyResolver(LazyResolver *resolver) {
473
473
// / specified string.
474
474
Identifier ASTContext::getIdentifier (StringRef Str) const {
475
475
// Make sure null pointers stay null.
476
- if (Str.data () == nullptr ) return Identifier (0 );
476
+ if (Str.data () == nullptr )
477
+ return Identifier (nullptr );
477
478
478
479
auto I = Impl.IdentifierTable .insert (std::make_pair (Str, char ())).first ;
479
480
return Identifier (I->getKeyData ());
@@ -2421,7 +2422,7 @@ Type ErrorType::get(Type originalType) {
2421
2422
BuiltinIntegerType *BuiltinIntegerType::get (BuiltinIntegerWidth BitWidth,
2422
2423
const ASTContext &C) {
2423
2424
BuiltinIntegerType *&Result = C.Impl .IntegerTypes [BitWidth];
2424
- if (Result == 0 )
2425
+ if (Result == nullptr )
2425
2426
Result = new (C, AllocationArena::Permanent) BuiltinIntegerType (BitWidth,C);
2426
2427
return Result;
2427
2428
}
@@ -2451,7 +2452,7 @@ ParenType *ParenType::get(const ASTContext &C, Type underlying,
2451
2452
auto arena = getArena (properties);
2452
2453
ParenType *&Result =
2453
2454
C.Impl .getArena (arena).ParenTypes [{underlying, flags.toRaw ()}];
2454
- if (Result == 0 ) {
2455
+ if (Result == nullptr ) {
2455
2456
Result = new (C, arena) ParenType (underlying, properties, flags);
2456
2457
}
2457
2458
return Result;
@@ -2485,8 +2486,7 @@ Type TupleType::get(ArrayRef<TupleTypeElt> Fields, const ASTContext &C) {
2485
2486
2486
2487
auto arena = getArena (properties);
2487
2488
2488
-
2489
- void *InsertPos = 0 ;
2489
+ void *InsertPos = nullptr ;
2490
2490
// Check to see if we've already seen this tuple before.
2491
2491
llvm::FoldingSetNodeID ID;
2492
2492
TupleType::Profile (ID, Fields);
@@ -2509,8 +2509,8 @@ Type TupleType::get(ArrayRef<TupleTypeElt> Fields, const ASTContext &C) {
2509
2509
2510
2510
Fields = ArrayRef<TupleTypeElt>(FieldsCopy, Fields.size ());
2511
2511
2512
- TupleType *New = new (C, arena) TupleType (Fields, IsCanonical ? &C : 0 ,
2513
- properties);
2512
+ TupleType *New =
2513
+ new (C, arena) TupleType (Fields, IsCanonical ? &C : nullptr , properties);
2514
2514
C.Impl .getArena (arena).TupleTypes .InsertNode (New, InsertPos);
2515
2515
return New;
2516
2516
}
@@ -2525,7 +2525,7 @@ UnboundGenericType *UnboundGenericType::
2525
2525
get (GenericTypeDecl *TheDecl, Type Parent, const ASTContext &C) {
2526
2526
llvm::FoldingSetNodeID ID;
2527
2527
UnboundGenericType::Profile (ID, TheDecl, Parent);
2528
- void *InsertPos = 0 ;
2528
+ void *InsertPos = nullptr ;
2529
2529
RecursiveTypeProperties properties;
2530
2530
if (Parent) properties |= Parent->getRecursiveProperties ();
2531
2531
auto arena = getArena (properties);
@@ -2581,7 +2581,7 @@ BoundGenericType *BoundGenericType::get(NominalTypeDecl *TheDecl,
2581
2581
2582
2582
auto arena = getArena (properties);
2583
2583
2584
- void *InsertPos = 0 ;
2584
+ void *InsertPos = nullptr ;
2585
2585
if (BoundGenericType *BGT =
2586
2586
C.Impl .getArena (arena).BoundGenericTypes .FindNodeOrInsertPos (ID,
2587
2587
InsertPos))
@@ -2600,18 +2600,15 @@ BoundGenericType *BoundGenericType::get(NominalTypeDecl *TheDecl,
2600
2600
2601
2601
BoundGenericType *newType;
2602
2602
if (auto theClass = dyn_cast<ClassDecl>(TheDecl)) {
2603
- newType = new (C, arena) BoundGenericClassType (theClass, Parent, ArgsCopy,
2604
- IsCanonical ? &C : 0 ,
2605
- properties);
2603
+ newType = new (C, arena) BoundGenericClassType (
2604
+ theClass, Parent, ArgsCopy, IsCanonical ? &C : nullptr , properties);
2606
2605
} else if (auto theStruct = dyn_cast<StructDecl>(TheDecl)) {
2607
- newType = new (C, arena) BoundGenericStructType (theStruct, Parent, ArgsCopy,
2608
- IsCanonical ? &C : 0 ,
2609
- properties);
2606
+ newType = new (C, arena) BoundGenericStructType (
2607
+ theStruct, Parent, ArgsCopy, IsCanonical ? &C : nullptr , properties);
2610
2608
} else {
2611
2609
auto theEnum = cast<EnumDecl>(TheDecl);
2612
- newType = new (C, arena) BoundGenericEnumType (theEnum, Parent, ArgsCopy,
2613
- IsCanonical ? &C : 0 ,
2614
- properties);
2610
+ newType = new (C, arena) BoundGenericEnumType (
2611
+ theEnum, Parent, ArgsCopy, IsCanonical ? &C : nullptr , properties);
2615
2612
}
2616
2613
C.Impl .getArena (arena).BoundGenericTypes .InsertNode (newType, InsertPos);
2617
2614
@@ -2654,7 +2651,7 @@ EnumType *EnumType::get(EnumDecl *D, Type Parent, const ASTContext &C) {
2654
2651
if (Parent) properties |= Parent->getRecursiveProperties ();
2655
2652
auto arena = getArena (properties);
2656
2653
2657
- void *insertPos = 0 ;
2654
+ void *insertPos = nullptr ;
2658
2655
if (auto enumTy
2659
2656
= C.Impl .getArena (arena).EnumTypes .FindNodeOrInsertPos (id, insertPos))
2660
2657
return enumTy;
@@ -2681,7 +2678,7 @@ StructType *StructType::get(StructDecl *D, Type Parent, const ASTContext &C) {
2681
2678
if (Parent) properties |= Parent->getRecursiveProperties ();
2682
2679
auto arena = getArena (properties);
2683
2680
2684
- void *insertPos = 0 ;
2681
+ void *insertPos = nullptr ;
2685
2682
if (auto structTy
2686
2683
= C.Impl .getArena (arena).StructTypes .FindNodeOrInsertPos (id, insertPos))
2687
2684
return structTy;
@@ -2708,7 +2705,7 @@ ClassType *ClassType::get(ClassDecl *D, Type Parent, const ASTContext &C) {
2708
2705
if (Parent) properties |= Parent->getRecursiveProperties ();
2709
2706
auto arena = getArena (properties);
2710
2707
2711
- void *insertPos = 0 ;
2708
+ void *insertPos = nullptr ;
2712
2709
if (auto classTy
2713
2710
= C.Impl .getArena (arena).ClassTypes .FindNodeOrInsertPos (id, insertPos))
2714
2711
return classTy;
@@ -2726,7 +2723,7 @@ void ClassType::Profile(llvm::FoldingSetNodeID &ID, ClassDecl *D, Type Parent) {
2726
2723
ProtocolCompositionType *
2727
2724
ProtocolCompositionType::build (const ASTContext &C, ArrayRef<Type> Protocols) {
2728
2725
// Check to see if we've already seen this protocol composition before.
2729
- void *InsertPos = 0 ;
2726
+ void *InsertPos = nullptr ;
2730
2727
llvm::FoldingSetNodeID ID;
2731
2728
ProtocolCompositionType::Profile (ID, Protocols);
2732
2729
if (ProtocolCompositionType *Result
@@ -2764,19 +2761,16 @@ ReferenceStorageType *ReferenceStorageType::get(Type T, Ownership ownership,
2764
2761
switch (ownership) {
2765
2762
case Ownership::Strong: llvm_unreachable (" not possible" );
2766
2763
case Ownership::Unowned:
2767
- return entry =
2768
- new (C, arena) UnownedStorageType (T, T->isCanonical () ? &C : 0 ,
2769
- properties);
2764
+ return entry = new (C, arena) UnownedStorageType (
2765
+ T, T->isCanonical () ? &C : nullptr , properties);
2770
2766
case Ownership::Weak:
2771
2767
assert (T->getAnyOptionalObjectType () &&
2772
2768
" object of weak storage type is not optional" );
2773
- return entry =
2774
- new (C, arena) WeakStorageType (T, T->isCanonical () ? &C : 0 ,
2775
- properties);
2769
+ return entry = new (C, arena)
2770
+ WeakStorageType (T, T->isCanonical () ? &C : nullptr , properties);
2776
2771
case Ownership::Unmanaged:
2777
- return entry =
2778
- new (C, arena) UnmanagedStorageType (T, T->isCanonical () ? &C : 0 ,
2779
- properties);
2772
+ return entry = new (C, arena) UnmanagedStorageType (
2773
+ T, T->isCanonical () ? &C : nullptr , properties);
2780
2774
}
2781
2775
llvm_unreachable (" bad ownership" );
2782
2776
}
@@ -2807,9 +2801,8 @@ MetatypeType *MetatypeType::get(Type T, Optional<MetatypeRepresentation> Repr,
2807
2801
MetatypeType *&Entry = Ctx.Impl .getArena (arena).MetatypeTypes [{T, reprKey}];
2808
2802
if (Entry) return Entry;
2809
2803
2810
- return Entry = new (Ctx, arena) MetatypeType (T,
2811
- T->isCanonical () ? &Ctx : 0 ,
2812
- properties, Repr);
2804
+ return Entry = new (Ctx, arena) MetatypeType (
2805
+ T, T->isCanonical () ? &Ctx : nullptr , properties, Repr);
2813
2806
}
2814
2807
2815
2808
MetatypeType::MetatypeType (Type T, const ASTContext *C,
@@ -2833,9 +2826,8 @@ ExistentialMetatypeType::get(Type T, Optional<MetatypeRepresentation> repr,
2833
2826
auto &entry = ctx.Impl .getArena (arena).ExistentialMetatypeTypes [{T, reprKey}];
2834
2827
if (entry) return entry;
2835
2828
2836
- return entry = new (ctx, arena) ExistentialMetatypeType (T,
2837
- T->isCanonical () ? &ctx : 0 ,
2838
- properties, repr);
2829
+ return entry = new (ctx, arena) ExistentialMetatypeType (
2830
+ T, T->isCanonical () ? &ctx : nullptr , properties, repr);
2839
2831
}
2840
2832
2841
2833
ExistentialMetatypeType::ExistentialMetatypeType (Type T,
@@ -2945,14 +2937,11 @@ FunctionType *FunctionType::get(Type Input, Type Result,
2945
2937
FunctionType::FunctionType (Type input, Type output,
2946
2938
RecursiveTypeProperties properties,
2947
2939
const ExtInfo &Info)
2948
- : AnyFunctionType(TypeKind::Function,
2949
- (input->isCanonical () && output->isCanonical()) ?
2950
- &input->getASTContext() : 0,
2951
- input, output,
2952
- properties,
2953
- Info)
2954
- { }
2955
-
2940
+ : AnyFunctionType(TypeKind::Function,
2941
+ (input->isCanonical () && output->isCanonical())
2942
+ ? &input->getASTContext()
2943
+ : nullptr,
2944
+ input, output, properties, Info) {}
2956
2945
2957
2946
void GenericFunctionType::Profile (llvm::FoldingSetNodeID &ID,
2958
2947
GenericSignature *sig,
@@ -3298,7 +3287,7 @@ ProtocolType *ProtocolType::get(ProtocolDecl *D, const ASTContext &C) {
3298
3287
if (Parent) properties |= Parent->getRecursiveProperties ();
3299
3288
auto arena = getArena (properties);
3300
3289
3301
- void *insertPos = 0 ;
3290
+ void *insertPos = nullptr ;
3302
3291
if (auto protoTy
3303
3292
= C.Impl .getArena (arena).ProtocolTypes .FindNodeOrInsertPos (id, insertPos))
3304
3293
return protoTy;
0 commit comments