summaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExprObjC.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2014-05-26 06:22:03 +0000
committerCraig Topper <craig.topper@gmail.com>2014-05-26 06:22:03 +0000
commit6b8c5857eb9d309f9adb9149d9f383a29a9b68e7 (patch)
tree56e8b6db6892b13eea6e33509cb7751501b94409 /lib/Sema/SemaExprObjC.cpp
parentb0449def46f3e7efc8dd134ac68ce71399ba6573 (diff)
downloadclang-6b8c5857eb9d309f9adb9149d9f383a29a9b68e7.tar.gz
clang-6b8c5857eb9d309f9adb9149d9f383a29a9b68e7.tar.bz2
clang-6b8c5857eb9d309f9adb9149d9f383a29a9b68e7.tar.xz
[C++11] Use 'nullptr'. Sema edition.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209613 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExprObjC.cpp')
-rw-r--r--lib/Sema/SemaExprObjC.cpp171
1 files changed, 90 insertions, 81 deletions
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp
index bf8af29377..d9e2828ca2 100644
--- a/lib/Sema/SemaExprObjC.cpp
+++ b/lib/Sema/SemaExprObjC.cpp
@@ -93,7 +93,7 @@ ExprResult Sema::BuildObjCStringLiteral(SourceLocation AtLoc, StringLiteral *S){
if (!Ty.isNull()) {
Ty = Context.getObjCObjectPointerType(Ty);
} else if (getLangOpts().NoConstantCFStrings) {
- IdentifierInfo *NSIdent=0;
+ IdentifierInfo *NSIdent=nullptr;
std::string StringClass(getLangOpts().ObjCConstantStringClass);
if (StringClass.empty())
@@ -133,7 +133,7 @@ ExprResult Sema::BuildObjCStringLiteral(SourceLocation AtLoc, StringLiteral *S){
ObjCInterfaceDecl::Create (Context,
Context.getTranslationUnitDecl(),
SourceLocation(), NSIdent,
- 0, SourceLocation());
+ nullptr, SourceLocation());
Ty = Context.getObjCInterfaceType(NSStringIDecl);
Context.setObjCNSStringType(Ty);
}
@@ -182,7 +182,7 @@ static ObjCMethodDecl *getNSNumberFactoryMethod(Sema &S, SourceLocation Loc,
S.Diag(Loc, diag::err_invalid_nsnumber_type)
<< NumberType << R;
}
- return 0;
+ return nullptr;
}
// If we already looked up this method, we're done.
@@ -208,15 +208,15 @@ static ObjCMethodDecl *getNSNumberFactoryMethod(Sema &S, SourceLocation Loc,
S.NSNumberDecl = ObjCInterfaceDecl::Create(CX,
CX.getTranslationUnitDecl(),
SourceLocation(), NSNumberId,
- 0, SourceLocation());
+ nullptr, SourceLocation());
} else {
// Otherwise, require a declaration of NSNumber.
S.Diag(Loc, diag::err_undeclared_nsnumber);
- return 0;
+ return nullptr;
}
} else if (!S.NSNumberDecl->hasDefinition()) {
S.Diag(Loc, diag::err_undeclared_nsnumber);
- return 0;
+ return nullptr;
}
// generate the pointer to NSNumber type.
@@ -228,7 +228,7 @@ static ObjCMethodDecl *getNSNumberFactoryMethod(Sema &S, SourceLocation Loc,
ObjCMethodDecl *Method = S.NSNumberDecl->lookupClassMethod(Sel);
if (!Method && S.getLangOpts().DebuggerObjCLiteral) {
// create a stub definition this NSNumber factory method.
- TypeSourceInfo *ReturnTInfo = 0;
+ TypeSourceInfo *ReturnTInfo = nullptr;
Method =
ObjCMethodDecl::Create(CX, SourceLocation(), SourceLocation(), Sel,
S.NSNumberPointer, ReturnTInfo, S.NSNumberDecl,
@@ -240,13 +240,13 @@ static ObjCMethodDecl *getNSNumberFactoryMethod(Sema &S, SourceLocation Loc,
ParmVarDecl *value = ParmVarDecl::Create(S.Context, Method,
SourceLocation(), SourceLocation(),
&CX.Idents.get("value"),
- NumberType, /*TInfo=*/0, SC_None,
- 0);
+ NumberType, /*TInfo=*/nullptr,
+ SC_None, nullptr);
Method->setMethodParams(S.Context, value, None);
}
if (!validateBoxingMethod(S, Loc, S.NSNumberDecl, Sel, Method))
- return 0;
+ return nullptr;
// Note: if the parameter type is out-of-line, we'll catch it later in the
// implicit conversion.
@@ -444,10 +444,10 @@ static ExprResult CheckObjCCollectionLiteralElement(Sema &S, Expr *Element,
ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
if (ValueExpr->isTypeDependent()) {
ObjCBoxedExpr *BoxedExpr =
- new (Context) ObjCBoxedExpr(ValueExpr, Context.DependentTy, NULL, SR);
+ new (Context) ObjCBoxedExpr(ValueExpr, Context.DependentTy, nullptr, SR);
return Owned(BoxedExpr);
}
- ObjCMethodDecl *BoxingMethod = NULL;
+ ObjCMethodDecl *BoxingMethod = nullptr;
QualType BoxedType;
// Convert the expression to an RValue, so we can check for pointer types...
ExprResult RValue = DefaultFunctionArrayLvalueConversion(ValueExpr);
@@ -473,7 +473,7 @@ ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
NSStringDecl = ObjCInterfaceDecl::Create(Context, TU,
SourceLocation(),
NSStringId,
- 0, SourceLocation());
+ nullptr, SourceLocation());
} else {
Diag(SR.getBegin(), diag::err_undeclared_nsstring);
return ExprError();
@@ -495,7 +495,7 @@ ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
BoxingMethod = NSStringDecl->lookupClassMethod(stringWithUTF8String);
if (!BoxingMethod && getLangOpts().DebuggerObjCLiteral) {
// Debugger needs to work even if NSString hasn't been defined.
- TypeSourceInfo *ReturnTInfo = 0;
+ TypeSourceInfo *ReturnTInfo = nullptr;
ObjCMethodDecl *M = ObjCMethodDecl::Create(
Context, SourceLocation(), SourceLocation(), stringWithUTF8String,
NSStringPointer, ReturnTInfo, NSStringDecl,
@@ -510,8 +510,8 @@ ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
SourceLocation(), SourceLocation(),
&Context.Idents.get("value"),
Context.getPointerType(ConstCharType),
- /*TInfo=*/0,
- SC_None, 0);
+ /*TInfo=*/nullptr,
+ SC_None, nullptr);
M->setMethodParams(Context, value, None);
BoxingMethod = M;
}
@@ -646,7 +646,7 @@ ExprResult Sema::BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements) {
Context.getTranslationUnitDecl(),
SourceLocation(),
NSAPIObj->getNSClassId(NSAPI::ClassId_NSArray),
- 0, SourceLocation());
+ nullptr, SourceLocation());
if (!NSArrayDecl) {
Diag(SR.getBegin(), diag::err_undeclared_nsarray);
@@ -661,7 +661,7 @@ ExprResult Sema::BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements) {
Sel = NSAPIObj->getNSArraySelector(NSAPI::NSArr_arrayWithObjectsCount);
ObjCMethodDecl *Method = NSArrayDecl->lookupClassMethod(Sel);
if (!Method && getLangOpts().DebuggerObjCLiteral) {
- TypeSourceInfo *ReturnTInfo = 0;
+ TypeSourceInfo *ReturnTInfo = nullptr;
Method = ObjCMethodDecl::Create(
Context, SourceLocation(), SourceLocation(), Sel, IdT, ReturnTInfo,
Context.getTranslationUnitDecl(), false /*Instance*/,
@@ -675,14 +675,16 @@ ExprResult Sema::BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements) {
SourceLocation(),
&Context.Idents.get("objects"),
Context.getPointerType(IdT),
- /*TInfo=*/0, SC_None, 0);
+ /*TInfo=*/nullptr,
+ SC_None, nullptr);
Params.push_back(objects);
ParmVarDecl *cnt = ParmVarDecl::Create(Context, Method,
SourceLocation(),
SourceLocation(),
&Context.Idents.get("cnt"),
Context.UnsignedLongTy,
- /*TInfo=*/0, SC_None, 0);
+ /*TInfo=*/nullptr, SC_None,
+ nullptr);
Params.push_back(cnt);
Method->setMethodParams(Context, Params, None);
}
@@ -759,7 +761,7 @@ ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR,
Context.getTranslationUnitDecl(),
SourceLocation(),
NSAPIObj->getNSClassId(NSAPI::ClassId_NSDictionary),
- 0, SourceLocation());
+ nullptr, SourceLocation());
if (!NSDictionaryDecl) {
Diag(SR.getBegin(), diag::err_undeclared_nsdictionary);
@@ -778,7 +780,7 @@ ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR,
Method = ObjCMethodDecl::Create(Context,
SourceLocation(), SourceLocation(), Sel,
IdT,
- 0 /*TypeSourceInfo */,
+ nullptr /*TypeSourceInfo */,
Context.getTranslationUnitDecl(),
false /*Instance*/, false/*isVariadic*/,
/*isPropertyAccessor=*/false,
@@ -791,21 +793,24 @@ ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR,
SourceLocation(),
&Context.Idents.get("objects"),
Context.getPointerType(IdT),
- /*TInfo=*/0, SC_None, 0);
+ /*TInfo=*/nullptr, SC_None,
+ nullptr);
Params.push_back(objects);
ParmVarDecl *keys = ParmVarDecl::Create(Context, Method,
SourceLocation(),
SourceLocation(),
&Context.Idents.get("keys"),
Context.getPointerType(IdT),
- /*TInfo=*/0, SC_None, 0);
+ /*TInfo=*/nullptr, SC_None,
+ nullptr);
Params.push_back(keys);
ParmVarDecl *cnt = ParmVarDecl::Create(Context, Method,
SourceLocation(),
SourceLocation(),
&Context.Idents.get("cnt"),
Context.UnsignedLongTy,
- /*TInfo=*/0, SC_None, 0);
+ /*TInfo=*/nullptr, SC_None,
+ nullptr);
Params.push_back(cnt);
Method->setMethodParams(Context, Params, None);
}
@@ -1115,7 +1120,7 @@ ObjCMethodDecl *Sema::tryCaptureObjCSelf(SourceLocation Loc) {
// still have a 'self', and we really do still need to capture it!
ObjCMethodDecl *method = dyn_cast<ObjCMethodDecl>(DC);
if (!method)
- return 0;
+ return nullptr;
tryCaptureVariable(method->getSelfDecl(), Loc);
@@ -1200,7 +1205,7 @@ findExplicitInstancetypeDeclarer(const ObjCMethodDecl *MD,
return result;
}
- return 0;
+ return nullptr;
}
void Sema::EmitRelatedResultTypeNoteForReturn(QualType destType) {
@@ -1407,7 +1412,7 @@ bool Sema::CheckMessageArgumentTypes(QualType ReceiverType,
continue;
ExprResult Arg = DefaultVariadicArgumentPromotion(Args[i], VariadicMethod,
- 0);
+ nullptr);
IsError |= Arg.isInvalid();
Args[i] = Arg.take();
}
@@ -1469,7 +1474,7 @@ ObjCMethodDecl *Sema::LookupMethodInObjectType(Selector sel, QualType type,
if (ObjCMethodDecl *method = I->lookupMethod(sel, isInstance))
return method;
- return 0;
+ return nullptr;
}
/// LookupMethodInQualifiedType - Lookups up a method in protocol qualifier
@@ -1478,13 +1483,13 @@ ObjCMethodDecl *Sema::LookupMethodInQualifiedType(Selector Sel,
const ObjCObjectPointerType *OPT,
bool Instance)
{
- ObjCMethodDecl *MD = 0;
+ ObjCMethodDecl *MD = nullptr;
for (const auto *PROTO : OPT->quals()) {
if ((MD = PROTO->lookupMethod(Sel, Instance))) {
return MD;
}
}
- return 0;
+ return nullptr;
}
static void DiagnoseARCUseOfWeakReceiver(Sema &S, Expr *Receiver) {
@@ -1497,8 +1502,8 @@ static void DiagnoseARCUseOfWeakReceiver(Sema &S, Expr *Receiver) {
Expr *RExpr = Receiver->IgnoreParenImpCasts();
SourceLocation Loc = RExpr->getLocStart();
QualType T = RExpr->getType();
- const ObjCPropertyDecl *PDecl = 0;
- const ObjCMethodDecl *GDecl = 0;
+ const ObjCPropertyDecl *PDecl = nullptr;
+ const ObjCMethodDecl *GDecl = nullptr;
if (PseudoObjectExpr *POE = dyn_cast<PseudoObjectExpr>(RExpr)) {
RExpr = POE->getSyntacticForm();
if (ObjCPropertyRefExpr *PRE = dyn_cast<ObjCPropertyRefExpr>(RExpr)) {
@@ -1669,8 +1674,8 @@ HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT,
// Attempt to correct for typos in property names.
DeclFilterCCC<ObjCPropertyDecl> Validator;
if (TypoCorrection Corrected = CorrectTypo(
- DeclarationNameInfo(MemberName, MemberLoc), LookupOrdinaryName, NULL,
- NULL, Validator, CTK_ErrorRecovery, IFace, false, OPT)) {
+ DeclarationNameInfo(MemberName, MemberLoc), LookupOrdinaryName,
+ nullptr, nullptr, Validator, CTK_ErrorRecovery, IFace, false, OPT)) {
diagnoseTypo(Corrected, PDiag(diag::err_property_not_found_suggest)
<< MemberName << QualType(OPT, 0));
DeclarationName TypoResult = Corrected.getCorrection();
@@ -1717,7 +1722,7 @@ ActOnClassPropertyRefExpr(IdentifierInfo &receiverName,
receiverNameLoc);
bool IsSuper = false;
- if (IFace == 0) {
+ if (!IFace) {
// If the "receiver" is 'super' in a method, handle it as an expression-like
// property reference.
if (receiverNamePtr->isStr("super")) {
@@ -1735,9 +1740,9 @@ ActOnClassPropertyRefExpr(IdentifierInfo &receiverName,
}
QualType T = Context.getObjCInterfaceType(Super);
T = Context.getObjCObjectPointerType(T);
-
+
return HandleExprPropertyRefExpr(T->getAsObjCInterfacePointerType(),
- /*BaseExpr*/0,
+ /*BaseExpr*/nullptr,
SourceLocation()/*OpLoc*/,
&propertyName,
propertyNameLoc,
@@ -1749,8 +1754,8 @@ ActOnClassPropertyRefExpr(IdentifierInfo &receiverName,
IFace = CurMethod->getClassInterface()->getSuperClass();
}
}
-
- if (IFace == 0) {
+
+ if (!IFace) {
Diag(receiverNameLoc, diag::err_expected_either) << tok::identifier
<< tok::l_paren;
return ExprError();
@@ -1902,8 +1907,8 @@ Sema::ObjCMessageKind Sema::getObjCMessageKind(Scope *S,
ObjCInterfaceOrSuperCCC Validator(getCurMethodDecl());
if (TypoCorrection Corrected =
CorrectTypo(Result.getLookupNameInfo(), Result.getLookupKind(), S,
- NULL, Validator, CTK_ErrorRecovery, NULL, false, NULL,
- false)) {
+ nullptr, Validator, CTK_ErrorRecovery, nullptr, false,
+ nullptr, false)) {
if (Corrected.isKeyword()) {
// If we've found the keyword "super" (the only keyword that would be
// returned by CorrectTypo), this is a send to super.
@@ -1966,16 +1971,16 @@ ExprResult Sema::ActOnSuperMessage(Scope *S,
// message to the superclass instance.
QualType SuperTy = Context.getObjCInterfaceType(Super);
SuperTy = Context.getObjCObjectPointerType(SuperTy);
- return BuildInstanceMessage(0, SuperTy, SuperLoc,
- Sel, /*Method=*/0,
+ return BuildInstanceMessage(nullptr, SuperTy, SuperLoc,
+ Sel, /*Method=*/nullptr,
LBracLoc, SelectorLocs, RBracLoc, Args);
}
// Since we are in a class method, this is a class message to
// the superclass.
- return BuildClassMessage(/*ReceiverTypeInfo=*/0,
+ return BuildClassMessage(/*ReceiverTypeInfo=*/nullptr,
Context.getObjCInterfaceType(Super),
- SuperLoc, Sel, /*Method=*/0,
+ SuperLoc, Sel, /*Method=*/nullptr,
LBracLoc, SelectorLocs, RBracLoc, Args);
}
@@ -1986,7 +1991,7 @@ ExprResult Sema::BuildClassMessageImplicit(QualType ReceiverType,
Selector Sel,
ObjCMethodDecl *Method,
MultiExprArg Args) {
- TypeSourceInfo *receiverTypeInfo = 0;
+ TypeSourceInfo *receiverTypeInfo = nullptr;
if (!ReceiverType.isNull())
receiverTypeInfo = Context.getTrivialTypeSourceInfo(ReceiverType);
@@ -2100,13 +2105,13 @@ ExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo,
assert(SuperLoc.isInvalid() && "Message to super with dependent type");
return Owned(ObjCMessageExpr::Create(Context, ReceiverType,
VK_RValue, LBracLoc, ReceiverTypeInfo,
- Sel, SelectorLocs, /*Method=*/0,
+ Sel, SelectorLocs, /*Method=*/nullptr,
makeArrayRef(Args, NumArgs),RBracLoc,
isImplicit));
}
// Find the class to which we are sending this message.
- ObjCInterfaceDecl *Class = 0;
+ ObjCInterfaceDecl *Class = nullptr;
const ObjCObjectType *ClassType = ReceiverType->getAs<ObjCObjectType>();
if (!ClassType || !(Class = ClassType->getInterface())) {
Diag(Loc, diag::err_invalid_receiver_class_message)
@@ -2202,8 +2207,9 @@ ExprResult Sema::ActOnClassMessage(Scope *S,
ReceiverTypeInfo = Context.getTrivialTypeSourceInfo(ReceiverType, LBracLoc);
return BuildClassMessage(ReceiverTypeInfo, ReceiverType,
- /*SuperLoc=*/SourceLocation(), Sel, /*Method=*/0,
- LBracLoc, SelectorLocs, RBracLoc, Args);
+ /*SuperLoc=*/SourceLocation(), Sel,
+ /*Method=*/nullptr, LBracLoc, SelectorLocs, RBracLoc,
+ Args);
}
ExprResult Sema::BuildInstanceMessageImplicit(Expr *Receiver,
@@ -2293,7 +2299,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
assert(SuperLoc.isInvalid() && "Message to super with dependent type");
return Owned(ObjCMessageExpr::Create(Context, Context.DependentTy,
VK_RValue, LBracLoc, Receiver, Sel,
- SelectorLocs, /*Method=*/0,
+ SelectorLocs, /*Method=*/nullptr,
makeArrayRef(Args, NumArgs),
RBracLoc, isImplicit));
}
@@ -2417,7 +2423,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
}
}
} else {
- ObjCInterfaceDecl* ClassDecl = 0;
+ ObjCInterfaceDecl *ClassDecl = nullptr;
// We allow sending a message to a qualified ID ("id<foo>"), which is ok as
// long as one of the protocols implements the selector (if not, warn).
@@ -2437,7 +2443,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
// Try to complete the type. Under ARC, this is a hard error from which
// we don't try to recover.
- const ObjCInterfaceDecl *forwardClass = 0;
+ const ObjCInterfaceDecl *forwardClass = nullptr;
if (RequireCompleteType(Loc, OCIType->getPointeeType(),
getLangOpts().ObjCAutoRefCount
? diag::err_arc_receiver_forward_instance
@@ -2450,7 +2456,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
forwardClass = OCIType->getInterfaceDecl();
Diag(Receiver ? Receiver->getLocStart()
: SuperLoc, diag::note_receiver_is_id);
- Method = 0;
+ Method = nullptr;
} else {
Method = ClassDecl->lookupInstanceMethod(Sel);
}
@@ -2497,8 +2503,8 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
FunctionScopeInfo *DIFunctionScopeInfo =
(Method && Method->getMethodFamily() == OMF_init)
- ? getEnclosingFunction() : 0;
-
+ ? getEnclosingFunction() : nullptr;
+
if (DIFunctionScopeInfo &&
DIFunctionScopeInfo->ObjCIsDesignatedInit &&
(SuperLoc.isValid() || isSelfExpr(Receiver))) {
@@ -2518,7 +2524,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
}
}
if (!isDesignatedInitChain) {
- const ObjCMethodDecl *InitMethod = 0;
+ const ObjCMethodDecl *InitMethod = nullptr;
bool isDesignated =
getCurMethodDecl()->isDesignatedInitializerForTheInterface(&InitMethod);
assert(isDesignated && InitMethod);
@@ -2736,10 +2742,11 @@ ExprResult Sema::ActOnInstanceMessage(Scope *S,
}
if (Sel == RespondsToSelectorSel)
RemoveSelectorFromWarningCache(*this, Args[0]);
-
+
return BuildInstanceMessage(Receiver, Receiver->getType(),
- /*SuperLoc=*/SourceLocation(), Sel, /*Method=*/0,
- LBracLoc, SelectorLocs, RBracLoc, Args);
+ /*SuperLoc=*/SourceLocation(), Sel,
+ /*Method=*/nullptr, LBracLoc, SelectorLocs,
+ RBracLoc, Args);
}
enum ARCConversionTypeClass {
@@ -3149,7 +3156,7 @@ static inline T *getObjCBridgeAttr(const TypedefType *TD) {
if (RecordDecl *RD = RT->getDecl())
return RD->getAttr<T>();
}
- return 0;
+ return nullptr;
}
static ObjCBridgeRelatedAttr *ObjCBridgeRelatedAttrFromType(QualType T,
@@ -3161,7 +3168,7 @@ static ObjCBridgeRelatedAttr *ObjCBridgeRelatedAttrFromType(QualType T,
return ObjCBAttr;
T = TDNDecl->getUnderlyingType();
}
- return 0;
+ return nullptr;
}
static void
@@ -3178,7 +3185,7 @@ diagnoseObjCARCConversion(Sema &S, SourceRange castRange,
return;
QualType castExprType = castExpr->getType();
- TypedefNameDecl *TDNDecl = 0;
+ TypedefNameDecl *TDNDecl = nullptr;
if ((castACTC == ACTC_coreFoundation && exprACTC == ACTC_retainable &&
ObjCBridgeRelatedAttrFromType(castType, TDNDecl)) ||
(exprACTC == ACTC_coreFoundation && castACTC == ACTC_retainable &&
@@ -3224,9 +3231,10 @@ diagnoseObjCARCConversion(Sema &S, SourceRange castRange,
DiagnosticBuilder DiagB =
(CCK != Sema::CCK_OtherCast) ? S.Diag(noteLoc, diag::note_arc_bridge)
: S.Diag(noteLoc, diag::note_arc_cstyle_bridge);
-
+
addFixitForObjCARCConversion(S, DiagB, CCK, afterLParen,
- castType, castExpr, realCast, "__bridge ", 0);
+ castType, castExpr, realCast, "__bridge ",
+ nullptr);
}
if (CreateRule != ACC_plusZero)
{
@@ -3236,10 +3244,10 @@ diagnoseObjCARCConversion(Sema &S, SourceRange castRange,
S.Diag(br ? castExpr->getExprLoc() : noteLoc,
diag::note_arc_bridge_transfer)
<< castExprType << br;
-
+
addFixitForObjCARCConversion(S, DiagB, CCK, afterLParen,
castType, castExpr, realCast, "__bridge_transfer ",
- br ? "CFBridgingRelease" : 0);
+ br ? "CFBridgingRelease" : nullptr);
}
return;
@@ -3265,7 +3273,8 @@ diagnoseObjCARCConversion(Sema &S, SourceRange castRange,
(CCK != Sema::CCK_OtherCast) ? S.Diag(noteLoc, diag::note_arc_bridge)
: S.Diag(noteLoc, diag::note_arc_cstyle_bridge);
addFixitForObjCARCConversion(S, DiagB, CCK, afterLParen,
- castType, castExpr, realCast, "__bridge ", 0);
+ castType, castExpr, realCast, "__bridge ",
+ nullptr);
}
if (CreateRule != ACC_plusZero)
{
@@ -3275,10 +3284,10 @@ diagnoseObjCARCConversion(Sema &S, SourceRange castRange,
S.Diag(br ? castExpr->getExprLoc() : noteLoc,
diag::note_arc_bridge_retained)
<< castType << br;
-
+
addFixitForObjCARCConversion(S, DiagB, CCK, afterLParen,
castType, castExpr, realCast, "__bridge_retained ",
- br ? "CFBridgingRetain" : 0);
+ br ? "CFBridgingRetain" : nullptr);
}
return;
@@ -3297,7 +3306,7 @@ static void CheckObjCBridgeNSCast(Sema &S, QualType castType, Expr *castExpr) {
TypedefNameDecl *TDNDecl = TD->getDecl();
if (TB *ObjCBAttr = getObjCBridgeAttr<TB>(TD)) {
if (IdentifierInfo *Parm = ObjCBAttr->getBridgedType()) {
- NamedDecl *Target = 0;
+ NamedDecl *Target = nullptr;
// Check for an existing type with this name.
LookupResult R(S, DeclarationName(Parm), SourceLocation(),
Sema::LookupOrdinaryName);
@@ -3350,7 +3359,7 @@ static void CheckObjCBridgeCFCast(Sema &S, QualType castType, Expr *castExpr) {
TypedefNameDecl *TDNDecl = TD->getDecl();
if (TB *ObjCBAttr = getObjCBridgeAttr<TB>(TD)) {
if (IdentifierInfo *Parm = ObjCBAttr->getBridgedType()) {
- NamedDecl *Target = 0;
+ NamedDecl *Target = nullptr;
// Check for an existing type with this name.
LookupResult R(S, DeclarationName(Parm), SourceLocation(),
Sema::LookupOrdinaryName);
@@ -3447,7 +3456,7 @@ bool Sema::checkObjCBridgeRelatedComponents(SourceLocation Loc,
IdentifierInfo *IMId = ObjCBAttr->getInstanceMethod();
if (!RCId)
return false;
- NamedDecl *Target = 0;
+ NamedDecl *Target = nullptr;
// Check for an existing type with this name.
LookupResult R(*this, DeclarationName(RCId), SourceLocation(),
Sema::LookupOrdinaryName);
@@ -3507,9 +3516,9 @@ Sema::CheckObjCBridgeRelatedConversions(SourceLocation Loc,
return false;
ObjCInterfaceDecl *RelatedClass;
- ObjCMethodDecl *ClassMethod = 0;
- ObjCMethodDecl *InstanceMethod = 0;
- TypedefNameDecl *TDNDecl = 0;
+ ObjCMethodDecl *ClassMethod = nullptr;
+ ObjCMethodDecl *InstanceMethod = nullptr;
+ TypedefNameDecl *TDNDecl = nullptr;
if (!checkObjCBridgeRelatedComponents(Loc, DestType, SrcType, RelatedClass,
ClassMethod, InstanceMethod, TDNDecl, CfToNs))
return false;
@@ -3654,7 +3663,7 @@ Sema::CheckObjCARCConversion(SourceRange castRange, QualType castType,
case ACC_plusOne:
castExpr = ImplicitCastExpr::Create(Context, castExpr->getType(),
CK_ARCConsumeObject, castExpr,
- 0, VK_RValue);
+ nullptr, VK_RValue);
ExprNeedsCleanups = true;
return ACR_okay;
}
@@ -3856,7 +3865,7 @@ ExprResult Sema::BuildObjCBridgedCast(SourceLocation LParenLoc,
// Produce the object before casting it.
SubExpr = ImplicitCastExpr::Create(Context, FromType,
CK_ARCProduceObject,
- SubExpr, 0, VK_RValue);
+ SubExpr, nullptr, VK_RValue);
break;
case OBC_BridgeTransfer: {
@@ -3895,7 +3904,7 @@ ExprResult Sema::BuildObjCBridgedCast(SourceLocation LParenLoc,
if (MustConsume) {
ExprNeedsCleanups = true;
Result = ImplicitCastExpr::Create(Context, T, CK_ARCConsumeObject, Result,
- 0, VK_RValue);
+ nullptr, VK_RValue);
}
return Result;
@@ -3908,7 +3917,7 @@ ExprResult Sema::ActOnObjCBridgedCast(Scope *S,
ParsedType Type,
SourceLocation RParenLoc,
Expr *SubExpr) {
- TypeSourceInfo *TSInfo = 0;
+ TypeSourceInfo *TSInfo = nullptr;
QualType T = GetTypeFromParser(Type, &TSInfo);
if (Kind == OBC_Bridge)
CheckTollFreeBridgeCast(T, SubExpr);