summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprObjC.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaExprObjC.cpp')
-rw-r--r--clang/lib/Sema/SemaExprObjC.cpp380
1 files changed, 190 insertions, 190 deletions
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp
index bf0ffeba06b..b291fc8691d 100644
--- a/clang/lib/Sema/SemaExprObjC.cpp
+++ b/clang/lib/Sema/SemaExprObjC.cpp
@@ -73,7 +73,7 @@ ExprResult Sema::ParseObjCStringLiteral(SourceLocation *AtLocs,
/*Pascal=*/false, StrTy, &StrLocs[0],
StrLocs.size());
}
-
+
return BuildObjCStringLiteral(AtLocs[0], S);
}
@@ -92,12 +92,12 @@ ExprResult Sema::BuildObjCStringLiteral(SourceLocation AtLoc, StringLiteral *S){
} else if (getLangOpts().NoConstantCFStrings) {
IdentifierInfo *NSIdent=nullptr;
std::string StringClass(getLangOpts().ObjCConstantStringClass);
-
+
if (StringClass.empty())
NSIdent = &Context.Idents.get("NSConstantString");
else
NSIdent = &Context.Idents.get(StringClass);
-
+
NamedDecl *IF = LookupSingleName(TUScope, NSIdent, AtLoc,
LookupOrdinaryName);
if (ObjCInterfaceDecl *StrIF = dyn_cast_or_null<ObjCInterfaceDecl>(IF)) {
@@ -126,10 +126,10 @@ ExprResult Sema::BuildObjCStringLiteral(SourceLocation AtLoc, StringLiteral *S){
// being an 'id' type.
Ty = Context.getObjCNSStringType();
if (Ty.isNull()) {
- ObjCInterfaceDecl *NSStringIDecl =
- ObjCInterfaceDecl::Create (Context,
- Context.getTranslationUnitDecl(),
- SourceLocation(), NSIdent,
+ ObjCInterfaceDecl *NSStringIDecl =
+ ObjCInterfaceDecl::Create (Context,
+ Context.getTranslationUnitDecl(),
+ SourceLocation(), NSIdent,
nullptr, nullptr, SourceLocation());
Ty = Context.getObjCInterfaceType(NSStringIDecl);
Context.setObjCNSStringType(Ty);
@@ -252,16 +252,16 @@ static ObjCMethodDecl *getNSNumberFactoryMethod(Sema &S, SourceLocation Loc,
}
return nullptr;
}
-
+
// If we already looked up this method, we're done.
if (S.NSNumberLiteralMethods[*Kind])
return S.NSNumberLiteralMethods[*Kind];
-
+
Selector Sel = S.NSAPIObj->getNSNumberLiteralSelector(*Kind,
/*Instance=*/false);
-
+
ASTContext &CX = S.Context;
-
+
// Look up the NSNumber class, if we haven't done so already. It's cached
// in the Sema instance.
if (!S.NSNumberDecl) {
@@ -277,7 +277,7 @@ static ObjCMethodDecl *getNSNumberFactoryMethod(Sema &S, SourceLocation Loc,
QualType NSNumberObject = CX.getObjCInterfaceType(S.NSNumberDecl);
S.NSNumberPointer = CX.getObjCObjectPointerType(NSNumberObject);
}
-
+
// Look for the appropriate method within NSNumber.
ObjCMethodDecl *Method = S.NSNumberDecl->lookupClassMethod(Sel);
if (!Method && S.getLangOpts().DebuggerObjCLiteral) {
@@ -304,7 +304,7 @@ static ObjCMethodDecl *getNSNumberFactoryMethod(Sema &S, SourceLocation Loc,
// Note: if the parameter type is out-of-line, we'll catch it later in the
// implicit conversion.
-
+
S.NSNumberLiteralMethods[*Kind] = Method;
return Method;
}
@@ -322,21 +322,21 @@ ExprResult Sema::BuildObjCNumericLiteral(SourceLocation AtLoc, Expr *Number) {
case CharacterLiteral::UTF8:
NumberType = Context.CharTy;
break;
-
+
case CharacterLiteral::Wide:
NumberType = Context.getWideCharType();
break;
-
+
case CharacterLiteral::UTF16:
NumberType = Context.Char16Ty;
break;
-
+
case CharacterLiteral::UTF32:
NumberType = Context.Char32Ty;
break;
}
}
-
+
// Look for the appropriate method within NSNumber.
// Construct the literal.
SourceRange NR(Number->getSourceRange());
@@ -355,33 +355,33 @@ ExprResult Sema::BuildObjCNumericLiteral(SourceLocation AtLoc, Expr *Number) {
if (ConvertedNumber.isInvalid())
return ExprError();
Number = ConvertedNumber.get();
-
+
// Use the effective source range of the literal, including the leading '@'.
return MaybeBindToTemporary(
new (Context) ObjCBoxedExpr(Number, NSNumberPointer, Method,
SourceRange(AtLoc, NR.getEnd())));
}
-ExprResult Sema::ActOnObjCBoolLiteral(SourceLocation AtLoc,
+ExprResult Sema::ActOnObjCBoolLiteral(SourceLocation AtLoc,
SourceLocation ValueLoc,
bool Value) {
ExprResult Inner;
if (getLangOpts().CPlusPlus) {
Inner = ActOnCXXBoolLiteral(ValueLoc, Value? tok::kw_true : tok::kw_false);
} else {
- // C doesn't actually have a way to represent literal values of type
+ // C doesn't actually have a way to represent literal values of type
// _Bool. So, we'll use 0/1 and implicit cast to _Bool.
Inner = ActOnIntegerConstant(ValueLoc, Value? 1 : 0);
- Inner = ImpCastExprToType(Inner.get(), Context.BoolTy,
+ Inner = ImpCastExprToType(Inner.get(), Context.BoolTy,
CK_IntegralToBoolean);
}
-
+
return BuildObjCNumericLiteral(AtLoc, Inner.get());
}
/// Check that the given expression is a valid element of an Objective-C
/// collection literal.
-static ExprResult CheckObjCCollectionLiteralElement(Sema &S, Expr *Element,
+static ExprResult CheckObjCCollectionLiteralElement(Sema &S, Expr *Element,
QualType T,
bool ArrayLiteral = false) {
// If the expression is type-dependent, there's nothing for us to do.
@@ -393,7 +393,7 @@ static ExprResult CheckObjCCollectionLiteralElement(Sema &S, Expr *Element,
return ExprError();
Element = Result.get();
- // In C++, check for an implicit conversion to an Objective-C object pointer
+ // In C++, check for an implicit conversion to an Objective-C object pointer
// type.
if (S.getLangOpts().CPlusPlus && Element->getType()->isRecordType()) {
InitializedEntity Entity
@@ -413,15 +413,15 @@ static ExprResult CheckObjCCollectionLiteralElement(Sema &S, Expr *Element,
Result = S.DefaultLvalueConversion(Element);
if (Result.isInvalid())
return ExprError();
- Element = Result.get();
+ Element = Result.get();
// Make sure that we have an Objective-C pointer type or block.
if (!Element->getType()->isObjCObjectPointerType() &&
!Element->getType()->isBlockPointerType()) {
bool Recovered = false;
-
+
// If this is potentially an Objective-C numeric literal, add the '@'.
- if (isa<IntegerLiteral>(OrigElement) ||
+ if (isa<IntegerLiteral>(OrigElement) ||
isa<CharacterLiteral>(OrigElement) ||
isa<FloatingLiteral>(OrigElement) ||
isa<ObjCBoolLiteralExpr>(OrigElement) ||
@@ -431,16 +431,16 @@ static ExprResult CheckObjCCollectionLiteralElement(Sema &S, Expr *Element,
: (isa<CXXBoolLiteralExpr>(OrigElement) ||
isa<ObjCBoolLiteralExpr>(OrigElement)) ? 2
: 3;
-
+
S.Diag(OrigElement->getLocStart(), diag::err_box_literal_collection)
<< Which << OrigElement->getSourceRange()
<< FixItHint::CreateInsertion(OrigElement->getLocStart(), "@");
-
+
Result = S.BuildObjCNumericLiteral(OrigElement->getLocStart(),
OrigElement);
if (Result.isInvalid())
return ExprError();
-
+
Element = Result.get();
Recovered = true;
}
@@ -455,12 +455,12 @@ static ExprResult CheckObjCCollectionLiteralElement(Sema &S, Expr *Element,
Result = S.BuildObjCStringLiteral(OrigElement->getLocStart(), String);
if (Result.isInvalid())
return ExprError();
-
+
Element = Result.get();
Recovered = true;
}
}
-
+
if (!Recovered) {
S.Diag(Element->getLocStart(), diag::err_invalid_collection_element)
<< Element->getType();
@@ -488,17 +488,17 @@ static ExprResult CheckObjCCollectionLiteralElement(Sema &S, Expr *Element,
}
}
- // Make sure that the element has the type that the container factory
- // function expects.
+ // Make sure that the element has the type that the container factory
+ // function expects.
return S.PerformCopyInitialization(
- InitializedEntity::InitializeParameter(S.Context, T,
+ InitializedEntity::InitializeParameter(S.Context, T,
/*Consumed=*/false),
Element->getLocStart(), Element);
}
ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
if (ValueExpr->isTypeDependent()) {
- ObjCBoxedExpr *BoxedExpr =
+ ObjCBoxedExpr *BoxedExpr =
new (Context) ObjCBoxedExpr(ValueExpr, Context.DependentTy, nullptr, SR);
return BoxedExpr;
}
@@ -525,7 +525,7 @@ ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
QualType NSStringObject = Context.getObjCInterfaceType(NSStringDecl);
NSStringPointer = Context.getObjCObjectPointerType(NSStringObject);
}
-
+
if (!StringWithUTF8StringMethod) {
IdentifierInfo *II = &Context.Idents.get("stringWithUTF8String");
Selector stringWithUTF8String = Context.Selectors.getUnarySelector(II);
@@ -561,7 +561,7 @@ ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
StringWithUTF8StringMethod = BoxingMethod;
}
-
+
BoxingMethod = StringWithUTF8StringMethod;
BoxedType = NSStringPointer;
// Transfer the nullability from method's return type.
@@ -588,22 +588,22 @@ ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
case CharacterLiteral::UTF8:
ValueType = Context.CharTy;
break;
-
+
case CharacterLiteral::Wide:
ValueType = Context.getWideCharType();
break;
-
+
case CharacterLiteral::UTF16:
ValueType = Context.Char16Ty;
break;
-
+
case CharacterLiteral::UTF32:
ValueType = Context.Char32Ty;
break;
}
}
// FIXME: Do I need to do anything special with BoolTy expressions?
-
+
// Look for the appropriate method within NSNumber.
BoxingMethod = getNSNumberFactoryMethod(*this, Loc, ValueType);
BoxedType = NSNumberPointer;
@@ -620,7 +620,7 @@ ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
} else if (ValueType->isObjCBoxableRecordType()) {
// Support for structure types, that marked as objc_boxable
// struct __attribute__((objc_boxable)) s { ... };
-
+
// Look up the NSValue class, if we haven't done so already. It's cached
// in the Sema instance.
if (!NSValueDecl) {
@@ -634,14 +634,14 @@ ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
QualType NSValueObject = Context.getObjCInterfaceType(NSValueDecl);
NSValuePointer = Context.getObjCObjectPointerType(NSValueObject);
}
-
+
if (!ValueWithBytesObjCTypeMethod) {
IdentifierInfo *II[] = {
&Context.Idents.get("valueWithBytes"),
&Context.Idents.get("objCType")
};
Selector ValueWithBytesObjCType = Context.Selectors.getSelector(2, II);
-
+
// Look for the appropriate method within NSValue.
BoxingMethod = NSValueDecl->lookupClassMethod(ValueWithBytesObjCType);
if (!BoxingMethod && getLangOpts().DebuggerObjCLiteral) {
@@ -662,9 +662,9 @@ ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
/*isDefined=*/false,
ObjCMethodDecl::Required,
/*HasRelatedResultType=*/false);
-
+
SmallVector<ParmVarDecl *, 2> Params;
-
+
ParmVarDecl *bytes =
ParmVarDecl::Create(Context, M,
SourceLocation(), SourceLocation(),
@@ -673,7 +673,7 @@ ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
/*TInfo=*/nullptr,
SC_None, nullptr);
Params.push_back(bytes);
-
+
QualType ConstCharType = Context.CharTy.withConst();
ParmVarDecl *type =
ParmVarDecl::Create(Context, M,
@@ -683,18 +683,18 @@ ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
/*TInfo=*/nullptr,
SC_None, nullptr);
Params.push_back(type);
-
+
M->setMethodParams(Context, Params, None);
BoxingMethod = M;
}
-
+
if (!validateBoxingMethod(*this, Loc, NSValueDecl,
ValueWithBytesObjCType, BoxingMethod))
return ExprError();
-
+
ValueWithBytesObjCTypeMethod = BoxingMethod;
}
-
+
if (!ValueType.isTriviallyCopyableType(Context)) {
Diag(Loc, diag::err_objc_non_trivially_copyable_boxed_expression_type)
<< ValueType << ValueExpr->getSourceRange();
@@ -710,13 +710,13 @@ ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
<< ValueType << ValueExpr->getSourceRange();
return ExprError();
}
-
+
DiagnoseUseOfDecl(BoxingMethod, Loc);
ExprResult ConvertedValueExpr;
if (ValueType->isObjCBoxableRecordType()) {
InitializedEntity IE = InitializedEntity::InitializeTemporary(ValueType);
- ConvertedValueExpr = PerformCopyInitialization(IE, ValueExpr->getExprLoc(),
+ ConvertedValueExpr = PerformCopyInitialization(IE, ValueExpr->getExprLoc(),
ValueExpr);
} else {
// Convert the expression to the type that the parameter requires.
@@ -726,12 +726,12 @@ ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
ConvertedValueExpr = PerformCopyInitialization(IE, SourceLocation(),
ValueExpr);
}
-
+
if (ConvertedValueExpr.isInvalid())
return ExprError();
ValueExpr = ConvertedValueExpr.get();
-
- ObjCBoxedExpr *BoxedExpr =
+
+ ObjCBoxedExpr *BoxedExpr =
new (Context) ObjCBoxedExpr(ValueExpr, BoxedType,
BoxingMethod, SR);
return MaybeBindToTemporary(BoxedExpr);
@@ -756,7 +756,7 @@ ExprResult Sema::BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr,
if (Result.isInvalid())
return ExprError();
IndexExpr = Result.get();
-
+
// Perform lvalue-to-rvalue conversion on the base.
Result = DefaultLvalueConversion(BaseExpr);
if (Result.isInvalid())
@@ -821,24 +821,24 @@ ExprResult Sema::BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements) {
// Dig out the type that all elements should be converted to.
QualType T = Method->parameters()[0]->getType();
const PointerType *PtrT = T->getAs<PointerType>();
- if (!PtrT ||
+ if (!PtrT ||
!Context.hasSameUnqualifiedType(PtrT->getPointeeType(), IdT)) {
Diag(SR.getBegin(), diag::err_objc_literal_method_sig)
<< Sel;
Diag(Method->parameters()[0]->getLocation(),
diag::note_objc_literal_method_param)
- << 0 << T
+ << 0 << T
<< Context.getPointerType(IdT.withConst());
return ExprError();
}
-
+
// Check that the 'count' parameter is integral.
if (!Method->parameters()[1]->getType()->isIntegerType()) {
Diag(SR.getBegin(), diag::err_objc_literal_method_sig)
<< Sel;
Diag(Method->parameters()[1]->getLocation(),
diag::note_objc_literal_method_param)
- << 1
+ << 1
<< Method->parameters()[1]->getType()
<< "integral";
return ExprError();
@@ -860,11 +860,11 @@ ExprResult Sema::BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements) {
RequiredType, true);
if (Converted.isInvalid())
return ExprError();
-
+
ElementsBuffer[I] = Converted.get();
}
-
- QualType Ty
+
+ QualType Ty
= Context.getObjCObjectPointerType(
Context.getObjCInterfaceType(NSArrayDecl));
@@ -893,7 +893,7 @@ ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR,
NSAPI::NSDict_dictionaryWithObjectsForKeysCount);
ObjCMethodDecl *Method = NSDictionaryDecl->lookupClassMethod(Sel);
if (!Method && getLangOpts().DebuggerObjCLiteral) {
- Method = ObjCMethodDecl::Create(Context,
+ Method = ObjCMethodDecl::Create(Context,
SourceLocation(), SourceLocation(), Sel,
IdT,
nullptr /*TypeSourceInfo */,
@@ -938,7 +938,7 @@ ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR,
// Dig out the type that all values should be converted to.
QualType ValueT = Method->parameters()[0]->getType();
const PointerType *PtrValue = ValueT->getAs<PointerType>();
- if (!PtrValue ||
+ if (!PtrValue ||
!Context.hasSameUnqualifiedType(PtrValue->getPointeeType(), IdT)) {
Diag(SR.getBegin(), diag::err_objc_literal_method_sig)
<< Sel;
@@ -952,7 +952,7 @@ ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR,
// Dig out the type that all keys should be converted to.
QualType KeyT = Method->parameters()[1]->getType();
const PointerType *PtrKey = KeyT->getAs<PointerType>();
- if (!PtrKey ||
+ if (!PtrKey ||
!Context.hasSameUnqualifiedType(PtrKey->getPointeeType(),
IdT)) {
bool err = true;
@@ -962,7 +962,7 @@ ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR,
if (ObjCProtocolDecl *NSCopyingPDecl =
LookupProtocol(&Context.Idents.get("NSCopying"), SR.getBegin())) {
ObjCProtocolDecl *PQ[] = {NSCopyingPDecl};
- QIDNSCopying =
+ QIDNSCopying =
Context.getObjCObjectType(Context.ObjCBuiltinIdTy, { },
llvm::makeArrayRef(
(ObjCProtocolDecl**) PQ,
@@ -975,7 +975,7 @@ ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR,
err = !Context.hasSameUnqualifiedType(PtrKey->getPointeeType(),
QIDNSCopying);
}
-
+
if (err) {
Diag(SR.getBegin(), diag::err_objc_literal_method_sig)
<< Sel;
@@ -1008,7 +1008,7 @@ ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR,
QualType KeysT = DictionaryWithObjectsMethod->parameters()[1]->getType();
QualType KeyT = KeysT->castAs<PointerType>()->getPointeeType();
- // Check that each of the keys and values provided is valid in a collection
+ // Check that each of the keys and values provided is valid in a collection
// literal, performing conversions as necessary.
bool HasPackExpansions = false;
for (ObjCDictionaryElement &Element : Elements) {
@@ -1017,19 +1017,19 @@ ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR,
KeyT);
if (Key.isInvalid())
return ExprError();
-
+
// Check the value.
ExprResult Value
= CheckObjCCollectionLiteralElement(*this, Element.Value, ValueT);
if (Value.isInvalid())
return ExprError();
-
+
Element.Key = Key.get();
Element.Value = Value.get();
-
+
if (Element.EllipsisLoc.isInvalid())
continue;
-
+
if (!Element.Key->containsUnexpandedParameterPack() &&
!Element.Value->containsUnexpandedParameterPack()) {
Diag(Element.EllipsisLoc,
@@ -1038,10 +1038,10 @@ ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR,
Element.Value->getLocEnd());
return ExprError();
}
-
+
HasPackExpansions = true;
}
-
+
QualType Ty
= Context.getObjCObjectPointerType(
Context.getObjCInterfaceType(NSDictionaryDecl));
@@ -1147,7 +1147,7 @@ static void DiagnoseMismatchedSelectors(Sema &S, SourceLocation AtLoc,
if (HelperToDiagnoseMismatchedMethodsInGlobalPool(S, AtLoc, LParenLoc, RParenLoc,
Method, InstMethList))
Warned = true;
-
+
// second, class methods
ObjCMethodList &ClsMethList = b->second.second;
if (HelperToDiagnoseMismatchedMethodsInGlobalPool(S, AtLoc, LParenLoc, RParenLoc,
@@ -1175,7 +1175,7 @@ ExprResult Sema::ParseObjCSelectorExpression(Selector Sel,
Diag(SelLoc, diag::warn_undeclared_selector_with_typo)
<< Sel << MatchedSel
<< FixItHint::CreateReplacement(SelectorRange, MatchedSel.getAsString());
-
+
} else
Diag(SelLoc, diag::warn_undeclared_selector) << Sel;
} else
@@ -1187,7 +1187,7 @@ ExprResult Sema::ParseObjCSelectorExpression(Selector Sel,
!getSourceManager().isInSystemHeader(Method->getLocation()))
ReferencedSelectors.insert(std::make_pair(Sel, AtLoc));
- // In ARC, forbid the user from using @selector for
+ // In ARC, forbid the user from using @selector for
// retain/release/autorelease/dealloc/retainCount.
if (getLangOpts().ObjCAutoRefCount) {
switch (Sel.getMethodFamily()) {
@@ -1196,7 +1196,7 @@ ExprResult Sema::ParseObjCSelectorExpression(Selector Sel,
case OMF_autorelease:
case OMF_retainCount:
case OMF_dealloc:
- Diag(AtLoc, diag::err_arc_illegal_selector) <<
+ Diag(AtLoc, diag::err_arc_illegal_selector) <<
Sel << SourceRange(LParenLoc, RParenLoc);
break;
@@ -1269,7 +1269,7 @@ static QualType stripObjCInstanceType(ASTContext &Context, QualType T) {
if (T == Context.getObjCInstanceType())
return Context.getObjCIdType();
-
+
return origType;
}
@@ -1313,7 +1313,7 @@ static QualType getBaseMessageSendResultType(Sema &S,
// was a class message send, T is the declared return type of the method
// found
if (Method->isInstanceMethod() && isClassMessage)
- return stripObjCInstanceType(Context,
+ return stripObjCInstanceType(Context,
Method->getSendResultType(ReceiverType));
// - if the receiver is super, T is a pointer to the class of the
@@ -1334,7 +1334,7 @@ static QualType getBaseMessageSendResultType(Sema &S,
// T is the declared return type of the method.
if (ReceiverType->isObjCClassType() ||
ReceiverType->isObjCQualifiedClassType())
- return stripObjCInstanceType(Context,
+ return stripObjCInstanceType(Context,
Method->getSendResultType(ReceiverType));
// - if the receiver is id, qualified id, Class, or qualified Class, T
@@ -1424,14 +1424,14 @@ findExplicitInstancetypeDeclarer(const ObjCMethodDecl *MD,
if (const ObjCImplDecl *impl =
dyn_cast<ObjCImplDecl>(MD->getDeclContext())) {
const ObjCContainerDecl *iface;
- if (const ObjCCategoryImplDecl *catImpl =
+ if (const ObjCCategoryImplDecl *catImpl =
dyn_cast<ObjCCategoryImplDecl>(impl)) {
iface = catImpl->getCategoryDecl();
} else {
iface = impl->getClassInterface();
}
- const ObjCMethodDecl *ifaceMD =
+ const ObjCMethodDecl *ifaceMD =
iface->getMethod(MD->getSelector(), MD->isInstanceMethod());
if (ifaceMD) return findExplicitInstancetypeDeclarer(ifaceMD, instancetype);
}
@@ -1481,11 +1481,11 @@ void Sema::EmitRelatedResultTypeNote(const Expr *E) {
const ObjCMessageExpr *MsgSend = dyn_cast<ObjCMessageExpr>(E);
if (!MsgSend)
return;
-
+
const ObjCMethodDecl *Method = MsgSend->getMethodDecl();
if (!Method)
return;
-
+
if (!Method->hasRelatedResultType())
return;
@@ -1496,7 +1496,7 @@ void Sema::EmitRelatedResultTypeNote(const Expr *E) {
if (!Context.hasSameUnqualifiedType(Method->getReturnType(),
Context.getObjCInstanceType()))
return;
-
+
Diag(Method->getLocation(), diag::note_related_result_type_inferred)
<< Method->isInstanceMethod() << Method->getSelector()
<< MsgSend->getType();
@@ -1560,7 +1560,7 @@ bool Sema::CheckMessageArgumentTypes(QualType ReceiverType,
}
else
Diag(SelLoc, DiagID)
- << Sel << isClassMessage << SourceRange(SelectorLocs.front(),
+ << Sel << isClassMessage << SourceRange(SelectorLocs.front(),
SelectorLocs.back());
// Find the class to which we are sending this message.
if (ReceiverType->isObjCObjectPointerType()) {
@@ -1587,7 +1587,7 @@ bool Sema::CheckMessageArgumentTypes(QualType ReceiverType,
return false;
}
- ReturnType = getMessageSendResultType(ReceiverType, Method, isClassMessage,
+ ReturnType = getMessageSendResultType(ReceiverType, Method, isClassMessage,
isSuperMessage);
VK = Expr::getValueKindForType(Method->getReturnType());
@@ -1751,7 +1751,7 @@ ObjCMethodDecl *Sema::LookupMethodInObjectType(Selector sel, QualType type,
return nullptr;
}
-/// LookupMethodInQualifiedType - Lookups up a method in protocol qualifier
+/// LookupMethodInQualifiedType - Lookups up a method in protocol qualifier
/// list of a qualified objective pointer type.
ObjCMethodDecl *Sema::LookupMethodInQualifiedType(Selector Sel,
const ObjCObjectPointerType *OPT,
@@ -1785,14 +1785,14 @@ HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT,
}
IdentifierInfo *Member = MemberName.getAsIdentifierInfo();
-
+
SourceRange BaseRange = Super? SourceRange(SuperLoc)
: BaseExpr->getSourceRange();
- if (RequireCompleteType(MemberLoc, OPT->getPointeeType(),
+ if (RequireCompleteType(MemberLoc, OPT->getPointeeType(),
diag::err_property_not_found_forward_class,
MemberName, BaseRange))
return ExprError();
-
+
if (ObjCPropertyDecl *PD = IFace->FindPropertyDeclaration(
Member, ObjCPropertyQueryKind::OBJC_PR_query_instance)) {
// Check whether we can reference this property.
@@ -1832,7 +1832,7 @@ HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT,
Selector Sel = PP.getSelectorTable().getNullarySelector(Member);
ObjCMethodDecl *Getter = IFace->lookupInstanceMethod(Sel);
-
+
// May be found in property's qualified list.
if (!Getter)
Getter = LookupMethodInQualifiedType(Sel, OPT, true);
@@ -1852,17 +1852,17 @@ HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT,
SelectorTable::constructSetterSelector(PP.getIdentifierTable(),
PP.getSelectorTable(), Member);
ObjCMethodDecl *Setter = IFace->lookupInstanceMethod(SetterSel);
-
+
// May be found in property's qualified list.
if (!Setter)
Setter = LookupMethodInQualifiedType(SetterSel, OPT, true);
-
+
if (!Setter) {
// If this reference is in an @implementation, also check for 'private'
// methods.
Setter = IFace->lookupPrivateMethod(SetterSel);
}
-
+
if (Setter && DiagnoseUseOfDecl(Setter, MemberLoc))
return ExprError();
@@ -1926,23 +1926,23 @@ HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT,
}
}
ObjCInterfaceDecl *ClassDeclared;
- if (ObjCIvarDecl *Ivar =
+ if (ObjCIvarDecl *Ivar =
IFace->lookupInstanceVariable(Member, ClassDeclared)) {
QualType T = Ivar->getType();
- if (const ObjCObjectPointerType * OBJPT =
+ if (const ObjCObjectPointerType * OBJPT =
T->getAsObjCInterfacePointerType()) {
- if (RequireCompleteType(MemberLoc, OBJPT->getPointeeType(),
+ if (RequireCompleteType(MemberLoc, OBJPT->getPointeeType(),
diag::err_property_not_as_forward_class,
MemberName, BaseExpr))
return ExprError();
}
- Diag(MemberLoc,
+ Diag(MemberLoc,
diag::err_ivar_access_using_property_syntax_suggest)
<< MemberName << QualType(OPT, 0) << Ivar->getDeclName()
<< FixItHint::CreateReplacement(OpLoc, "->");
return ExprError();
}
-
+
Diag(MemberLoc, diag::err_property_not_found)
<< MemberName << QualType(OPT, 0);
if (Setter)
@@ -2086,10 +2086,10 @@ Sema::ObjCMessageKind Sema::getObjCMessageKind(Scope *S,
// trailing dot, it's an instance message.
if (IsSuper && S->isInObjcMethodScope())
return HasTrailingDot? ObjCInstanceMessage : ObjCSuperMessage;
-
+
LookupResult Result(*this, Name, NameLoc, LookupOrdinaryName);
LookupName(Result, S);
-
+
switch (Result.getResultKind()) {
case LookupResult::NotFound:
// Normal name lookup didn't find anything. If we're in an
@@ -2103,11 +2103,11 @@ Sema::ObjCMessageKind Sema::getObjCMessageKind(Scope *S,
}
ObjCInterfaceDecl *ClassDeclared;
- if (Method->getClassInterface()->lookupInstanceVariable(Name,
+ if (Method->getClassInterface()->lookupInstanceVariable(Name,
ClassDeclared))
return ObjCInstanceMessage;
}
-
+
// Break out; we'll perform typo correction below.
break;
@@ -2171,7 +2171,7 @@ Sema::ObjCMessageKind Sema::getObjCMessageKind(Scope *S,
return ObjCInstanceMessage;
}
-ExprResult Sema::ActOnSuperMessage(Scope *S,
+ExprResult Sema::ActOnSuperMessage(Scope *S,
SourceLocation SuperLoc,
Selector Sel,
SourceLocation LBracLoc,
@@ -2213,7 +2213,7 @@ ExprResult Sema::ActOnSuperMessage(Scope *S,
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=*/nullptr,
@@ -2353,7 +2353,7 @@ DiagnoseCStringFormatDirectiveInObjCAPI(Sema &S,
}
if (!Format || NumArgs <= Idx)
return;
-
+
Expr *FormatExpr = Args[Idx];
if (ObjCStringLiteral *OSL =
dyn_cast<ObjCStringLiteral>(FormatExpr->IgnoreParenImpCasts())) {
@@ -2401,7 +2401,7 @@ ExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo,
SourceLocation SuperLoc,
Selector Sel,
ObjCMethodDecl *Method,
- SourceLocation LBracLoc,
+ SourceLocation LBracLoc,
ArrayRef<SourceLocation> SelectorLocs,
SourceLocation RBracLoc,
MultiExprArg ArgsIn,
@@ -2431,7 +2431,7 @@ ExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo,
SelectorLocs, /*Method=*/nullptr, makeArrayRef(Args, NumArgs), RBracLoc,
isImplicit);
}
-
+
// Find the class to which we are sending this message.
ObjCInterfaceDecl *Class = nullptr;
const ObjCObjectType *ClassType = ReceiverType->getAs<ObjCObjectType>();
@@ -2446,7 +2446,7 @@ ExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo,
(void)DiagnoseUseOfDecl(Class, SelectorSlotLocs);
// Find the method we are messaging.
if (!Method) {
- SourceRange TypeRange
+ SourceRange TypeRange
= SuperLoc.isValid()? SourceRange(SuperLoc)
: ReceiverTypeInfo->getTypeLoc().getSourceRange();
if (RequireCompleteType(Loc, Context.getObjCInterfaceType(Class),
@@ -2455,7 +2455,7 @@ ExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo,
: diag::warn_receiver_forward_class),
TypeRange)) {
// A forward class used in messaging is treated as a 'Class'
- Method = LookupFactoryMethodInGlobalPool(Sel,
+ Method = LookupFactoryMethodInGlobalPool(Sel,
SourceRange(LBracLoc, RBracLoc));
if (Method && !getLangOpts().ObjCAutoRefCount)
Diag(Method->getLocation(), diag::note_method_sent_forward_class)
@@ -2490,7 +2490,7 @@ ExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo,
RequireCompleteType(LBracLoc, Method->getReturnType(),
diag::err_illegal_message_expr_incomplete_type))
return ExprError();
-
+
// Warn about explicit call of +initialize on its own class. But not on 'super'.
if (Method && Method->getMethodFamily() == OMF_initialize) {
if (!SuperLoc.isValid()) {
@@ -2513,19 +2513,19 @@ ExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo,
}
}
}
-
+
DiagnoseCStringFormatDirectiveInObjCAPI(*this, Method, Sel, Args, NumArgs);
-
+
// Construct the appropriate ObjCMessageExpr.
ObjCMessageExpr *Result;
if (SuperLoc.isValid())
- Result = ObjCMessageExpr::Create(Context, ReturnType, VK, LBracLoc,
- SuperLoc, /*IsInstanceSuper=*/false,
+ Result = ObjCMessageExpr::Create(Context, ReturnType, VK, LBracLoc,
+ SuperLoc, /*IsInstanceSuper=*/false,
ReceiverType, Sel, SelectorLocs,
Method, makeArrayRef(Args, NumArgs),
RBracLoc, isImplicit);
else {
- Result = ObjCMessageExpr::Create(Context, ReturnType, VK, LBracLoc,
+ Result = ObjCMessageExpr::Create(Context, ReturnType, VK, LBracLoc,
ReceiverTypeInfo, Sel, SelectorLocs,
Method, makeArrayRef(Args, NumArgs),
RBracLoc, isImplicit);
@@ -2541,7 +2541,7 @@ ExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo,
// ActOnClassMessage - used for both unary and keyword messages.
// ArgExprs is optional - if it is present, the number of expressions
// is obtained from Sel.getNumArgs().
-ExprResult Sema::ActOnClassMessage(Scope *S,
+ExprResult Sema::ActOnClassMessage(Scope *S,
ParsedType Receiver,
Selector Sel,
SourceLocation LBracLoc,
@@ -2556,7 +2556,7 @@ ExprResult Sema::ActOnClassMessage(Scope *S,
if (!ReceiverTypeInfo)
ReceiverTypeInfo = Context.getTrivialTypeSourceInfo(ReceiverType, LBracLoc);
- return BuildClassMessage(ReceiverTypeInfo, ReceiverType,
+ return BuildClassMessage(ReceiverTypeInfo, ReceiverType,
/*SuperLoc=*/SourceLocation(), Sel,
/*Method=*/nullptr, LBracLoc, SelectorLocs, RBracLoc,
Args);
@@ -2625,7 +2625,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
SourceLocation SuperLoc,
Selector Sel,
ObjCMethodDecl *Method,
- SourceLocation LBracLoc,
+ SourceLocation LBracLoc,
ArrayRef<SourceLocation> SelectorLocs,
SourceLocation RBracLoc,
MultiExprArg ArgsIn,
@@ -2691,15 +2691,15 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
// do nothing
} else if (!getLangOpts().ObjCAutoRefCount &&
!Context.getObjCIdType().isNull() &&
- (ReceiverType->isPointerType() ||
+ (ReceiverType->isPointerType() ||
ReceiverType->isIntegerType())) {
// Implicitly convert integers and pointers to 'id' but emit a warning.
// But not in ARC.
Diag(Loc, diag::warn_bad_receiver_type)
- << ReceiverType
+ << ReceiverType
<< Receiver->getSourceRange();
if (ReceiverType->isPointerType()) {
- Receiver = ImpCastExprToType(Receiver, Context.getObjCIdType(),
+ Receiver = ImpCastExprToType(Receiver, Context.getObjCIdType(),
CK_CPointerToObjCPointerCast).get();
} else {
// TODO: specialized warning on null receivers?
@@ -2828,7 +2828,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
// 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).
// And as long as message is not deprecated/unavailable (warn if it is).
- if (const ObjCObjectPointerType *QIdTy
+ if (const ObjCObjectPointerType *QIdTy
= ReceiverType->getAsObjCQualifiedIdType()) {
// Search protocols for instance methods.
Method = LookupMethodInQualifiedType(Sel, QIdTy, true);
@@ -2854,9 +2854,9 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
: SourceRange(SuperLoc))) {
if (getLangOpts().ObjCAutoRefCount)
return ExprError();
-
+
forwardClass = OCIType->getInterfaceDecl();
- Diag(Receiver ? Receiver->getLocStart()
+ Diag(Receiver ? Receiver->getLocStart()
: SuperLoc, diag::note_receiver_is_id);
Method = nullptr;
} else {
@@ -2866,7 +2866,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
if (!Method)
// Search protocol qualifiers.
Method = LookupMethodInQualifiedType(Sel, OCIType, true);
-
+
if (!Method) {
// If we have implementations in scope, check "private" methods.
Method = ClassDecl->lookupPrivateMethod(Sel);
@@ -2975,7 +2975,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
ReceiverType->isObjCQualifiedClassType());
if (CheckMessageArgumentTypes(ReceiverType, MultiExprArg(Args, NumArgs),
Sel, SelectorLocs, Method,
- ClassMessage, SuperLoc.isValid(),
+ ClassMessage, SuperLoc.isValid(),
LBracLoc, RBracLoc, RecRange, ReturnType, VK))
return ExprError();
@@ -2984,7 +2984,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
diag::err_illegal_message_expr_incomplete_type))
return ExprError();
- // In ARC, forbid the user from sending messages to
+ // In ARC, forbid the user from sending messages to
// retain/release/autorelease/dealloc/retainCount explicitly.
if (getLangOpts().ObjCAutoRefCount) {
ObjCMethodFamily family =
@@ -3013,13 +3013,13 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
Diag(SelLoc, diag::err_arc_illegal_explicit_message)
<< Sel << RecRange;
break;
-
+
case OMF_performSelector:
if (Method && NumArgs >= 1) {
if (const auto *SelExp =
dyn_cast<ObjCSelectorExpr>(Args[0]->IgnoreParens())) {
Selector ArgSel = SelExp->getSelector();
- ObjCMethodDecl *SelMethod =
+ ObjCMethodDecl *SelMethod =
LookupInstanceMethodInGlobalPool(ArgSel,
SelExp->getSourceRange());
if (!SelMethod)
@@ -3036,8 +3036,8 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
case OMF_init:
// Issue error, unless ns_returns_not_retained.
if (!SelMethod->hasAttr<NSReturnsNotRetainedAttr>()) {
- // selector names a +1 method
- Diag(SelLoc,
+ // selector names a +1 method
+ Diag(SelLoc,
diag::err_arc_perform_selector_retains);
Diag(SelMethod->getLocation(), diag::note_method_declared_at)
<< SelMethod->getDeclName();
@@ -3047,7 +3047,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
// +0 call. OK. unless ns_returns_retained.
if (SelMethod->hasAttr<NSReturnsRetainedAttr>()) {
// selector names a +1 method
- Diag(SelLoc,
+ Diag(SelLoc,
diag::err_arc_perform_selector_retains);
Diag(SelMethod->getLocation(), diag::note_method_declared_at)
<< SelMethod->getDeclName();
@@ -3066,13 +3066,13 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
}
DiagnoseCStringFormatDirectiveInObjCAPI(*this, Method, Sel, Args, NumArgs);
-
+
// Construct the appropriate ObjCMessageExpr instance.
ObjCMessageExpr *Result;
if (SuperLoc.isValid())
Result = ObjCMessageExpr::Create(Context, ReturnType, VK, LBracLoc,
SuperLoc, /*IsInstanceSuper=*/true,
- ReceiverType, Sel, SelectorLocs, Method,
+ ReceiverType, Sel, SelectorLocs, Method,
makeArrayRef(Args, NumArgs), RBracLoc,
isImplicit);
else {
@@ -3158,7 +3158,7 @@ static void RemoveSelectorFromWarningCache(Sema &S, Expr* Arg) {
// ArgExprs is optional - if it is present, the number of expressions
// is obtained from Sel.getNumArgs().
ExprResult Sema::ActOnInstanceMessage(Scope *S,
- Expr *Receiver,
+ Expr *Receiver,
Selector Sel,
SourceLocation LBracLoc,
ArrayRef<SourceLocation> SelectorLocs,
@@ -3173,7 +3173,7 @@ ExprResult Sema::ActOnInstanceMessage(Scope *S,
if (Result.isInvalid()) return ExprError();
Receiver = Result.get();
}
-
+
if (RespondsToSelectorSel.isNull()) {
IdentifierInfo *SelectorId = &Context.Idents.get("respondsToSelector");
RespondsToSelectorSel = Context.Selectors.getUnarySelector(SelectorId);
@@ -3218,13 +3218,13 @@ static bool isAnyCLike(ARCConversionTypeClass ACTC) {
static ARCConversionTypeClass classifyTypeForARCConversion(QualType type) {
bool isIndirect = false;
-
+
// Ignore an outermost reference type.
if (const ReferenceType *ref = type->getAs<ReferenceType>()) {
type = ref->getPointeeType();
isIndirect = true;
}
-
+
// Drill through pointers and arrays recursively.
while (true) {
if (const PointerType *ptr = type->getAs<PointerType>()) {
@@ -3242,7 +3242,7 @@ static ARCConversionTypeClass classifyTypeForARCConversion(QualType type) {
}
isIndirect = true;
}
-
+
if (isIndirect) {
if (type->isObjCARCBridgableType())
return ACTC_indirectRetainable;
@@ -3322,7 +3322,7 @@ namespace {
return ACC_invalid;
}
-
+
/// Look through certain implicit and explicit casts.
ACCResult VisitCastExpr(CastExpr *e) {
switch (e->getCastKind()) {
@@ -3428,10 +3428,10 @@ namespace {
// Otherwise, don't do anything implicit with an unaudited function.
if (!fn->hasAttr<CFAuditedTransferAttr>())
return ACC_invalid;
-
+
// Otherwise, it's +0 unless it follows the create convention.
if (ento::coreFoundation::followsCreateRule(fn))
- return Diagnose ? ACC_plusOne
+ return Diagnose ? ACC_plusOne
: ACC_invalid; // ACC_plusOne if we start accepting this
return ACC_plusZero;
@@ -3458,7 +3458,7 @@ namespace {
// return type is CF.
if (!isAnyRetainable(TargetClass) || !isCFType(method->getReturnType()))
return ACC_invalid;
-
+
// If the method is explicitly marked not-retained, it's +0.
if (method->hasAttr<CFReturnsNotRetainedAttr>())
return ACC_plusZero;
@@ -3517,12 +3517,12 @@ static void addFixitForObjCARCConversion(Sema &S,
SourceRange range(NCE->getOperatorLoc(),
NCE->getAngleBrackets().getEnd());
SmallString<32> BridgeCall;
-
+
SourceManager &SM = S.getSourceManager();
char PrevChar = *SM.getCharacterData(range.getBegin().getLocWithOffset(-1));
if (Lexer::isIdentifierBodyChar(PrevChar, S.getLangOpts()))
BridgeCall += ' ';
-
+
BridgeCall += CFBridgeName;
DiagB.AddFixItHint(FixItHint::CreateReplacement(range, BridgeCall));
}
@@ -3623,7 +3623,7 @@ diagnoseObjCARCConversion(Sema &S, SourceRange castRange,
Sema::CheckedConversionKind CCK) {
SourceLocation loc =
(castRange.isValid() ? castRange.getBegin() : castExpr->getExprLoc());
-
+
if (S.makeUnavailableInSystemHeader(loc,
UnavailableAttr::IR_ARCForbiddenConversion))
return;
@@ -3637,7 +3637,7 @@ diagnoseObjCARCConversion(Sema &S, SourceRange castRange,
(exprACTC == ACTC_coreFoundation && castACTC == ACTC_retainable &&
ObjCBridgeRelatedAttrFromType(castExprType, TDNDecl)))
return;
-
+
unsigned srcKind = 0;
switch (exprACTC) {
case ACTC_none:
@@ -3652,7 +3652,7 @@ diagnoseObjCARCConversion(Sema &S, SourceRange castRange,
srcKind = 4;
break;
}
-
+
// Check whether this could be fixed with a bridge cast.
SourceLocation afterLParen = S.getLocForEndOfToken(castRange.getBegin());
SourceLocation noteLoc = afterLParen.isValid() ? afterLParen : loc;
@@ -3671,12 +3671,12 @@ diagnoseObjCARCConversion(Sema &S, SourceRange castRange,
<< castRange
<< castExpr->getSourceRange();
bool br = S.isKnownName("CFBridgingRelease");
- ACCResult CreateRule =
+ ACCResult CreateRule =
ARCCastChecker(S.Context, exprACTC, castACTC, true).Visit(castExpr);
assert(CreateRule != ACC_bottom && "This cast should already be accepted.");
if (CreateRule != ACC_plusOne)
{
- DiagnosticBuilder DiagB =
+ DiagnosticBuilder DiagB =
(CCK != Sema::CCK_OtherCast) ? S.Diag(noteLoc, diag::note_arc_bridge)
: S.Diag(noteLoc, diag::note_arc_cstyle_bridge);
@@ -3700,7 +3700,7 @@ diagnoseObjCARCConversion(Sema &S, SourceRange castRange,
return;
}
-
+
// Bridge from a CF type to an ARC type.
if (exprACTC == ACTC_retainable && isAnyRetainable(castACTC)) {
bool br = S.isKnownName("CFBridgingRetain");
@@ -3712,7 +3712,7 @@ diagnoseObjCARCConversion(Sema &S, SourceRange castRange,
<< castType
<< castRange
<< castExpr->getSourceRange();
- ACCResult CreateRule =
+ ACCResult CreateRule =
ARCCastChecker(S.Context, exprACTC, castACTC, true).Visit(castExpr);
assert(CreateRule != ACC_bottom && "This cast should already be accepted.");
if (CreateRule != ACC_plusOne)
@@ -3740,7 +3740,7 @@ diagnoseObjCARCConversion(Sema &S, SourceRange castRange,
return;
}
-
+
S.Diag(loc, diag::err_arc_mismatched_cast)
<< !convKindForDiag
<< srcKind << castExprType << castType
@@ -3759,7 +3759,7 @@ static bool CheckObjCBridgeNSCast(Sema &S, QualType castType, Expr *castExpr,
HadTheAttribute = true;
if (Parm->isStr("id"))
return true;
-
+
NamedDecl *Target = nullptr;
// Check for an existing type with this name.
LookupResult R(S, DeclarationName(Parm), SourceLocation(),
@@ -3897,7 +3897,7 @@ void Sema::CheckTollFreeBridgeCast(QualType castType, Expr *castExpr) {
HasObjCBridgeMutableAttr, false);
if (ObjCBridgeMutableAttrWillNotWarn && HasObjCBridgeMutableAttr)
return;
-
+
if (HasObjCBridgeAttr)
CheckObjCBridgeNSCast<ObjCBridgeAttr>(*this, castType, castExpr, HasObjCBridgeAttr,
true);
@@ -3918,7 +3918,7 @@ void Sema::CheckTollFreeBridgeCast(QualType castType, Expr *castExpr) {
HasObjCBridgeMutableAttr, false);
if (ObjCBridgeMutableAttrWillNotWarn && HasObjCBridgeMutableAttr)
return;
-
+
if (HasObjCBridgeAttr)
CheckObjCBridgeCFCast<ObjCBridgeAttr>(*this, castType, castExpr, HasObjCBridgeAttr,
true);
@@ -3940,7 +3940,7 @@ void Sema::CheckObjCBridgeRelatedCast(QualType castType, Expr *castExpr) {
SrcType = Getter->getReturnType();
}
}
-
+
ARCConversionTypeClass srcExprACTC = classifyTypeForARCConversion(SrcType);
ARCConversionTypeClass castExprACTC = classifyTypeForARCConversion(castType);
if (srcExprACTC != ACTC_retainable || castExprACTC != ACTC_coreFoundation)
@@ -3977,7 +3977,7 @@ bool Sema::checkObjCBridgeRelatedComponents(SourceLocation Loc,
ObjCBridgeRelatedAttr *ObjCBAttr = ObjCBridgeRelatedAttrFromType(T, TDNDecl);
if (!ObjCBAttr)
return false;
-
+
IdentifierInfo *RCId = ObjCBAttr->getRelatedClass();
IdentifierInfo *CMId = ObjCBAttr->getClassMethod();
IdentifierInfo *IMId = ObjCBAttr->getInstanceMethod();
@@ -4008,7 +4008,7 @@ bool Sema::checkObjCBridgeRelatedComponents(SourceLocation Loc,
}
return false;
}
-
+
// Check for an existing class method with the given selector name.
if (CfToNs && CMId) {
Selector Sel = Context.Selectors.getUnarySelector(CMId);
@@ -4022,7 +4022,7 @@ bool Sema::checkObjCBridgeRelatedComponents(SourceLocation Loc,
return false;
}
}
-
+
// Check for an existing instance method with the given selector name.
if (!CfToNs && IMId) {
Selector Sel = Context.Selectors.getNullarySelector(IMId);
@@ -4049,7 +4049,7 @@ Sema::CheckObjCBridgeRelatedConversions(SourceLocation Loc,
bool NsToCf = (rhsExprACTC == ACTC_retainable && lhsExprACTC == ACTC_coreFoundation);
if (!CfToNs && !NsToCf)
return false;
-
+
ObjCInterfaceDecl *RelatedClass;
ObjCMethodDecl *ClassMethod = nullptr;
ObjCMethodDecl *InstanceMethod = nullptr;
@@ -4058,7 +4058,7 @@ Sema::CheckObjCBridgeRelatedConversions(SourceLocation Loc,
ClassMethod, InstanceMethod, TDNDecl,
CfToNs, Diagnose))
return false;
-
+
if (CfToNs) {
// Implicit conversion from CF to ObjC object is needed.
if (ClassMethod) {
@@ -4075,7 +4075,7 @@ Sema::CheckObjCBridgeRelatedConversions(SourceLocation Loc,
<< FixItHint::CreateInsertion(SrcExprEndLoc, "]");
Diag(RelatedClass->getLocStart(), diag::note_declared_at);
Diag(TDNDecl->getLocStart(), diag::note_declared_at);
-
+
QualType receiverType = Context.getObjCInterfaceType(RelatedClass);
// Argument.
Expr *args[] = { SrcExpr };
@@ -4118,7 +4118,7 @@ Sema::CheckObjCBridgeRelatedConversions(SourceLocation Loc,
}
Diag(RelatedClass->getLocStart(), diag::note_declared_at);
Diag(TDNDecl->getLocStart(), diag::note_declared_at);
-
+
ExprResult msg =
BuildInstanceMessageImplicit(SrcExpr, SrcType,
InstanceMethod->getLocation(),
@@ -4144,7 +4144,7 @@ Sema::CheckObjCConversion(SourceRange castRange, QualType castType,
QualType effCastType = castType;
if (const ReferenceType *ref = castType->getAs<ReferenceType>())
effCastType = ref->getPointeeType();
-
+
ARCConversionTypeClass exprACTC = classifyTypeForARCConversion(castExprType);
ARCConversionTypeClass castACTC = classifyTypeForARCConversion(effCastType);
if (exprACTC == castACTC) {
@@ -4167,7 +4167,7 @@ Sema::CheckObjCConversion(SourceRange castRange, QualType castType,
if (QDT != castType &&
QDT.getObjCLifetime() != Qualifiers::OCL_None) {
if (Diagnose) {
- SourceLocation loc = (castRange.isValid() ? castRange.getBegin()
+ SourceLocation loc = (castRange.isValid() ? castRange.getBegin()
: castExpr->getExprLoc());
Diag(loc, diag::err_arc_nolifetime_behavior);
}
@@ -4188,7 +4188,7 @@ Sema::CheckObjCConversion(SourceRange castRange, QualType castType,
// vice-versa).
if (castACTC == ACTC_none && castType->isIntegralType(Context))
return ACR_okay;
-
+
// Allow casts between pointers to lifetime types (e.g., __strong id*)
// and pointers to void (e.g., cv void *). Casting from void* to lifetime*
// must be explicit.
@@ -4229,7 +4229,7 @@ Sema::CheckObjCConversion(SourceRange castRange, QualType castType,
if (castACTC == ACTC_retainable && exprACTC == ACTC_none &&
ConversionToObjCStringLiteralCheck(castType, castExpr, Diagnose))
return ACR_error;
-
+
// Do not issue "bridge cast" diagnostic when implicit casting
// a retainable object to a CF type parameter belonging to an audited
// CF API function. Let caller issue a normal type mismatched diagnostic
@@ -4322,9 +4322,9 @@ Expr *Sema::stripARCUnbridgedCast(Expr *e) {
bool Sema::CheckObjCARCUnavailableWeakConversion(QualType castType,
QualType exprType) {
- QualType canCastType =
+ QualType canCastType =
Context.getCanonicalType(castType).getUnqualifiedType();
- QualType canExprType =
+ QualType canExprType =
Context.getCanonicalType(exprType).getUnqualifiedType();
if (isa<ObjCObjectPointerType>(canCastType) &&
castType.getObjCLifetime() == Qualifiers::OCL_Weak &&
@@ -4399,7 +4399,7 @@ ExprResult Sema::BuildObjCBridgedCast(SourceLocation LParenLoc,
switch (Kind) {
case OBC_Bridge:
break;
-
+
case OBC_BridgeRetained: {
bool br = isKnownName("CFBridgingRelease");
Diag(BridgeKeywordLoc, diag::err_arc_bridge_cast_wrong_kind)
@@ -4413,14 +4413,14 @@ ExprResult Sema::BuildObjCBridgedCast(SourceLocation LParenLoc,
<< FixItHint::CreateReplacement(BridgeKeywordLoc, "__bridge");
Diag(BridgeKeywordLoc, diag::note_arc_bridge_transfer)
<< FromType << br
- << FixItHint::CreateReplacement(BridgeKeywordLoc,
- br ? "CFBridgingRelease "
+ << FixItHint::CreateReplacement(BridgeKeywordLoc,
+ br ? "CFBridgingRelease "
: "__bridge_transfer ");
Kind = OBC_Bridge;
break;
}
-
+
case OBC_BridgeTransfer:
// We must consume the Objective-C object produced by the cast.
MustConsume = true;
@@ -4435,14 +4435,14 @@ ExprResult Sema::BuildObjCBridgedCast(SourceLocation LParenLoc,
// is very dangerous, so we don't do it.
SubExpr = maybeUndoReclaimObject(SubExpr);
break;
-
- case OBC_BridgeRetained:
+
+ case OBC_BridgeRetained:
// Produce the object before casting it.
SubExpr = ImplicitCastExpr::Create(Context, FromType,
CK_ARCProduceObject,
SubExpr, nullptr, VK_RValue);
break;
-
+
case OBC_BridgeTransfer: {
bool br = isKnownName("CFBridgingRetain");
Diag(BridgeKeywordLoc, diag::err_arc_bridge_cast_wrong_kind)
@@ -4452,14 +4452,14 @@ ExprResult Sema::BuildObjCBridgedCast(SourceLocation LParenLoc,
<< T
<< SubExpr->getSourceRange()
<< Kind;
-
+
Diag(BridgeKeywordLoc, diag::note_arc_bridge)
<< FixItHint::CreateReplacement(BridgeKeywordLoc, "__bridge ");
Diag(BridgeKeywordLoc, diag::note_arc_bridge_retained)
<< T << br
- << FixItHint::CreateReplacement(BridgeKeywordLoc,
+ << FixItHint::CreateReplacement(BridgeKeywordLoc,
br ? "CFBridgingRetain " : "__bridge_retained");
-
+
Kind = OBC_Bridge;
break;
}
@@ -4475,13 +4475,13 @@ ExprResult Sema::BuildObjCBridgedCast(SourceLocation LParenLoc,
Expr *Result = new (Context) ObjCBridgedCastExpr(LParenLoc, Kind, CK,
BridgeKeywordLoc,
TSInfo, SubExpr);
-
+
if (MustConsume) {
Cleanup.setExprNeedsCleanups(true);
- Result = ImplicitCastExpr::Create(Context, T, CK_ARCConsumeObject, Result,
+ Result = ImplicitCastExpr::Create(Context, T, CK_ARCConsumeObject, Result,
nullptr, VK_RValue);
}
-
+
return Result;
}
@@ -4498,6 +4498,6 @@ ExprResult Sema::ActOnObjCBridgedCast(Scope *S,
CheckTollFreeBridgeCast(T, SubExpr);
if (!TSInfo)
TSInfo = Context.getTrivialTypeSourceInfo(T, LParenLoc);
- return BuildObjCBridgedCast(LParenLoc, Kind, BridgeKeywordLoc, TSInfo,
+ return BuildObjCBridgedCast(LParenLoc, Kind, BridgeKeywordLoc, TSInfo,
SubExpr);
}
OpenPOWER on IntegriCloud