r338291 - Remove trailing space
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 30 12:24:50 PDT 2018
Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Mon Jul 30 12:24:48 2018
@@ -73,7 +73,7 @@ ExprResult Sema::ParseObjCStringLiteral(
/*Pascal=*/false, StrTy, &StrLocs[0],
StrLocs.size());
}
-
+
return BuildObjCStringLiteral(AtLocs[0], S);
}
@@ -92,12 +92,12 @@ ExprResult Sema::BuildObjCStringLiteral(
} 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(
// 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 *getNSNumberFactor
}
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 *getNSNumberFactor
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 *getNSNumberFactor
// 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
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
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 CheckObjCCollectionLit
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 CheckObjCCollectionLit
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 CheckObjCCollectionLit
: (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 CheckObjCCollectionLit
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 CheckObjCCollectionLit
}
}
- // 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(Sour
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(Sour
StringWithUTF8StringMethod = BoxingMethod;
}
-
+
BoxingMethod = StringWithUTF8StringMethod;
BoxedType = NSStringPointer;
// Transfer the nullability from method's return type.
@@ -588,22 +588,22 @@ ExprResult Sema::BuildObjCBoxedExpr(Sour
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(Sour
} 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(Sour
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(Sour
/*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(Sour
/*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(Sour
/*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(Sour
<< 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(Sour
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::BuildObjCSubscriptExpre
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(S
// 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(S
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::BuildObjCDictionaryLite
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::BuildObjCDictionaryLite
// 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::BuildObjCDictionaryLite
// 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::BuildObjCDictionaryLite
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::BuildObjCDictionaryLite
err = !Context.hasSameUnqualifiedType(PtrKey->getPointeeType(),
QIDNSCopying);
}
-
+
if (err) {
Diag(SR.getBegin(), diag::err_objc_literal_method_sig)
<< Sel;
@@ -1008,7 +1008,7 @@ ExprResult Sema::BuildObjCDictionaryLite
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::BuildObjCDictionaryLite
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::BuildObjCDictionaryLite
Element.Value->getLocEnd());
return ExprError();
}
-
+
HasPackExpansions = true;
}
-
+
QualType Ty
= Context.getObjCObjectPointerType(
Context.getObjCInterfaceType(NSDictionaryDecl));
@@ -1147,7 +1147,7 @@ static void DiagnoseMismatchedSelectors(
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::ParseObjCSelectorExpres
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::ParseObjCSelectorExpres
!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::ParseObjCSelectorExpres
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(AS
if (T == Context.getObjCInstanceType())
return Context.getObjCIdType();
-
+
return origType;
}
@@ -1313,7 +1313,7 @@ static QualType getBaseMessageSendResult
// 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 getBaseMessageSendResult
// 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 O
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(con
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(con
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(Qua
}
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(Qua
return false;
}
- ReturnType = getMessageSendResultType(ReceiverType, Method, isClassMessage,
+ ReturnType = getMessageSendResultType(ReceiverType, Method, isClassMessage,
isSuperMessage);
VK = Expr::getValueKindForType(Method->getReturnType());
@@ -1751,7 +1751,7 @@ ObjCMethodDecl *Sema::LookupMethodInObje
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 ObjCObje
}
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 ObjCObje
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 ObjCObje
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 ObjCObje
}
}
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::getObjCMessa
// 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::getObjCMessa
}
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::getObjCMessa
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
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(
}
if (!Format || NumArgs <= Idx)
return;
-
+
Expr *FormatExpr = Args[Idx];
if (ObjCStringLiteral *OSL =
dyn_cast<ObjCStringLiteral>(FormatExpr->IgnoreParenImpCasts())) {
@@ -2401,7 +2401,7 @@ ExprResult Sema::BuildClassMessage(TypeS
SourceLocation SuperLoc,
Selector Sel,
ObjCMethodDecl *Method,
- SourceLocation LBracLoc,
+ SourceLocation LBracLoc,
ArrayRef<SourceLocation> SelectorLocs,
SourceLocation RBracLoc,
MultiExprArg ArgsIn,
@@ -2431,7 +2431,7 @@ ExprResult Sema::BuildClassMessage(TypeS
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(TypeS
(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(TypeS
: 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(TypeS
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(TypeS
}
}
}
-
+
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(TypeS
// 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
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(Ex
SourceLocation SuperLoc,
Selector Sel,
ObjCMethodDecl *Method,
- SourceLocation LBracLoc,
+ SourceLocation LBracLoc,
ArrayRef<SourceLocation> SelectorLocs,
SourceLocation RBracLoc,
MultiExprArg ArgsIn,
@@ -2691,15 +2691,15 @@ ExprResult Sema::BuildInstanceMessage(Ex
// 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(Ex
// 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(Ex
: 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(Ex
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(Ex
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(Ex
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(Ex
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(Ex
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(Ex
// +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(Ex
}
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 RemoveSelectorFromWarningCac
// 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(Sc
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(ARCConversionType
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 classifyTy
}
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
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, Sourc
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, Sourc
(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, Sourc
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, Sourc
<< 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, Sourc
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, Sourc
<< 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, Sourc
return;
}
-
+
S.Diag(loc, diag::err_arc_mismatched_cast)
<< !convKindForDiag
<< srcKind << castExprType << castType
@@ -3759,7 +3759,7 @@ static bool CheckObjCBridgeNSCast(Sema &
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(QualT
HasObjCBridgeMutableAttr, false);
if (ObjCBridgeMutableAttrWillNotWarn && HasObjCBridgeMutableAttr)
return;
-
+
if (HasObjCBridgeAttr)
CheckObjCBridgeNSCast<ObjCBridgeAttr>(*this, castType, castExpr, HasObjCBridgeAttr,
true);
@@ -3918,7 +3918,7 @@ void Sema::CheckTollFreeBridgeCast(QualT
HasObjCBridgeMutableAttr, false);
if (ObjCBridgeMutableAttrWillNotWarn && HasObjCBridgeMutableAttr)
return;
-
+
if (HasObjCBridgeAttr)
CheckObjCBridgeCFCast<ObjCBridgeAttr>(*this, castType, castExpr, HasObjCBridgeAttr,
true);
@@ -3940,7 +3940,7 @@ void Sema::CheckObjCBridgeRelatedCast(Qu
SrcType = Getter->getReturnType();
}
}
-
+
ARCConversionTypeClass srcExprACTC = classifyTypeForARCConversion(SrcType);
ARCConversionTypeClass castExprACTC = classifyTypeForARCConversion(castType);
if (srcExprACTC != ACTC_retainable || castExprACTC != ACTC_coreFoundation)
@@ -3977,7 +3977,7 @@ bool Sema::checkObjCBridgeRelatedCompone
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::checkObjCBridgeRelatedCompone
}
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::checkObjCBridgeRelatedCompone
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(
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(
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(
<< 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(
}
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 ca
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 ca
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 ca
// 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 ca
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 *
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(So
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(So
<< 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(So
// 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(So
<< 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(So
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(Sc
CheckTollFreeBridgeCast(T, SubExpr);
if (!TSInfo)
TSInfo = Context.getTrivialTypeSourceInfo(T, LParenLoc);
- return BuildObjCBridgedCast(LParenLoc, Kind, BridgeKeywordLoc, TSInfo,
+ return BuildObjCBridgedCast(LParenLoc, Kind, BridgeKeywordLoc, TSInfo,
SubExpr);
}
Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Mon Jul 30 12:24:48 2018
@@ -191,7 +191,7 @@ static void CheckStringInit(Expr *Str, Q
if (SL->isPascal())
StrLength--;
}
-
+
// [dcl.init.string]p2
if (StrLength > CAT->getSize().getZExtValue())
S.Diag(Str->getLocStart(),
@@ -450,7 +450,7 @@ ExprResult InitListChecker::PerformEmpty
IsInStd = true;
}
- if (IsInStd && llvm::StringSwitch<bool>(R->getName())
+ if (IsInStd && llvm::StringSwitch<bool>(R->getName())
.Cases("basic_string", "deque", "forward_list", true)
.Cases("list", "map", "multimap", "multiset", true)
.Cases("priority_queue", "queue", "set", "stack", true)
@@ -1578,7 +1578,7 @@ void InitListChecker::CheckVectorType(co
T->getVectorKind() == VectorType::NeonPolyVector)) {
// The ability to use vector initializer lists is a GNU vector extension
// and is unrelated to the NEON intrinsics in arm_neon.h. On little
- // endian machines it works fine, however on big endian machines it
+ // endian machines it works fine, however on big endian machines it
// exhibits surprising behaviour:
//
// uint32x2_t x = {42, 64};
@@ -2225,7 +2225,7 @@ InitListChecker::CheckDesignatedInitiali
SemaRef.Diag(D->getLocStart(),
diag::warn_subobject_initializer_overrides)
<< SourceRange(D->getLocStart(), DIE->getLocEnd());
-
+
SemaRef.Diag(ExistingInit->getLocStart(),
diag::note_previous_initializer)
<< /*FIXME:has side effects=*/0
@@ -3000,7 +3000,7 @@ DeclarationName InitializedEntity::getNa
case EK_LambdaCapture:
return DeclarationName(Capture.VarID);
-
+
case EK_Result:
case EK_StmtExprResult:
case EK_Exception:
@@ -3653,13 +3653,13 @@ ResolveConstructorOverload(Sema &S, Sour
CandidateSet, SuppressUserConversions);
else {
// C++ [over.match.copy]p1:
- // - When initializing a temporary to be bound to the first parameter
+ // - When initializing a temporary to be bound to the first parameter
// of a constructor [for type T] that takes a reference to possibly
// cv-qualified T as its first argument, called with a single
// argument in the context of direct-initialization, explicit
// conversion functions are also considered.
// FIXME: What if a constructor template instantiates to such a signature?
- bool AllowExplicitConv = AllowExplicit && !CopyInitializing &&
+ bool AllowExplicitConv = AllowExplicit && !CopyInitializing &&
Args.size() == 1 &&
hasCopyOrMoveCtorParam(S.Context, Info);
S.AddOverloadCandidate(Info.Constructor, Info.FoundDecl, Args,
@@ -4226,7 +4226,7 @@ static OverloadingResult TryRefInitWithC
(void)DerivedToBase;
(void)ObjCConversion;
(void)ObjCLifetimeConversion;
-
+
// Build the candidate set directly in the initialization sequence
// structure, so that it will persist if we fail.
OverloadCandidateSet &CandidateSet = Sequence.getFailedCandidateSet();
@@ -4646,7 +4646,7 @@ static void TryReferenceInitializationCo
/*FIXME:InOverloadResolution=*/false,
/*CStyle=*/Kind.isCStyleOrFunctionalCast(),
/*AllowObjCWritebackConversion=*/false);
-
+
if (ICS.isBad()) {
// FIXME: Use the conversion function set stored in ICS to turn
// this into an overloading ambiguity diagnostic. However, we need
@@ -4787,7 +4787,7 @@ static void TryDefaultInitialization(Sem
// To default-initialize an object of type T means:
// - if T is an array type, each element is default-initialized;
QualType DestType = S.Context.getBaseElementType(Entity.getType());
-
+
// - if T is a (possibly cv-qualified) class type (Clause 9), the default
// constructor for T is called (and the initialization is ill-formed if
// T has no accessible default constructor);
@@ -5043,11 +5043,11 @@ static InvalidICRKind isInvalidICRSource
// If we have a declaration reference, it had better be a local variable.
} else if (isa<DeclRefExpr>(e)) {
- // set isWeakAccess to true, to mean that there will be an implicit
+ // set isWeakAccess to true, to mean that there will be an implicit
// load which requires a cleanup.
if (e->getType().getObjCLifetime() == Qualifiers::OCL_Weak)
isWeakAccess = true;
-
+
if (!isAddressOf) return IIK_nonlocal;
VarDecl *var = dyn_cast<VarDecl>(cast<DeclRefExpr>(e)->getDecl());
@@ -5082,7 +5082,7 @@ static void checkIndirectCopyRestoreSour
assert(src->isRValue());
bool isWeakAccess = false;
InvalidICRKind iik = isInvalidICRSource(S.Context, src, false, isWeakAccess);
- // If isWeakAccess to true, there will be an implicit
+ // If isWeakAccess to true, there will be an implicit
// load which requires a cleanup.
if (S.getLangOpts().ObjCAutoRefCount && isWeakAccess)
S.Cleanup.setExprNeedsCleanups(true);
@@ -5124,7 +5124,7 @@ static bool tryObjCWritebackConversion(S
ArgPointee = ArgArrayType->getElementType();
ArgType = S.Context.getPointerType(ArgPointee);
}
-
+
// Handle write-back conversion.
QualType ConvertedArgType;
if (!S.isObjCWritebackConversion(ArgType, Entity.getType(),
@@ -5151,10 +5151,10 @@ static bool tryObjCWritebackConversion(S
ICS.Standard.First = ICK_Lvalue_To_Rvalue;
ResultType = Initializer->getType().getNonLValueExprType(S.Context);
}
-
+
Sequence.AddConversionSequenceStep(ICS, ResultType);
}
-
+
Sequence.AddPassByIndirectCopyRestoreStep(Entity.getType(), ShouldCopy);
return true;
}
@@ -5567,13 +5567,13 @@ void InitializationSequence::InitializeF
if (ICS.isStandard() &&
ICS.Standard.Second == ICK_Writeback_Conversion) {
// Objective-C ARC writeback conversion.
-
+
// We should copy unless we're passing to an argument explicitly
// marked 'out'.
bool ShouldCopy = true;
if (ParmVarDecl *Param = cast_or_null<ParmVarDecl>(Entity.getDecl()))
ShouldCopy = (Param->getObjCDeclQualifier() != ParmVarDecl::OBJC_TQ_Out);
-
+
// If there was an lvalue adjustment, add it as a separate conversion.
if (ICS.Standard.First == ICK_Array_To_Pointer ||
ICS.Standard.First == ICK_Lvalue_To_Rvalue) {
@@ -5584,7 +5584,7 @@ void InitializationSequence::InitializeF
LvalueICS.Standard.First = ICS.Standard.First;
AddConversionSequenceStep(LvalueICS, ICS.Standard.getToType(0));
}
-
+
AddPassByIndirectCopyRestoreStep(DestType, ShouldCopy);
} else if (ICS.isBad()) {
DeclAccessPair dap;
@@ -5635,9 +5635,9 @@ getAssignmentAction(const InitializedEnt
if (Entity.getDecl() &&
isa<ObjCMethodDecl>(Entity.getDecl()->getDeclContext()))
return Sema::AA_Sending;
-
+
return !Diagnose ? Sema::AA_Passing : Sema::AA_Passing_CFAudited;
-
+
case InitializedEntity::EK_Result:
case InitializedEntity::EK_StmtExprResult: // FIXME: Not quite right.
return Sema::AA_Returning;
@@ -5743,7 +5743,7 @@ static SourceLocation getInitializationL
case InitializedEntity::EK_LambdaCapture:
return Entity.getCaptureLoc();
-
+
case InitializedEntity::EK_ArrayElement:
case InitializedEntity::EK_Member:
case InitializedEntity::EK_Parameter:
@@ -6065,9 +6065,9 @@ PerformConstructorInitialization(Sema &S
ExprResult CurInit((Expr *)nullptr);
// C++ [over.match.copy]p1:
- // - When initializing a temporary to be bound to the first parameter
- // of a constructor that takes a reference to possibly cv-qualified
- // T as its first argument, called with a single argument in the
+ // - When initializing a temporary to be bound to the first parameter
+ // of a constructor that takes a reference to possibly cv-qualified
+ // T as its first argument, called with a single argument in the
// context of direct-initialization, explicit conversion functions
// are also considered.
bool AllowExplicitConv =
@@ -7130,7 +7130,7 @@ InitializationSequence::Perform(Sema &S,
Args);
}
assert(Kind.getKind() == InitializationKind::IK_Copy ||
- Kind.isExplicitCast() ||
+ Kind.isExplicitCast() ||
Kind.getKind() == InitializationKind::IK_DirectList);
return ExprResult(Args[0]);
}
@@ -7832,7 +7832,7 @@ InitializationSequence::Perform(Sema &S,
// this has already been done when parsing the variable declaration.
if (!Init->isConstantInitializer(S.Context, false))
break;
-
+
if (!SourceType->isIntegerType() ||
32 != S.Context.getIntWidth(SourceType)) {
S.Diag(Kind.getLocation(), diag::err_sampler_initializer_not_integer)
@@ -7868,7 +7868,7 @@ InitializationSequence::Perform(Sema &S,
break;
}
case SK_OCLZeroEvent: {
- assert(Step->Type->isEventT() &&
+ assert(Step->Type->isEventT() &&
"Event initialization on non-event type.");
CurInit = S.ImpCastExprToType(CurInit.get(), Step->Type,
@@ -8365,7 +8365,7 @@ bool InitializationSequence::Diagnose(Se
llvm_unreachable("Inconsistent overload resolution?");
break;
}
-
+
// If this is a defaulted or implicitly-declared function, then
// it was implicitly deleted. Make it clear that the deletion was
// implicit.
Modified: cfe/trunk/lib/Sema/SemaLambda.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLambda.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLambda.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLambda.cpp Mon Jul 30 12:24:48 2018
@@ -25,28 +25,28 @@ using namespace clang;
using namespace sema;
/// Examines the FunctionScopeInfo stack to determine the nearest
-/// enclosing lambda (to the current lambda) that is 'capture-ready' for
+/// enclosing lambda (to the current lambda) that is 'capture-ready' for
/// the variable referenced in the current lambda (i.e. \p VarToCapture).
/// If successful, returns the index into Sema's FunctionScopeInfo stack
/// of the capture-ready lambda's LambdaScopeInfo.
-///
-/// Climbs down the stack of lambdas (deepest nested lambda - i.e. current
+///
+/// Climbs down the stack of lambdas (deepest nested lambda - i.e. current
/// lambda - is on top) to determine the index of the nearest enclosing/outer
-/// lambda that is ready to capture the \p VarToCapture being referenced in
-/// the current lambda.
+/// lambda that is ready to capture the \p VarToCapture being referenced in
+/// the current lambda.
/// As we climb down the stack, we want the index of the first such lambda -
-/// that is the lambda with the highest index that is 'capture-ready'.
-///
+/// that is the lambda with the highest index that is 'capture-ready'.
+///
/// A lambda 'L' is capture-ready for 'V' (var or this) if:
/// - its enclosing context is non-dependent
/// - and if the chain of lambdas between L and the lambda in which
-/// V is potentially used (i.e. the lambda at the top of the scope info
+/// V is potentially used (i.e. the lambda at the top of the scope info
/// stack), can all capture or have already captured V.
/// If \p VarToCapture is 'null' then we are trying to capture 'this'.
-///
+///
/// Note that a lambda that is deemed 'capture-ready' still needs to be checked
/// for whether it is 'capture-capable' (see
-/// getStackIndexOfNearestEnclosingCaptureCapableLambda), before it can truly
+/// getStackIndexOfNearestEnclosingCaptureCapableLambda), before it can truly
/// capture.
///
/// \param FunctionScopes - Sema's stack of nested FunctionScopeInfo's (which a
@@ -120,7 +120,7 @@ getStackIndexOfNearestEnclosingCaptureRe
return NoLambdaIsCaptureReady;
}
EnclosingDC = getLambdaAwareParentOfDeclContext(EnclosingDC);
-
+
assert(CurScopeIndex);
--CurScopeIndex;
} while (!EnclosingDC->isTranslationUnit() &&
@@ -136,13 +136,13 @@ getStackIndexOfNearestEnclosingCaptureRe
}
/// Examines the FunctionScopeInfo stack to determine the nearest
-/// enclosing lambda (to the current lambda) that is 'capture-capable' for
+/// enclosing lambda (to the current lambda) that is 'capture-capable' for
/// the variable referenced in the current lambda (i.e. \p VarToCapture).
/// If successful, returns the index into Sema's FunctionScopeInfo stack
/// of the capture-capable lambda's LambdaScopeInfo.
///
/// Given the current stack of lambdas being processed by Sema and
-/// the variable of interest, to identify the nearest enclosing lambda (to the
+/// the variable of interest, to identify the nearest enclosing lambda (to the
/// current lambda at the top of the stack) that can truly capture
/// a variable, it has to have the following two properties:
/// a) 'capture-ready' - be the innermost lambda that is 'capture-ready':
@@ -175,7 +175,7 @@ Optional<unsigned> clang::getStackIndexO
VarDecl *VarToCapture, Sema &S) {
const Optional<unsigned> NoLambdaIsCaptureCapable;
-
+
const Optional<unsigned> OptionalStackIndex =
getStackIndexOfNearestEnclosingCaptureReadyLambda(FunctionScopes,
VarToCapture);
@@ -190,7 +190,7 @@ Optional<unsigned> clang::getStackIndexO
const sema::LambdaScopeInfo *const CaptureReadyLambdaLSI =
cast<sema::LambdaScopeInfo>(FunctionScopes[IndexOfCaptureReadyLambda]);
-
+
// If VarToCapture is null, we are attempting to capture 'this'
const bool IsCapturingThis = !VarToCapture;
const bool IsCapturingVariable = !IsCapturingThis;
@@ -220,7 +220,7 @@ Optional<unsigned> clang::getStackIndexO
&IndexOfCaptureReadyLambda);
if (!CanCaptureThis)
return NoLambdaIsCaptureCapable;
- }
+ }
return IndexOfCaptureReadyLambda;
}
@@ -245,18 +245,18 @@ getGenericLambdaTemplateParameterList(La
CXXRecordDecl *Sema::createLambdaClosureType(SourceRange IntroducerRange,
TypeSourceInfo *Info,
- bool KnownDependent,
+ bool KnownDependent,
LambdaCaptureDefault CaptureDefault) {
DeclContext *DC = CurContext;
while (!(DC->isFunctionOrMethod() || DC->isRecord() || DC->isFileContext()))
DC = DC->getParent();
bool IsGenericLambda = getGenericLambdaTemplateParameterList(getCurLambda(),
- *this);
+ *this);
// Start constructing the lambda class.
CXXRecordDecl *Class = CXXRecordDecl::CreateLambda(Context, DC, Info,
IntroducerRange.getBegin(),
- KnownDependent,
- IsGenericLambda,
+ KnownDependent,
+ IsGenericLambda,
CaptureDefault);
DC->addDecl(Class);
@@ -270,10 +270,10 @@ static bool isInInlineFunction(const Dec
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(DC))
if (FD->isInlined())
return true;
-
+
DC = DC->getLexicalParent();
}
-
+
return false;
}
@@ -379,10 +379,10 @@ CXXMethodDecl *Sema::startLambdaDefiniti
ArrayRef<ParmVarDecl *> Params,
const bool IsConstexprSpecified) {
QualType MethodType = MethodTypeInfo->getType();
- TemplateParameterList *TemplateParams =
+ TemplateParameterList *TemplateParams =
getGenericLambdaTemplateParameterList(getCurLambda(), *this);
// If a lambda appears in a dependent context or is a generic lambda (has
- // template parameters) and has an 'auto' return type, deduce it to a
+ // template parameters) and has an 'auto' return type, deduce it to a
// dependent type.
if (Class->isDependentContext() || TemplateParams) {
const FunctionProtoType *FPT = MethodType->castAs<FunctionProtoType>();
@@ -395,9 +395,9 @@ CXXMethodDecl *Sema::startLambdaDefiniti
}
// C++11 [expr.prim.lambda]p5:
- // The closure type for a lambda-expression has a public inline function
+ // The closure type for a lambda-expression has a public inline function
// call operator (13.5.4) whose parameters and return type are described by
- // the lambda-expression's parameter-declaration-clause and
+ // the lambda-expression's parameter-declaration-clause and
// trailing-return-type respectively.
DeclarationName MethodName
= Context.DeclarationNames.getCXXOperatorName(OO_Call);
@@ -408,7 +408,7 @@ CXXMethodDecl *Sema::startLambdaDefiniti
= IntroducerRange.getEnd().getRawEncoding();
CXXMethodDecl *Method
= CXXMethodDecl::Create(Context, Class, EndLoc,
- DeclarationNameInfo(MethodName,
+ DeclarationNameInfo(MethodName,
IntroducerRange.getBegin(),
MethodNameLoc),
MethodType, MethodTypeInfo,
@@ -417,14 +417,14 @@ CXXMethodDecl *Sema::startLambdaDefiniti
IsConstexprSpecified,
EndLoc);
Method->setAccess(AS_public);
-
+
// Temporarily set the lexical declaration context to the current
// context, so that the Scope stack matches the lexical nesting.
- Method->setLexicalDeclContext(CurContext);
+ Method->setLexicalDeclContext(CurContext);
// Create a function template if we have a template parameter list
FunctionTemplateDecl *const TemplateMethod = TemplateParams ?
FunctionTemplateDecl::Create(Context, Class,
- Method->getLocation(), MethodName,
+ Method->getLocation(), MethodName,
TemplateParams,
Method) : nullptr;
if (TemplateMethod) {
@@ -432,7 +432,7 @@ CXXMethodDecl *Sema::startLambdaDefiniti
TemplateMethod->setAccess(AS_public);
Method->setDescribedFunctionTemplate(TemplateMethod);
}
-
+
// Add parameters.
if (!Params.empty()) {
Method->setParams(Params);
@@ -493,16 +493,16 @@ void Sema::finishLambdaExplicitCaptures(
LSI->finishedExplicitCaptures();
}
-void Sema::addLambdaParameters(CXXMethodDecl *CallOperator, Scope *CurScope) {
+void Sema::addLambdaParameters(CXXMethodDecl *CallOperator, Scope *CurScope) {
// Introduce our parameters into the function scope
- for (unsigned p = 0, NumParams = CallOperator->getNumParams();
+ for (unsigned p = 0, NumParams = CallOperator->getNumParams();
p < NumParams; ++p) {
ParmVarDecl *Param = CallOperator->getParamDecl(p);
-
+
// If this has an identifier, add it to the scope stack.
if (CurScope && Param->getIdentifier()) {
CheckShadow(CurScope, Param);
-
+
PushOnScopeChains(Param, CurScope);
}
}
@@ -637,7 +637,7 @@ static void adjustBlockReturnsToEnum(Sem
void Sema::deduceClosureReturnType(CapturingScopeInfo &CSI) {
assert(CSI.HasImplicitReturnType);
// If it was ever a placeholder, it had to been deduced to DependentTy.
- assert(CSI.ReturnType.isNull() || !CSI.ReturnType->isUndeducedType());
+ assert(CSI.ReturnType.isNull() || !CSI.ReturnType->isUndeducedType());
assert((!isa<LambdaScopeInfo>(CSI) || !getLangOpts().CPlusPlus14) &&
"lambda expressions use auto deduction in C++14 onwards");
@@ -851,7 +851,7 @@ void Sema::ActOnStartOfLambdaDefinition(
SmallVector<ParmVarDecl *, 8> Params;
if (ParamInfo.getNumTypeObjects() == 0) {
// C++11 [expr.prim.lambda]p4:
- // If a lambda-expression does not include a lambda-declarator, it is as
+ // If a lambda-expression does not include a lambda-declarator, it is as
// if the lambda-declarator were ().
FunctionProtoType::ExtProtoInfo EPI(Context.getDefaultCallingConvention(
/*IsVariadic=*/false, /*IsCXXMethod=*/true));
@@ -878,8 +878,8 @@ void Sema::ActOnStartOfLambdaDefinition(
DeclaratorChunk::FunctionTypeInfo &FTI = ParamInfo.getFunctionTypeInfo();
// C++11 [expr.prim.lambda]p5:
- // This function call operator is declared const (9.3.1) if and only if
- // the lambda-expression's parameter-declaration-clause is not followed
+ // This function call operator is declared const (9.3.1) if and only if
+ // the lambda-expression's parameter-declaration-clause is not followed
// by mutable. It is neither virtual nor declared volatile. [...]
if (!FTI.hasMutableQualifier())
FTI.TypeQuals |= DeclSpec::TQ_const;
@@ -917,8 +917,8 @@ void Sema::ActOnStartOfLambdaDefinition(
// code_seg attribute on lambda apply to the method.
if (Attr *A = getImplicitCodeSegOrSectionAttrForFunction(Method, /*IsDefinition=*/true))
Method->addAttr(A);
-
- // Attributes on the lambda apply to the method.
+
+ // Attributes on the lambda apply to the method.
ProcessDeclAttributes(CurScope, Method, ParamInfo);
// CUDA lambdas get implicit attributes based on the scope in which they're
@@ -928,7 +928,7 @@ void Sema::ActOnStartOfLambdaDefinition(
// Introduce the function call operator as the current declaration context.
PushDeclContext(CurScope, Method);
-
+
// Build the lambda scope.
buildLambdaScope(LSI, Method, Intro.Range, Intro.Default, Intro.DefaultLoc,
ExplicitParams, ExplicitResultType, !Method->isConst());
@@ -959,13 +959,13 @@ void Sema::ActOnStartOfLambdaDefinition(
for (auto C = Intro.Captures.begin(), E = Intro.Captures.end(); C != E;
PrevCaptureLoc = C->Loc, ++C) {
if (C->Kind == LCK_This || C->Kind == LCK_StarThis) {
- if (C->Kind == LCK_StarThis)
+ if (C->Kind == LCK_StarThis)
Diag(C->Loc, !getLangOpts().CPlusPlus17
? diag::ext_star_this_lambda_capture_cxx17
: diag::warn_cxx14_compat_star_this_lambda_capture);
// C++11 [expr.prim.lambda]p8:
- // An identifier or this shall not appear more than once in a
+ // An identifier or this shall not appear more than once in a
// lambda-capture.
if (LSI->isCXXThisCaptured()) {
Diag(C->Loc, diag::err_capture_more_than_once)
@@ -993,7 +993,7 @@ void Sema::ActOnStartOfLambdaDefinition(
Diag(C->Loc, diag::err_this_capture) << true;
continue;
}
-
+
CheckCXXThisCapture(C->Loc, /*Explicit=*/true, /*BuildAndDiagnose*/ true,
/*FunctionScopeIndexToStopAtPtr*/ nullptr,
C->Kind == LCK_StarThis);
@@ -1018,9 +1018,9 @@ void Sema::ActOnStartOfLambdaDefinition(
// If the initializer expression is usable, but the InitCaptureType
// is not, then an error has occurred - so ignore the capture for now.
// for e.g., [n{0}] { }; <-- if no <initializer_list> is included.
- // FIXME: we should create the init capture variable and mark it invalid
+ // FIXME: we should create the init capture variable and mark it invalid
// in this case.
- if (C->InitCaptureType.get().isNull())
+ if (C->InitCaptureType.get().isNull())
continue;
unsigned InitStyle;
@@ -1050,7 +1050,7 @@ void Sema::ActOnStartOfLambdaDefinition(
"init capture has valid but null init?");
// C++11 [expr.prim.lambda]p8:
- // If a lambda-capture includes a capture-default that is &, the
+ // If a lambda-capture includes a capture-default that is &, the
// identifiers in the lambda-capture shall not be preceded by &.
// If a lambda-capture includes a capture-default that is =, [...]
// each identifier it contains shall be preceded by &.
@@ -1131,7 +1131,7 @@ void Sema::ActOnStartOfLambdaDefinition(
} else {
Diag(C->EllipsisLoc, diag::err_pack_expansion_without_parameter_packs)
<< SourceRange(C->Loc);
-
+
// Just ignore the ellipsis.
}
} else if (Var->isParameterPack()) {
@@ -1189,14 +1189,14 @@ QualType Sema::getLambdaConversionFuncti
// The function type inside the pointer type is the same as the call
// operator with some tweaks. The calling convention is the default free
// function convention, and the type qualifications are lost.
- const FunctionProtoType::ExtProtoInfo CallOpExtInfo =
- CallOpProto->getExtProtoInfo();
+ const FunctionProtoType::ExtProtoInfo CallOpExtInfo =
+ CallOpProto->getExtProtoInfo();
FunctionProtoType::ExtProtoInfo InvokerExtInfo = CallOpExtInfo;
CallingConv CC = Context.getDefaultCallingConvention(
CallOpProto->isVariadic(), /*IsCXXMethod=*/false);
InvokerExtInfo.ExtInfo = InvokerExtInfo.ExtInfo.withCallingConv(CC);
InvokerExtInfo.TypeQuals = 0;
- assert(InvokerExtInfo.RefQualifier == RQ_None &&
+ assert(InvokerExtInfo.RefQualifier == RQ_None &&
"Lambda's call operator should not have a reference qualifier");
return Context.getFunctionType(CallOpProto->getReturnType(),
CallOpProto->getParamTypes(), InvokerExtInfo);
@@ -1227,7 +1227,7 @@ static void addFunctionPointerConversion
/*IsVariadic=*/false, /*IsCXXMethod=*/true));
// The conversion function is always const.
ConvExtInfo.TypeQuals = Qualifiers::Const;
- QualType ConvTy =
+ QualType ConvTy =
S.Context.getFunctionType(PtrToFunctionTy, None, ConvExtInfo);
SourceLocation Loc = IntroducerRange.getBegin();
@@ -1236,8 +1236,8 @@ static void addFunctionPointerConversion
S.Context.getCanonicalType(PtrToFunctionTy));
DeclarationNameLoc ConvNameLoc;
// Construct a TypeSourceInfo for the conversion function, and wire
- // all the parameters appropriately for the FunctionProtoTypeLoc
- // so that everything works during transformation/instantiation of
+ // all the parameters appropriately for the FunctionProtoTypeLoc
+ // so that everything works during transformation/instantiation of
// generic lambdas.
// The main reason for wiring up the parameters of the conversion
// function with that of the call operator is so that constructs
@@ -1247,46 +1247,46 @@ static void addFunctionPointerConversion
// return a;
// };
// };
- // int (*fp)(int) = L(5);
+ // int (*fp)(int) = L(5);
// Because the trailing return type can contain DeclRefExprs that refer
- // to the original call operator's variables, we hijack the call
+ // to the original call operator's variables, we hijack the call
// operators ParmVarDecls below.
- TypeSourceInfo *ConvNamePtrToFunctionTSI =
+ TypeSourceInfo *ConvNamePtrToFunctionTSI =
S.Context.getTrivialTypeSourceInfo(PtrToFunctionTy, Loc);
ConvNameLoc.NamedType.TInfo = ConvNamePtrToFunctionTSI;
// The conversion function is a conversion to a pointer-to-function.
TypeSourceInfo *ConvTSI = S.Context.getTrivialTypeSourceInfo(ConvTy, Loc);
- FunctionProtoTypeLoc ConvTL =
+ FunctionProtoTypeLoc ConvTL =
ConvTSI->getTypeLoc().getAs<FunctionProtoTypeLoc>();
// Get the result of the conversion function which is a pointer-to-function.
- PointerTypeLoc PtrToFunctionTL =
+ PointerTypeLoc PtrToFunctionTL =
ConvTL.getReturnLoc().getAs<PointerTypeLoc>();
// Do the same for the TypeSourceInfo that is used to name the conversion
// operator.
- PointerTypeLoc ConvNamePtrToFunctionTL =
+ PointerTypeLoc ConvNamePtrToFunctionTL =
ConvNamePtrToFunctionTSI->getTypeLoc().getAs<PointerTypeLoc>();
-
+
// Get the underlying function types that the conversion function will
// be converting to (should match the type of the call operator).
- FunctionProtoTypeLoc CallOpConvTL =
+ FunctionProtoTypeLoc CallOpConvTL =
PtrToFunctionTL.getPointeeLoc().getAs<FunctionProtoTypeLoc>();
- FunctionProtoTypeLoc CallOpConvNameTL =
+ FunctionProtoTypeLoc CallOpConvNameTL =
ConvNamePtrToFunctionTL.getPointeeLoc().getAs<FunctionProtoTypeLoc>();
-
+
// Wire up the FunctionProtoTypeLocs with the call operator's parameters.
// These parameter's are essentially used to transform the name and
// the type of the conversion operator. By using the same parameters
// as the call operator's we don't have to fix any back references that
- // the trailing return type of the call operator's uses (such as
+ // the trailing return type of the call operator's uses (such as
// decltype(some_type<decltype(a)>::type{} + decltype(a){}) etc.)
- // - we can simply use the return type of the call operator, and
- // everything should work.
+ // - we can simply use the return type of the call operator, and
+ // everything should work.
SmallVector<ParmVarDecl *, 4> InvokerParams;
for (unsigned I = 0, N = CallOperator->getNumParams(); I != N; ++I) {
ParmVarDecl *From = CallOperator->getParamDecl(I);
- InvokerParams.push_back(ParmVarDecl::Create(S.Context,
+ InvokerParams.push_back(ParmVarDecl::Create(S.Context,
// Temporarily add to the TU. This is set to the invoker below.
S.Context.getTranslationUnitDecl(),
From->getLocStart(),
@@ -1300,14 +1300,14 @@ static void addFunctionPointerConversion
CallOpConvNameTL.setParam(I, From);
}
- CXXConversionDecl *Conversion
- = CXXConversionDecl::Create(S.Context, Class, Loc,
- DeclarationNameInfo(ConversionName,
+ CXXConversionDecl *Conversion
+ = CXXConversionDecl::Create(S.Context, Class, Loc,
+ DeclarationNameInfo(ConversionName,
Loc, ConvNameLoc),
- ConvTy,
+ ConvTy,
ConvTSI,
/*isInline=*/true, /*isExplicit=*/false,
- /*isConstexpr=*/S.getLangOpts().CPlusPlus17,
+ /*isConstexpr=*/S.getLangOpts().CPlusPlus17,
CallOperator->getBody()->getLocEnd());
Conversion->setAccess(AS_public);
Conversion->setImplicit(true);
@@ -1315,7 +1315,7 @@ static void addFunctionPointerConversion
if (Class->isGenericLambda()) {
// Create a template version of the conversion operator, using the template
// parameter list of the function call operator.
- FunctionTemplateDecl *TemplateCallOperator =
+ FunctionTemplateDecl *TemplateCallOperator =
CallOperator->getDescribedFunctionTemplate();
FunctionTemplateDecl *ConversionTemplate =
FunctionTemplateDecl::Create(S.Context, Class,
@@ -1337,19 +1337,19 @@ static void addFunctionPointerConversion
// using FunctionTy & Loc and get its TypeLoc as a FunctionProtoTypeLoc
// then rewire the parameters accordingly, by hoisting up the InvokeParams
// loop below and then use its Params to set Invoke->setParams(...) below.
- // This would avoid the 'const' qualifier of the calloperator from
- // contaminating the type of the invoker, which is currently adjusted
+ // This would avoid the 'const' qualifier of the calloperator from
+ // contaminating the type of the invoker, which is currently adjusted
// in SemaTemplateDeduction.cpp:DeduceTemplateArguments. Fixing the
// trailing return type of the invoker would require a visitor to rebuild
// the trailing return type and adjusting all back DeclRefExpr's to refer
// to the new static invoker parameters - not the call operator's.
CXXMethodDecl *Invoke
- = CXXMethodDecl::Create(S.Context, Class, Loc,
- DeclarationNameInfo(InvokerName, Loc),
+ = CXXMethodDecl::Create(S.Context, Class, Loc,
+ DeclarationNameInfo(InvokerName, Loc),
InvokerFunctionTy,
- CallOperator->getTypeSourceInfo(),
+ CallOperator->getTypeSourceInfo(),
SC_Static, /*IsInline=*/true,
- /*IsConstexpr=*/false,
+ /*IsConstexpr=*/false,
CallOperator->getBody()->getLocEnd());
for (unsigned I = 0, N = CallOperator->getNumParams(); I != N; ++I)
InvokerParams[I]->setOwningFunction(Invoke);
@@ -1357,7 +1357,7 @@ static void addFunctionPointerConversion
Invoke->setAccess(AS_private);
Invoke->setImplicit(true);
if (Class->isGenericLambda()) {
- FunctionTemplateDecl *TemplateCallOperator =
+ FunctionTemplateDecl *TemplateCallOperator =
CallOperator->getDescribedFunctionTemplate();
FunctionTemplateDecl *StaticInvokerTemplate = FunctionTemplateDecl::Create(
S.Context, Class, Loc, InvokerName,
@@ -1372,7 +1372,7 @@ static void addFunctionPointerConversion
}
/// Add a lambda's conversion to block pointer.
-static void addBlockPointerConversion(Sema &S,
+static void addBlockPointerConversion(Sema &S,
SourceRange IntroducerRange,
CXXRecordDecl *Class,
CXXMethodDecl *CallOperator) {
@@ -1392,13 +1392,13 @@ static void addBlockPointerConversion(Se
S.Context.getCanonicalType(BlockPtrTy));
DeclarationNameLoc NameLoc;
NameLoc.NamedType.TInfo = S.Context.getTrivialTypeSourceInfo(BlockPtrTy, Loc);
- CXXConversionDecl *Conversion
- = CXXConversionDecl::Create(S.Context, Class, Loc,
+ CXXConversionDecl *Conversion
+ = CXXConversionDecl::Create(S.Context, Class, Loc,
DeclarationNameInfo(Name, Loc, NameLoc),
- ConvTy,
+ ConvTy,
S.Context.getTrivialTypeSourceInfo(ConvTy, Loc),
/*isInline=*/true, /*isExplicit=*/false,
- /*isConstexpr=*/false,
+ /*isConstexpr=*/false,
CallOperator->getBody()->getLocEnd());
Conversion->setAccess(AS_public);
Conversion->setImplicit(true);
@@ -1421,7 +1421,7 @@ static ExprResult performLambdaVarCaptur
// direct-initialized in increasing subscript order.) These
// initializations are performed in the (unspecified) order in
// which the non-static data members are declared.
-
+
// C++ [expr.prim.lambda]p12:
// An entity captured by a lambda-expression is odr-used (3.2) in
// the scope containing the lambda-expression.
@@ -1437,8 +1437,8 @@ static ExprResult performLambdaVarCaptur
InitializationSequence Init(S, Entity, InitKind, Ref);
return Init.Perform(S, Entity, InitKind, Ref);
}
-
-ExprResult Sema::ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body,
+
+ExprResult Sema::ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body,
Scope *CurScope) {
LambdaScopeInfo LSI = *cast<LambdaScopeInfo>(FunctionScopes.back());
ActOnFinishFunctionBody(LSI.CallOperator, Body);
@@ -1531,9 +1531,9 @@ ExprResult Sema::BuildLambdaExpr(SourceL
IsGenericLambda = Class->isGenericLambda();
CallOperator->setLexicalDeclContext(Class);
- Decl *TemplateOrNonTemplateCallOperatorDecl =
- CallOperator->getDescribedFunctionTemplate()
- ? CallOperator->getDescribedFunctionTemplate()
+ Decl *TemplateOrNonTemplateCallOperatorDecl =
+ CallOperator->getDescribedFunctionTemplate()
+ ? CallOperator->getDescribedFunctionTemplate()
: cast<Decl>(CallOperator);
TemplateOrNonTemplateCallOperatorDecl->setLexicalDeclContext(Class);
@@ -1646,7 +1646,7 @@ ExprResult Sema::BuildLambdaExpr(SourceL
// FIXME: Fix generic lambda to block conversions.
if (getLangOpts().Blocks && getLangOpts().ObjC1 && !IsGenericLambda)
addBlockPointerConversion(*this, IntroducerRange, Class, CallOperator);
-
+
// Finalize the lambda class.
SmallVector<Decl*, 4> Fields(Class->fields());
ActOnFields(nullptr, Class->getLocation(), Class, Fields, SourceLocation(),
@@ -1656,9 +1656,9 @@ ExprResult Sema::BuildLambdaExpr(SourceL
Cleanup.mergeFrom(LambdaCleanup);
- LambdaExpr *Lambda = LambdaExpr::Create(Context, Class, IntroducerRange,
+ LambdaExpr *Lambda = LambdaExpr::Create(Context, Class, IntroducerRange,
CaptureDefault, CaptureDefaultLoc,
- Captures,
+ Captures,
ExplicitParams, ExplicitResultType,
CaptureInits, EndLoc,
ContainsUnexpandedParameterPack);
@@ -1718,7 +1718,7 @@ ExprResult Sema::BuildBlockForLambdaConv
Expr *Src) {
// Make sure that the lambda call operator is marked used.
CXXRecordDecl *Lambda = Conv->getParent();
- CXXMethodDecl *CallOperator
+ CXXMethodDecl *CallOperator
= cast<CXXMethodDecl>(
Lambda->lookup(
Context.DeclarationNames.getCXXOperatorName(OO_Call)).front());
@@ -1731,10 +1731,10 @@ ExprResult Sema::BuildBlockForLambdaConv
CurrentLocation, Src);
if (!Init.isInvalid())
Init = ActOnFinishFullExpr(Init.get());
-
+
if (Init.isInvalid())
return ExprError();
-
+
// Create the new block to be returned.
BlockDecl *Block = BlockDecl::Create(Context, CurContext, ConvLocation);
Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Mon Jul 30 12:24:48 2018
@@ -1621,7 +1621,7 @@ bool Sema::isVisibleSlow(const NamedDecl
bool Sema::shouldLinkPossiblyHiddenDecl(LookupResult &R, const NamedDecl *New) {
// FIXME: If there are both visible and hidden declarations, we need to take
// into account whether redeclaration is possible. Example:
- //
+ //
// Non-imported module:
// int f(T); // #1
// Some TU:
@@ -1795,7 +1795,7 @@ bool Sema::LookupName(LookupResult &R, S
// actually exists in a Scope).
while (S && !S->isDeclScope(D))
S = S->getParent();
-
+
// If the scope containing the declaration is the translation unit,
// then we'll need to perform our checks based on the matching
// DeclContexts rather than matching scopes.
@@ -1806,7 +1806,7 @@ bool Sema::LookupName(LookupResult &R, S
DeclContext *DC = nullptr;
if (!S)
DC = (*I)->getDeclContext()->getRedeclContext();
-
+
IdentifierResolver::iterator LastI = I;
for (++LastI; LastI != IEnd; ++LastI) {
if (S) {
@@ -1815,7 +1815,7 @@ bool Sema::LookupName(LookupResult &R, S
break;
} else {
// Match based on DeclContext.
- DeclContext *LastDC
+ DeclContext *LastDC
= (*LastI)->getDeclContext()->getRedeclContext();
if (!LastDC->Equals(DC))
break;
@@ -1843,8 +1843,8 @@ bool Sema::LookupName(LookupResult &R, S
if (AllowBuiltinCreation && LookupBuiltin(*this, R))
return true;
- // If we didn't find a use of this identifier, the ExternalSource
- // may be able to handle the situation.
+ // If we didn't find a use of this identifier, the ExternalSource
+ // may be able to handle the situation.
// Note: some lookup failures are expected!
// See e.g. R.isForRedeclaration().
return (ExternalSource && ExternalSource->LookupUnqualified(R, S));
@@ -2037,11 +2037,11 @@ bool Sema::LookupQualifiedName(LookupRes
bool oldVal;
DeclContext *Context;
// Set flag in DeclContext informing debugger that we're looking for qualified name
- QualifiedLookupInScope(DeclContext *ctx) : Context(ctx) {
- oldVal = ctx->setUseQualifiedLookup();
+ QualifiedLookupInScope(DeclContext *ctx) : Context(ctx) {
+ oldVal = ctx->setUseQualifiedLookup();
}
- ~QualifiedLookupInScope() {
- Context->setUseQualifiedLookup(oldVal);
+ ~QualifiedLookupInScope() {
+ Context->setUseQualifiedLookup(oldVal);
}
} QL(LookupCtx);
@@ -2738,7 +2738,7 @@ addAssociatedClassesAndNamespaces(Associ
case Type::DeducedTemplateSpecialization:
break;
- // If T is an Objective-C object or interface type, or a pointer to an
+ // If T is an Objective-C object or interface type, or a pointer to an
// object or interface type, the associated namespace is the global
// namespace.
case Type::ObjCObject:
@@ -4434,7 +4434,7 @@ static void AddKeywordsToConsumer(Sema &
// Add type-specifier keywords to the set of results.
static const char *const CTypeSpecs[] = {
"char", "const", "double", "enum", "float", "int", "long", "short",
- "signed", "struct", "union", "unsigned", "void", "volatile",
+ "signed", "struct", "union", "unsigned", "void", "volatile",
"_Complex", "_Imaginary",
// storage-specifiers as well
"extern", "inline", "static", "typedef"
@@ -4450,7 +4450,7 @@ static void AddKeywordsToConsumer(Sema &
Consumer.addKeywordResult("bool");
else if (SemaRef.getLangOpts().C99)
Consumer.addKeywordResult("_Bool");
-
+
if (SemaRef.getLangOpts().CPlusPlus) {
Consumer.addKeywordResult("class");
Consumer.addKeywordResult("typename");
Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Mon Jul 30 12:24:48 2018
@@ -307,15 +307,15 @@ makePropertyAttributesAsWritten(unsigned
attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_atomic;
if (Attributes & ObjCDeclSpec::DQ_PR_class)
attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_class;
-
+
return (ObjCPropertyDecl::PropertyAttributeKind)attributesAsWritten;
}
-static bool LocPropertyAttribute( ASTContext &Context, const char *attrName,
+static bool LocPropertyAttribute( ASTContext &Context, const char *attrName,
SourceLocation LParenLoc, SourceLocation &Loc) {
if (LParenLoc.isMacroID())
return false;
-
+
SourceManager &SM = Context.getSourceManager();
std::pair<FileID, unsigned> locInfo = SM.getDecomposedLoc(LParenLoc);
// Try to load the file buffer.
@@ -324,7 +324,7 @@ static bool LocPropertyAttribute( ASTCon
if (invalidTemp)
return false;
const char *tokenBegin = file.data() + locInfo.second;
-
+
// Lex from the start of the given location.
Lexer lexer(SM.getLocForStartOfFile(locInfo.first),
Context.getLangOpts(),
@@ -365,7 +365,7 @@ static void checkAtomicPropertyMismatch(
if (Attrs & ObjCPropertyDecl::OBJC_PR_nonatomic) return false;
// Was 'atomic' specified directly?
- if (Property->getPropertyAttributesAsWritten() &
+ if (Property->getPropertyAttributesAsWritten() &
ObjCPropertyDecl::OBJC_PR_atomic)
return false;
@@ -382,7 +382,7 @@ static void checkAtomicPropertyMismatch(
Attrs = Attrs & ~AtomicityMask;
if (OldIsAtomic)
Attrs |= ObjCPropertyDecl::OBJC_PR_atomic;
- else
+ else
Attrs |= ObjCPropertyDecl::OBJC_PR_nonatomic;
NewProperty->overwritePropertyAttributes(Attrs);
@@ -429,7 +429,7 @@ Sema::HandlePropertyInClassExtension(Sco
DeclContext *DC = CurContext;
IdentifierInfo *PropertyId = FD.D.getIdentifier();
ObjCInterfaceDecl *CCPrimary = CDecl->getClassInterface();
-
+
// We need to look in the @interface to see if the @property was
// already declared.
if (!CCPrimary) {
@@ -445,7 +445,7 @@ Sema::HandlePropertyInClassExtension(Sco
ObjCPropertyDecl *PIDecl = CCPrimary->FindPropertyVisibleInPrimaryClass(
PropertyId, ObjCPropertyDecl::getQueryKind(isClassProperty));
- // If we found a property in an extension, complain.
+ // If we found a property in an extension, complain.
if (PIDecl && isa<ObjCCategoryDecl>(PIDecl->getDeclContext())) {
Diag(AtLoc, diag::err_duplicate_property);
Diag(PIDecl->getLocation(), diag::note_property_declare);
@@ -482,7 +482,7 @@ Sema::HandlePropertyInClassExtension(Sco
<< PIDecl->getGetterName() << GetterSel;
Diag(PIDecl->getLocation(), diag::note_property_declare);
}
-
+
// Always adopt the getter from the original declaration.
GetterSel = PIDecl->getGetterName();
Attributes |= ObjCDeclSpec::DQ_PR_getter;
@@ -503,7 +503,7 @@ Sema::HandlePropertyInClassExtension(Sco
Attributes = (Attributes & ~OwnershipMask) | ExistingOwnership;
}
- // If the redeclaration is 'weak' but the original property is not,
+ // If the redeclaration is 'weak' but the original property is not,
if ((Attributes & ObjCPropertyDecl::OBJC_PR_weak) &&
!(PIDecl->getPropertyAttributesAsWritten()
& ObjCPropertyDecl::OBJC_PR_weak) &&
@@ -511,7 +511,7 @@ Sema::HandlePropertyInClassExtension(Sco
PIDecl->getType().getObjCLifetime() == Qualifiers::OCL_None) {
Diag(AtLoc, diag::warn_property_implicitly_mismatched);
Diag(PIDecl->getLocation(), diag::note_property_declare);
- }
+ }
}
// Create a new ObjCPropertyDecl with the DeclContext being
@@ -546,13 +546,13 @@ Sema::HandlePropertyInClassExtension(Sco
(!isObjCPointerConversion(ClassExtPropertyT, PrimaryClassPropertyT,
ConvertedType, IncompatibleObjC))
|| IncompatibleObjC) {
- Diag(AtLoc,
+ Diag(AtLoc,
diag::err_type_mismatch_continuation_class) << PDecl->getType();
Diag(PIDecl->getLocation(), diag::note_property_declare);
return nullptr;
}
}
-
+
// Check that atomicity of property in class extension matches the previous
// declaration.
checkAtomicPropertyMismatch(*this, PIDecl, PDecl, true);
@@ -621,7 +621,7 @@ ObjCPropertyDecl *Sema::CreatePropertyDe
DeclContext *DC = CDecl;
ObjCPropertyDecl *PDecl = ObjCPropertyDecl::Create(Context, DC,
FD.D.getIdentifierLoc(),
- PropertyId, AtLoc,
+ PropertyId, AtLoc,
LParenLoc, T, TInfo);
bool isClassProperty = (AttributesAsWritten & ObjCDeclSpec::DQ_PR_class) ||
@@ -770,7 +770,7 @@ static void checkARCPropertyImpl(Sema &S
S.Diag(ivar->getLocation(), diag::err_arc_assign_property_ownership)
<< property->getDeclName()
<< ivar->getDeclName()
- << ((property->getPropertyAttributesAsWritten()
+ << ((property->getPropertyAttributesAsWritten()
& ObjCPropertyDecl::OBJC_PR_assign) != 0);
break;
@@ -794,12 +794,12 @@ static void checkARCPropertyImpl(Sema &S
/// life-time is assumed 'strong'.
static void setImpliedPropertyAttributeForReadOnlyProperty(
ObjCPropertyDecl *property, ObjCIvarDecl *ivar) {
- Qualifiers::ObjCLifetime propertyLifetime =
+ Qualifiers::ObjCLifetime propertyLifetime =
getImpliedARCOwnership(property->getPropertyAttributes(),
property->getType());
if (propertyLifetime != Qualifiers::OCL_None)
return;
-
+
if (!ivar) {
// if no backing ivar, make property 'strong'.
property->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_strong);
@@ -1094,7 +1094,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope
Diag(IC->getLocation(), diag::warn_auto_implicit_atomic_property);
Diag(property->getLocation(), diag::note_property_declare);
}
-
+
if (const ObjCCategoryDecl *CD =
dyn_cast<ObjCCategoryDecl>(property->getDeclContext())) {
if (!CD->IsClassExtension()) {
@@ -1121,17 +1121,17 @@ Decl *Sema::ActOnPropertyImplDecl(Scope
}
}
}
-
+
if (!ReadWriteProperty) {
Diag(property->getLocation(), diag::warn_auto_readonly_iboutlet_property)
<< property;
SourceLocation readonlyLoc;
- if (LocPropertyAttribute(Context, "readonly",
+ if (LocPropertyAttribute(Context, "readonly",
property->getLParenLoc(), readonlyLoc)) {
- SourceLocation endLoc =
+ SourceLocation endLoc =
readonlyLoc.getLocWithOffset(strlen("readonly")-1);
SourceRange ReadonlySourceRange(readonlyLoc, endLoc);
- Diag(property->getLocation(),
+ Diag(property->getLocation(),
diag::note_auto_readonly_iboutlet_fixup_suggest) <<
FixItHint::CreateReplacement(ReadonlySourceRange, "readwrite");
}
@@ -1194,10 +1194,10 @@ Decl *Sema::ActOnPropertyImplDecl(Scope
(property->getPropertyAttributesAsWritten() &
ObjCPropertyDecl::OBJC_PR_readonly) &&
PropertyIvarType->isObjCRetainableType()) {
- setImpliedPropertyAttributeForReadOnlyProperty(property, Ivar);
+ setImpliedPropertyAttributeForReadOnlyProperty(property, Ivar);
}
-
- ObjCPropertyDecl::PropertyAttributeKind kind
+
+ ObjCPropertyDecl::PropertyAttributeKind kind
= property->getPropertyAttributes();
bool isARCWeak = false;
@@ -1244,16 +1244,16 @@ Decl *Sema::ActOnPropertyImplDecl(Scope
}
if (AtLoc.isInvalid()) {
- // Check when default synthesizing a property that there is
+ // Check when default synthesizing a property that there is
// an ivar matching property name and issue warning; since this
// is the most common case of not using an ivar used for backing
// property in non-default synthesis case.
ObjCInterfaceDecl *ClassDeclared=nullptr;
- ObjCIvarDecl *originalIvar =
- IDecl->lookupInstanceVariable(property->getIdentifier(),
+ ObjCIvarDecl *originalIvar =
+ IDecl->lookupInstanceVariable(property->getIdentifier(),
ClassDeclared);
if (originalIvar) {
- Diag(PropertyDiagLoc,
+ Diag(PropertyDiagLoc,
diag::warn_autosynthesis_property_ivar_match)
<< PropertyId << (Ivar == nullptr) << PropertyIvar
<< originalIvar->getIdentifier();
@@ -1261,7 +1261,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope
Diag(originalIvar->getLocation(), diag::note_ivar_decl);
}
}
-
+
if (!Ivar) {
// In ARC, give the ivar a lifetime qualifier based on the
// property attributes.
@@ -1280,10 +1280,10 @@ Decl *Sema::ActOnPropertyImplDecl(Scope
Qualifiers::ObjCLifetime lifetime =
getImpliedARCOwnership(kind, PropertyIvarType);
assert(lifetime && "no lifetime for property?");
-
+
Qualifiers qs;
qs.addObjCLifetime(lifetime);
- PropertyIvarType = Context.getQualifiedType(PropertyIvarType, qs);
+ PropertyIvarType = Context.getQualifiedType(PropertyIvarType, qs);
}
}
@@ -1333,7 +1333,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope
// Check that type of property and its ivar are type compatible.
if (!Context.hasSameType(PropertyIvarType, IvarType)) {
- if (isa<ObjCObjectPointerType>(PropertyIvarType)
+ if (isa<ObjCObjectPointerType>(PropertyIvarType)
&& isa<ObjCObjectPointerType>(IvarType))
compat =
Context.canAssignObjCInterfaces(
@@ -1390,7 +1390,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope
} else if (PropertyIvar)
// @dynamic
Diag(PropertyDiagLoc, diag::err_dynamic_property_ivar_decl);
-
+
assert (property && "ActOnPropertyImplDecl - property declaration missing");
ObjCPropertyImplDecl *PIDecl =
ObjCPropertyImplDecl::Create(Context, CurContext, AtLoc, PropertyLoc,
@@ -1412,7 +1412,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope
// FIXME. Eventually we want to do this for Objective-C as well.
SynthesizedFunctionScope Scope(*this, getterMethod);
ImplicitParamDecl *SelfDecl = getterMethod->getSelfDecl();
- DeclRefExpr *SelfExpr =
+ DeclRefExpr *SelfExpr =
new (Context) DeclRefExpr(SelfDecl, false, SelfDecl->getType(),
VK_LValue, PropertyDiagLoc);
MarkDeclRefReferenced(SelfExpr);
@@ -1440,7 +1440,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope
}
if (property->hasAttr<NSReturnsNotRetainedAttr>() &&
!getterMethod->hasAttr<NSReturnsNotRetainedAttr>()) {
- Diag(getterMethod->getLocation(),
+ Diag(getterMethod->getLocation(),
diag::warn_property_getter_owning_mismatch);
Diag(property->getLocation(), diag::note_property_declare);
}
@@ -1464,7 +1464,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope
// FIXME. Eventually we want to do this for Objective-C as well.
SynthesizedFunctionScope Scope(*this, setterMethod);
ImplicitParamDecl *SelfDecl = setterMethod->getSelfDecl();
- DeclRefExpr *SelfExpr =
+ DeclRefExpr *SelfExpr =
new (Context) DeclRefExpr(SelfDecl, false, SelfDecl->getType(),
VK_LValue, PropertyDiagLoc);
MarkDeclRefReferenced(SelfExpr);
@@ -1484,27 +1484,27 @@ Decl *Sema::ActOnPropertyImplDecl(Scope
DeclRefExpr *rhs = new (Context) DeclRefExpr(Param, false, T,
VK_LValue, PropertyDiagLoc);
MarkDeclRefReferenced(rhs);
- ExprResult Res = BuildBinOp(S, PropertyDiagLoc,
+ ExprResult Res = BuildBinOp(S, PropertyDiagLoc,
BO_Assign, lhs, rhs);
- if (property->getPropertyAttributes() &
+ if (property->getPropertyAttributes() &
ObjCPropertyDecl::OBJC_PR_atomic) {
Expr *callExpr = Res.getAs<Expr>();
- if (const CXXOperatorCallExpr *CXXCE =
+ if (const CXXOperatorCallExpr *CXXCE =
dyn_cast_or_null<CXXOperatorCallExpr>(callExpr))
if (const FunctionDecl *FuncDecl = CXXCE->getDirectCallee())
if (!FuncDecl->isTrivial())
if (property->getType()->isReferenceType()) {
- Diag(PropertyDiagLoc,
+ Diag(PropertyDiagLoc,
diag::err_atomic_property_nontrivial_assign_op)
<< property->getType();
- Diag(FuncDecl->getLocStart(),
+ Diag(FuncDecl->getLocStart(),
diag::note_callee_decl) << FuncDecl;
}
}
PIDecl->setSetterCXXAssignment(Res.getAs<Expr>());
}
}
-
+
if (IC) {
if (Synthesize)
if (ObjCPropertyImplDecl *PPIDecl =
@@ -1537,9 +1537,9 @@ Decl *Sema::ActOnPropertyImplDecl(Scope
Ivar = IDecl->lookupInstanceVariable(PropertyId, ClassDeclared);
}
// Issue diagnostics only if Ivar belongs to current class.
- if (Ivar && Ivar->getSynthesize() &&
+ if (Ivar && Ivar->getSynthesize() &&
declaresSameEntity(IC->getClassInterface(), ClassDeclared)) {
- Diag(Ivar->getLocation(), diag::err_undeclared_var_use)
+ Diag(Ivar->getLocation(), diag::err_undeclared_var_use)
<< PropertyId;
Ivar->setInvalidDecl();
}
@@ -1582,7 +1582,7 @@ Sema::DiagnosePropertyMismatch(ObjCPrope
Property->getPropertyAttributes();
ObjCPropertyDecl::PropertyAttributeKind SAttr =
SuperProperty->getPropertyAttributes();
-
+
// We allow readonly properties without an explicit ownership
// (assign/unsafe_unretained/weak/retain/strong/copy) in super class
// to be overridden by a property with any explicit ownership in the subclass.
@@ -1642,7 +1642,7 @@ Sema::DiagnosePropertyMismatch(ObjCPrope
// FIXME. For future support of covariant property types, revisit this.
bool IncompatibleObjC = false;
QualType ConvertedType;
- if (!isObjCPointerConversion(RHSType, LHSType,
+ if (!isObjCPointerConversion(RHSType, LHSType,
ConvertedType, IncompatibleObjC) ||
IncompatibleObjC) {
Diag(Property->getLocation(), diag::warn_property_types_are_incompatible)
@@ -1683,7 +1683,7 @@ bool Sema::DiagnosePropertyAccessorMisma
compat = false;
}
}
-
+
if (!compat) {
Diag(Loc, diag::warn_accessor_property_type_mismatch)
<< property->getDeclName()
@@ -1744,9 +1744,9 @@ CollectImmediateProperties(ObjCContainer
ObjCPropertyDecl *PropertyFromSuper =
SuperPropMap[std::make_pair(Prop->getIdentifier(),
Prop->isClassProperty())];
- // Exclude property for protocols which conform to class's super-class,
+ // Exclude property for protocols which conform to class's super-class,
// as super-class has to implement the property.
- if (!PropertyFromSuper ||
+ if (!PropertyFromSuper ||
PropertyFromSuper->getIdentifier() != Prop->getIdentifier()) {
ObjCPropertyDecl *&PropEntry =
PropMap[std::make_pair(Prop->getIdentifier(),
@@ -1788,7 +1788,7 @@ Sema::IvarBacksCurrentMethodAccessor(Obj
Method->isInstanceMethod());
if (!IMD || !IMD->isPropertyAccessor())
return false;
-
+
// look up a property declaration whose one of its accessors is implemented
// by this method.
for (const auto *Property : IFace->instance_properties()) {
@@ -1841,7 +1841,7 @@ void Sema::DefaultSynthesizeProperties(S
return;
ObjCInterfaceDecl::PropertyMap SuperPropMap;
CollectSuperClassPropertyImplementations(IDecl, SuperPropMap);
-
+
for (unsigned i = 0, e = PropertyOrder.size(); i != e; i++) {
ObjCPropertyDecl *Prop = PropertyOrder[i];
// Is there a matching property synthesize/dynamic?
@@ -1997,7 +1997,7 @@ void Sema::DiagnoseUnimplementedProperti
}
if (IDecl)
CollectSuperClassPropertyImplementations(IDecl, NoNeedToImplPropMap);
-
+
// When SynthesizeProperties is true, we only check class properties.
CollectImmediateProperties(CDecl, PropMap, NoNeedToImplPropMap,
SynthesizeProperties/*CollectClassPropsOnly*/);
@@ -2048,7 +2048,7 @@ void Sema::DiagnoseUnimplementedProperti
// Collect property accessors implemented in current implementation.
for (const auto *I : IMPDecl->methods())
InsMap.insert(I);
-
+
ObjCCategoryDecl *C = dyn_cast<ObjCCategoryDecl>(CDecl);
ObjCInterfaceDecl *PrimaryClass = nullptr;
if (C && !C->IsClassExtension())
@@ -2121,7 +2121,7 @@ Sema::AtomicPropertySetterGetterRules (O
for (const auto *Ext : IDecl->known_extensions())
for (auto *Prop : Ext->properties())
PM[std::make_pair(Prop->getIdentifier(), Prop->isClassProperty())] = Prop;
-
+
for (ObjCContainerDecl::PropertyMap::iterator I = PM.begin(), E = PM.end();
I != E; ++I) {
const ObjCPropertyDecl *Property = I->second;
@@ -2191,7 +2191,7 @@ Sema::AtomicPropertySetterGetterRules (O
<< FixItHint::CreateInsertion(AfterLParen, NonatomicStr);
} else if (Property->getLParenLoc().isInvalid()) {
//@property id etc.
- SourceLocation startLoc =
+ SourceLocation startLoc =
Property->getTypeSourceInfo()->getTypeLoc().getBeginLoc();
Diag(Property->getLocation(),
diag::note_atomic_property_fixup_suggest)
@@ -2301,8 +2301,8 @@ static void AddPropertyAttrs(Sema &S, Ob
ObjCPropertyDecl *Property) {
// Should we just clone all attributes over?
for (const auto *A : Property->attrs()) {
- if (isa<DeprecatedAttr>(A) ||
- isa<UnavailableAttr>(A) ||
+ if (isa<DeprecatedAttr>(A) ||
+ isa<UnavailableAttr>(A) ||
isa<AvailabilityAttr>(A))
PropertyMethod->addAttr(A->clone(S.Context));
}
@@ -2332,7 +2332,7 @@ void Sema::ProcessPropertyDecl(ObjCPrope
getClassMethod(property->getGetterName()) :
CatDecl->getClassInterface()->
getInstanceMethod(property->getGetterName());
-
+
SetterMethod = IsClassProperty ?
CD->getClassMethod(property->getSetterName()) :
CD->getInstanceMethod(property->getSetterName());
@@ -2352,7 +2352,7 @@ void Sema::ProcessPropertyDecl(ObjCPrope
Diag(SetterMethod->getLocation(), diag::err_setter_type_void);
if (SetterMethod->param_size() != 1 ||
!Context.hasSameUnqualifiedType(
- (*SetterMethod->param_begin())->getType().getNonReferenceType(),
+ (*SetterMethod->param_begin())->getType().getNonReferenceType(),
property->getType().getNonReferenceType())) {
Diag(property->getLocation(),
diag::warn_accessor_property_type_mismatch)
@@ -2406,11 +2406,11 @@ void Sema::ProcessPropertyDecl(ObjCPrope
if (property->hasAttr<NSReturnsNotRetainedAttr>())
GetterMethod->addAttr(NSReturnsNotRetainedAttr::CreateImplicit(Context,
Loc));
-
+
if (property->hasAttr<ObjCReturnsInnerPointerAttr>())
GetterMethod->addAttr(
ObjCReturnsInnerPointerAttr::CreateImplicit(Context, Loc));
-
+
if (const SectionAttr *SA = property->getAttr<SectionAttr>())
GetterMethod->addAttr(
SectionAttr::CreateImplicit(Context, SectionAttr::GNU_section,
@@ -2535,12 +2535,12 @@ void Sema::CheckObjCPropertyAttributes(D
// FIXME: Improve the reported location.
if (!PDecl || PDecl->isInvalidDecl())
return;
-
+
if ((Attributes & ObjCDeclSpec::DQ_PR_readonly) &&
(Attributes & ObjCDeclSpec::DQ_PR_readwrite))
Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
<< "readonly" << "readwrite";
-
+
ObjCPropertyDecl *PropertyDecl = cast<ObjCPropertyDecl>(PDecl);
QualType PropertyTy = PropertyDecl->getType();
@@ -2656,19 +2656,19 @@ void Sema::CheckObjCPropertyAttributes(D
if (Attributes & ObjCDeclSpec::DQ_PR_readonly) {
// do nothing
} else if (getLangOpts().ObjCAutoRefCount) {
- // With arc, @property definitions should default to strong when
+ // With arc, @property definitions should default to strong when
// not specified.
PropertyDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_strong);
} else if (PropertyTy->isObjCObjectPointerType()) {
- bool isAnyClassTy =
- (PropertyTy->isObjCClassType() ||
+ bool isAnyClassTy =
+ (PropertyTy->isObjCClassType() ||
PropertyTy->isObjCQualifiedClassType());
// In non-gc, non-arc mode, 'Class' is treated as a 'void *' no need to
// issue any warning.
if (isAnyClassTy && getLangOpts().getGC() == LangOptions::NonGC)
;
else if (propertyInPrimaryClass) {
- // Don't issue warning on property with no life time in class
+ // Don't issue warning on property with no life time in class
// extension as it is inherited from property in primary class.
// Skip this warning in gc-only mode.
if (getLangOpts().getGC() != LangOptions::GCOnly)
@@ -2696,7 +2696,7 @@ void Sema::CheckObjCPropertyAttributes(D
!(Attributes & ObjCDeclSpec::DQ_PR_strong) &&
PropertyTy->isBlockPointerType())
Diag(Loc, diag::warn_objc_property_retain_of_block);
-
+
if ((Attributes & ObjCDeclSpec::DQ_PR_readonly) &&
(Attributes & ObjCDeclSpec::DQ_PR_setter))
Diag(Loc, diag::warn_objc_readonly_property_has_setter);
Modified: cfe/trunk/lib/Sema/SemaPseudoObject.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaPseudoObject.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaPseudoObject.cpp (original)
+++ cfe/trunk/lib/Sema/SemaPseudoObject.cpp Mon Jul 30 12:24:48 2018
@@ -316,10 +316,10 @@ namespace {
OpaqueValueExpr *InstanceKey;
ObjCMethodDecl *AtIndexGetter;
Selector AtIndexGetterSelector;
-
+
ObjCMethodDecl *AtIndexSetter;
Selector AtIndexSetterSelector;
-
+
public:
ObjCSubscriptOpBuilder(Sema &S, ObjCSubscriptRefExpr *refExpr, bool IsUnique)
: PseudoOpBuilder(S, refExpr->getSourceRange().getBegin(), IsUnique),
@@ -367,7 +367,7 @@ namespace {
/// Capture the given expression in an OpaqueValueExpr.
OpaqueValueExpr *PseudoOpBuilder::capture(Expr *e) {
// Make a new OVE whose source is the given expression.
- OpaqueValueExpr *captured =
+ OpaqueValueExpr *captured =
new (S.Context) OpaqueValueExpr(GenericLoc, e->getType(),
e->getValueKind(), e->getObjectKind(),
e);
@@ -389,7 +389,7 @@ OpaqueValueExpr *PseudoOpBuilder::captur
assert(ResultIndex == PseudoObjectExpr::NoResult);
// If the expression hasn't already been captured, just capture it
- // and set the new semantic
+ // and set the new semantic
if (!isa<OpaqueValueExpr>(e)) {
OpaqueValueExpr *cap = capture(e);
setResultToLastSemantic();
@@ -618,11 +618,11 @@ bool ObjCPropertyOpBuilder::findGetter()
// Must build the getter selector the hard way.
ObjCMethodDecl *setter = RefExpr->getImplicitPropertySetter();
assert(setter && "both setter and getter are null - cannot happen");
- IdentifierInfo *setterName =
+ IdentifierInfo *setterName =
setter->getSelector().getIdentifierInfoForSlot(0);
IdentifierInfo *getterName =
&S.Context.Idents.get(setterName->getName().substr(3));
- GetterSelector =
+ GetterSelector =
S.PP.getSelectorTable().getNullarySelector(getterName);
return false;
}
@@ -636,7 +636,7 @@ bool ObjCPropertyOpBuilder::findGetter()
/// Try to find the most accurate setter declaration for the property
/// reference.
///
-/// \return true if a setter was found, in which case Setter
+/// \return true if a setter was found, in which case Setter
bool ObjCPropertyOpBuilder::findSetter(bool warn) {
// For implicit properties, just trust the lookup we already did.
if (RefExpr->isImplicitProperty()) {
@@ -987,9 +987,9 @@ ExprResult ObjCPropertyOpBuilder::comple
// ObjCSubscript build stuff.
//
-/// objective-c subscripting-specific behavior for doing lvalue-to-rvalue
+/// objective-c subscripting-specific behavior for doing lvalue-to-rvalue
/// conversion.
-/// FIXME. Remove this routine if it is proven that no additional
+/// FIXME. Remove this routine if it is proven that no additional
/// specifity is needed.
ExprResult ObjCSubscriptOpBuilder::buildRValueOperation(Expr *op) {
ExprResult result = PseudoOpBuilder::buildRValueOperation(op);
@@ -1007,21 +1007,21 @@ ObjCSubscriptOpBuilder::buildAssignmentO
// There must be a method to do the Index'ed assignment.
if (!findAtIndexSetter())
return ExprError();
-
+
// Verify that we can do a compound assignment.
if (opcode != BO_Assign && !findAtIndexGetter())
return ExprError();
-
+
ExprResult result =
PseudoOpBuilder::buildAssignmentOperation(Sc, opcLoc, opcode, LHS, RHS);
if (result.isInvalid()) return ExprError();
-
+
// Various warnings about objc Index'ed assignments in ARC.
if (S.getLangOpts().ObjCAutoRefCount && InstanceBase) {
S.checkRetainCycles(InstanceBase->getSourceExpr(), RHS);
S.checkUnsafeExprAssigns(opcLoc, LHS, RHS);
}
-
+
return result;
}
@@ -1049,15 +1049,15 @@ Expr *ObjCSubscriptOpBuilder::rebuildAnd
return syntacticBase;
}
-/// CheckSubscriptingKind - This routine decide what type
+/// CheckSubscriptingKind - This routine decide what type
/// of indexing represented by "FromE" is being done.
-Sema::ObjCSubscriptKind
+Sema::ObjCSubscriptKind
Sema::CheckSubscriptingKind(Expr *FromE) {
// If the expression already has integral or enumeration type, we're golden.
QualType T = FromE->getType();
if (T->isIntegralOrEnumerationType())
return OS_Array;
-
+
// If we don't have a class type in C++, there's no way we can get an
// expression of integral or enumeration type.
const RecordType *RecordTy = T->getAs<RecordType>();
@@ -1066,7 +1066,7 @@ Sema::ObjCSubscriptKind
// All other scalar cases are assumed to be dictionary indexing which
// caller handles, with diagnostics if needed.
return OS_Dictionary;
- if (!getLangOpts().CPlusPlus ||
+ if (!getLangOpts().CPlusPlus ||
!RecordTy || RecordTy->isIncompleteType()) {
// No indexing can be done. Issue diagnostics and quit.
const Expr *IndexExpr = FromE->IgnoreParenImpCasts();
@@ -1078,12 +1078,12 @@ Sema::ObjCSubscriptKind
<< T;
return OS_Error;
}
-
+
// We must have a complete class type.
- if (RequireCompleteType(FromE->getExprLoc(), T,
+ if (RequireCompleteType(FromE->getExprLoc(), T,
diag::err_objc_index_incomplete_class_type, FromE))
return OS_Error;
-
+
// Look for a conversion to an integral, enumeration type, or
// objective-C pointer type.
int NoIntegrals=0, NoObjCIdPointers=0;
@@ -1125,17 +1125,17 @@ Sema::ObjCSubscriptKind
/// CheckKeyForObjCARCConversion - This routine suggests bridge casting of CF
/// objects used as dictionary subscript key objects.
-static void CheckKeyForObjCARCConversion(Sema &S, QualType ContainerT,
+static void CheckKeyForObjCARCConversion(Sema &S, QualType ContainerT,
Expr *Key) {
if (ContainerT.isNull())
return;
// dictionary subscripting.
// - (id)objectForKeyedSubscript:(id)key;
IdentifierInfo *KeyIdents[] = {
- &S.Context.Idents.get("objectForKeyedSubscript")
+ &S.Context.Idents.get("objectForKeyedSubscript")
};
Selector GetterSelector = S.Context.Selectors.getSelector(1, KeyIdents);
- ObjCMethodDecl *Getter = S.LookupMethodInObjectType(GetterSelector, ContainerT,
+ ObjCMethodDecl *Getter = S.LookupMethodInObjectType(GetterSelector, ContainerT,
true /*instance*/);
if (!Getter)
return;
@@ -1147,25 +1147,25 @@ static void CheckKeyForObjCARCConversion
bool ObjCSubscriptOpBuilder::findAtIndexGetter() {
if (AtIndexGetter)
return true;
-
+
Expr *BaseExpr = RefExpr->getBaseExpr();
QualType BaseT = BaseExpr->getType();
-
+
QualType ResultType;
if (const ObjCObjectPointerType *PTy =
BaseT->getAs<ObjCObjectPointerType>()) {
ResultType = PTy->getPointeeType();
}
- Sema::ObjCSubscriptKind Res =
+ Sema::ObjCSubscriptKind Res =
S.CheckSubscriptingKind(RefExpr->getKeyExpr());
if (Res == Sema::OS_Error) {
if (S.getLangOpts().ObjCAutoRefCount)
- CheckKeyForObjCARCConversion(S, ResultType,
+ CheckKeyForObjCARCConversion(S, ResultType,
RefExpr->getKeyExpr());
return false;
}
bool arrayRef = (Res == Sema::OS_Array);
-
+
if (ResultType.isNull()) {
S.Diag(BaseExpr->getExprLoc(), diag::err_objc_subscript_base_type)
<< BaseExpr->getType() << arrayRef;
@@ -1175,24 +1175,24 @@ bool ObjCSubscriptOpBuilder::findAtIndex
// dictionary subscripting.
// - (id)objectForKeyedSubscript:(id)key;
IdentifierInfo *KeyIdents[] = {
- &S.Context.Idents.get("objectForKeyedSubscript")
+ &S.Context.Idents.get("objectForKeyedSubscript")
};
AtIndexGetterSelector = S.Context.Selectors.getSelector(1, KeyIdents);
}
else {
// - (id)objectAtIndexedSubscript:(size_t)index;
IdentifierInfo *KeyIdents[] = {
- &S.Context.Idents.get("objectAtIndexedSubscript")
+ &S.Context.Idents.get("objectAtIndexedSubscript")
};
-
+
AtIndexGetterSelector = S.Context.Selectors.getSelector(1, KeyIdents);
}
-
- AtIndexGetter = S.LookupMethodInObjectType(AtIndexGetterSelector, ResultType,
+
+ AtIndexGetter = S.LookupMethodInObjectType(AtIndexGetterSelector, ResultType,
true /*instance*/);
-
+
if (!AtIndexGetter && S.getLangOpts().DebuggerObjCLiteral) {
- AtIndexGetter = ObjCMethodDecl::Create(S.Context, SourceLocation(),
+ AtIndexGetter = ObjCMethodDecl::Create(S.Context, SourceLocation(),
SourceLocation(), AtIndexGetterSelector,
S.Context.getObjCIdType() /*ReturnType*/,
nullptr /*TypeSourceInfo */,
@@ -1220,20 +1220,20 @@ bool ObjCSubscriptOpBuilder::findAtIndex
<< BaseExpr->getType() << 0 << arrayRef;
return false;
}
- AtIndexGetter =
- S.LookupInstanceMethodInGlobalPool(AtIndexGetterSelector,
- RefExpr->getSourceRange(),
+ AtIndexGetter =
+ S.LookupInstanceMethodInGlobalPool(AtIndexGetterSelector,
+ RefExpr->getSourceRange(),
true);
}
-
+
if (AtIndexGetter) {
QualType T = AtIndexGetter->parameters()[0]->getType();
if ((arrayRef && !T->isIntegralOrEnumerationType()) ||
(!arrayRef && !T->isObjCObjectPointerType())) {
- S.Diag(RefExpr->getKeyExpr()->getExprLoc(),
+ S.Diag(RefExpr->getKeyExpr()->getExprLoc(),
arrayRef ? diag::err_objc_subscript_index_type
: diag::err_objc_subscript_key_type) << T;
- S.Diag(AtIndexGetter->parameters()[0]->getLocation(),
+ S.Diag(AtIndexGetter->parameters()[0]->getLocation(),
diag::note_parameter_type) << T;
return false;
}
@@ -1251,32 +1251,32 @@ bool ObjCSubscriptOpBuilder::findAtIndex
bool ObjCSubscriptOpBuilder::findAtIndexSetter() {
if (AtIndexSetter)
return true;
-
+
Expr *BaseExpr = RefExpr->getBaseExpr();
QualType BaseT = BaseExpr->getType();
-
+
QualType ResultType;
if (const ObjCObjectPointerType *PTy =
BaseT->getAs<ObjCObjectPointerType>()) {
ResultType = PTy->getPointeeType();
}
-
- Sema::ObjCSubscriptKind Res =
+
+ Sema::ObjCSubscriptKind Res =
S.CheckSubscriptingKind(RefExpr->getKeyExpr());
if (Res == Sema::OS_Error) {
if (S.getLangOpts().ObjCAutoRefCount)
- CheckKeyForObjCARCConversion(S, ResultType,
+ CheckKeyForObjCARCConversion(S, ResultType,
RefExpr->getKeyExpr());
return false;
}
bool arrayRef = (Res == Sema::OS_Array);
-
+
if (ResultType.isNull()) {
S.Diag(BaseExpr->getExprLoc(), diag::err_objc_subscript_base_type)
<< BaseExpr->getType() << arrayRef;
return false;
}
-
+
if (!arrayRef) {
// dictionary subscripting.
// - (void)setObject:(id)object forKeyedSubscript:(id)key;
@@ -1294,7 +1294,7 @@ bool ObjCSubscriptOpBuilder::findAtIndex
};
AtIndexSetterSelector = S.Context.Selectors.getSelector(2, KeyIdents);
}
- AtIndexSetter = S.LookupMethodInObjectType(AtIndexSetterSelector, ResultType,
+ AtIndexSetter = S.LookupMethodInObjectType(AtIndexSetterSelector, ResultType,
true /*instance*/);
if (!AtIndexSetter && S.getLangOpts().DebuggerObjCLiteral) {
@@ -1328,35 +1328,35 @@ bool ObjCSubscriptOpBuilder::findAtIndex
Params.push_back(key);
AtIndexSetter->setMethodParams(S.Context, Params, None);
}
-
+
if (!AtIndexSetter) {
if (!BaseT->isObjCIdType()) {
- S.Diag(BaseExpr->getExprLoc(),
+ S.Diag(BaseExpr->getExprLoc(),
diag::err_objc_subscript_method_not_found)
<< BaseExpr->getType() << 1 << arrayRef;
return false;
}
- AtIndexSetter =
- S.LookupInstanceMethodInGlobalPool(AtIndexSetterSelector,
- RefExpr->getSourceRange(),
+ AtIndexSetter =
+ S.LookupInstanceMethodInGlobalPool(AtIndexSetterSelector,
+ RefExpr->getSourceRange(),
true);
}
-
+
bool err = false;
if (AtIndexSetter && arrayRef) {
QualType T = AtIndexSetter->parameters()[1]->getType();
if (!T->isIntegralOrEnumerationType()) {
- S.Diag(RefExpr->getKeyExpr()->getExprLoc(),
+ S.Diag(RefExpr->getKeyExpr()->getExprLoc(),
diag::err_objc_subscript_index_type) << T;
- S.Diag(AtIndexSetter->parameters()[1]->getLocation(),
+ S.Diag(AtIndexSetter->parameters()[1]->getLocation(),
diag::note_parameter_type) << T;
err = true;
}
T = AtIndexSetter->parameters()[0]->getType();
if (!T->isObjCObjectPointerType()) {
- S.Diag(RefExpr->getBaseExpr()->getExprLoc(),
+ S.Diag(RefExpr->getBaseExpr()->getExprLoc(),
diag::err_objc_subscript_object_type) << T << arrayRef;
- S.Diag(AtIndexSetter->parameters()[0]->getLocation(),
+ S.Diag(AtIndexSetter->parameters()[0]->getLocation(),
diag::note_parameter_type) << T;
err = true;
}
@@ -1371,7 +1371,7 @@ bool ObjCSubscriptOpBuilder::findAtIndex
else
S.Diag(RefExpr->getBaseExpr()->getExprLoc(),
diag::err_objc_subscript_dic_object_type) << T;
- S.Diag(AtIndexSetter->parameters()[i]->getLocation(),
+ S.Diag(AtIndexSetter->parameters()[i]->getLocation(),
diag::note_parameter_type) << T;
err = true;
}
@@ -1385,13 +1385,13 @@ bool ObjCSubscriptOpBuilder::findAtIndex
ExprResult ObjCSubscriptOpBuilder::buildGet() {
if (!findAtIndexGetter())
return ExprError();
-
+
QualType receiverType = InstanceBase->getType();
-
+
// Build a message-send.
ExprResult msg;
Expr *Index = InstanceKey;
-
+
// Arguments.
Expr *args[] = { Index };
assert(InstanceBase);
@@ -1417,17 +1417,17 @@ ExprResult ObjCSubscriptOpBuilder::build
S.DiagnoseUseOfDecl(AtIndexSetter, GenericLoc);
QualType receiverType = InstanceBase->getType();
Expr *Index = InstanceKey;
-
+
// Arguments.
Expr *args[] = { op, Index };
-
+
// Build a message-send.
ExprResult msg = S.BuildInstanceMessageImplicit(InstanceBase, receiverType,
GenericLoc,
AtIndexSetterSelector,
AtIndexSetter,
MultiExprArg(args, 2));
-
+
if (!msg.isInvalid() && captureSetValueAsResult) {
ObjCMessageExpr *msgExpr =
cast<ObjCMessageExpr>(msg.get()->IgnoreImplicit());
@@ -1435,7 +1435,7 @@ ExprResult ObjCSubscriptOpBuilder::build
if (CanCaptureValue(arg))
msgExpr->setArg(0, captureValueAsResult(arg));
}
-
+
return msg;
}
Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Mon Jul 30 12:24:48 2018
@@ -216,7 +216,7 @@ void Sema::DiagnoseUnusedExprResult(cons
// expression is a call to a function with the warn_unused_result attribute,
// we warn no matter the location. Because of the order in which the various
// checks need to happen, we factor out the macro-related test here.
- bool ShouldSuppress =
+ bool ShouldSuppress =
SourceMgr.isMacroBodyExpansion(ExprLoc) ||
SourceMgr.isInSystemMacro(ExprLoc);
@@ -1879,7 +1879,7 @@ Sema::ActOnObjCForCollectionStmt(SourceL
VarDecl *D = dyn_cast<VarDecl>(DS->getSingleDecl());
if (!D || D->isInvalidDecl())
return StmtError();
-
+
FirstType = D->getType();
// C99 6.8.5p3: The declaration part of a 'for' statement shall only
// declare identifiers for objects having storage class 'auto' or
@@ -2373,7 +2373,7 @@ Sema::BuildCXXForRangeStmt(SourceLocatio
// Rather, we need to determine what it was when the array was first
// created - so we resort to using sizeof(vla)/sizeof(element).
// For e.g.
- // void f(int b) {
+ // void f(int b) {
// int vla[b];
// b = -1; <-- This should not affect the num of iterations below
// for (int &c : vla) { .. }
@@ -2399,7 +2399,7 @@ Sema::BuildCXXForRangeStmt(SourceLocatio
EndVar->getSourceRange());
if (SizeOfVLAExprR.isInvalid())
return StmtError();
-
+
ExprResult SizeOfEachElementExprR = ActOnUnaryExprOrTypeTraitExpr(
EndVar->getLocation(), UETT_SizeOf,
/*isType=*/true,
@@ -2416,7 +2416,7 @@ Sema::BuildCXXForRangeStmt(SourceLocatio
SizeOfVLAExprR.get(), SizeOfEachElementExprR.get());
if (BoundExpr.isInvalid())
return StmtError();
-
+
} else {
// Can't be a DependentSizedArrayType or an IncompleteArrayType since
// UnqAT is not incomplete and Range is not type-dependent.
@@ -3366,7 +3366,7 @@ bool Sema::DeduceFunctionTypeFromReturnE
// statement with a non-type-dependent operand.
assert(AT->isDeduced() && "should have deduced to dependent type");
return false;
- }
+ }
if (RetExpr) {
// Otherwise, [...] deduce a value for U using the rules of template
Modified: cfe/trunk/lib/Sema/SemaStmtAsm.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmtAsm.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmtAsm.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmtAsm.cpp Mon Jul 30 12:24:48 2018
@@ -603,7 +603,7 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceL
Context.getTargetInfo(), Context);
if (ConstraintLoc.isValid())
return Diag(ConstraintLoc, diag::error_inoutput_conflict_with_clobber);
-
+
return NS;
}
Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Mon Jul 30 12:24:48 2018
@@ -888,7 +888,7 @@ ParsedTemplateArgument Sema::ActOnTempla
// This is a normal type template argument. Note, if the type template
// argument is an injected-class-name for a template, it has a dual nature
- // and can be used as either a type or a template. We handle that in
+ // and can be used as either a type or a template. We handle that in
// convertTypeTemplateArgumentToTemplate.
return ParsedTemplateArgument(ParsedTemplateArgument::Type,
ParsedType.get().getAsOpaquePtr(),
@@ -1044,14 +1044,14 @@ NamedDecl *Sema::ActOnNonTypeTemplatePar
// Check that we have valid decl-specifiers specified.
auto CheckValidDeclSpecifiers = [this, &D] {
// C++ [temp.param]
- // p1
+ // p1
// template-parameter:
// ...
// parameter-declaration
- // p2
+ // p2
// ... A storage class shall not be specified in a template-parameter
// declaration.
- // [dcl.typedef]p1:
+ // [dcl.typedef]p1:
// The typedef specifier [...] shall not be used in the decl-specifier-seq
// of a parameter-declaration
const DeclSpec &DS = D.getDeclSpec();
@@ -1061,22 +1061,22 @@ NamedDecl *Sema::ActOnNonTypeTemplatePar
};
if (DS.getStorageClassSpec() != DeclSpec::SCS_unspecified)
EmitDiag(DS.getStorageClassSpecLoc());
-
+
if (DS.getThreadStorageClassSpec() != TSCS_unspecified)
EmitDiag(DS.getThreadStorageClassSpecLoc());
-
- // [dcl.inline]p1:
- // The inline specifier can be applied only to the declaration or
+
+ // [dcl.inline]p1:
+ // The inline specifier can be applied only to the declaration or
// definition of a variable or function.
-
+
if (DS.isInlineSpecified())
EmitDiag(DS.getInlineSpecLoc());
-
+
// [dcl.constexpr]p1:
- // The constexpr specifier shall be applied only to the definition of a
- // variable or variable template or the declaration of a function or
+ // The constexpr specifier shall be applied only to the definition of a
+ // variable or variable template or the declaration of a function or
// function template.
-
+
if (DS.isConstexprSpecified())
EmitDiag(DS.getConstexprSpecLoc());
@@ -1094,7 +1094,7 @@ NamedDecl *Sema::ActOnNonTypeTemplatePar
};
CheckValidDeclSpecifiers();
-
+
if (TInfo->getType()->isUndeducedType()) {
Diag(D.getIdentifierLoc(),
diag::warn_cxx14_compat_template_nontype_parm_auto_type)
Modified: cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp Mon Jul 30 12:24:48 2018
@@ -4599,7 +4599,7 @@ bool Sema::DeduceReturnType(FunctionDecl
CXXRecordDecl *Lambda = cast<CXXMethodDecl>(FD)->getParent();
FunctionDecl *CallOp = Lambda->getLambdaCallOperator();
- // For a generic lambda, instantiate the call operator if needed.
+ // For a generic lambda, instantiate the call operator if needed.
if (auto *Args = FD->getTemplateSpecializationArgs()) {
CallOp = InstantiateFunctionDeclaration(
CallOp->getDescribedFunctionTemplate(), Args, Loc);
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Mon Jul 30 12:24:48 2018
@@ -52,7 +52,7 @@ using namespace sema;
/// used to determine the proper set of template instantiation arguments for
/// friend function template specializations.
MultiLevelTemplateArgumentList
-Sema::getTemplateInstantiationArgs(NamedDecl *D,
+Sema::getTemplateInstantiationArgs(NamedDecl *D,
const TemplateArgumentList *Innermost,
bool RelativeToPrimary,
const FunctionDecl *Pattern) {
@@ -61,7 +61,7 @@ Sema::getTemplateInstantiationArgs(Named
if (Innermost)
Result.addOuterTemplateArguments(Innermost);
-
+
DeclContext *Ctx = dyn_cast<DeclContext>(D);
if (!Ctx) {
Ctx = D->getDeclContext();
@@ -100,7 +100,7 @@ Sema::getTemplateInstantiationArgs(Named
// use empty template parameter lists for all of the outer templates
// to avoid performing any substitutions.
if (Ctx->isTranslationUnit()) {
- if (TemplateTemplateParmDecl *TTP
+ if (TemplateTemplateParmDecl *TTP
= dyn_cast<TemplateTemplateParmDecl>(D)) {
for (unsigned I = 0, N = TTP->getDepth() + 1; I != N; ++I)
Result.addOuterTemplateArguments(None);
@@ -108,7 +108,7 @@ Sema::getTemplateInstantiationArgs(Named
}
}
}
-
+
while (!Ctx->isFileContext()) {
// Add template arguments from a class template instantiation.
if (ClassTemplateSpecializationDecl *Spec
@@ -119,8 +119,8 @@ Sema::getTemplateInstantiationArgs(Named
break;
Result.addOuterTemplateArguments(&Spec->getTemplateInstantiationArgs());
-
- // If this class template specialization was instantiated from a
+
+ // If this class template specialization was instantiated from a
// specialized member that is a class template, we're done.
assert(Spec->getSpecializedTemplate() && "No class template?");
if (Spec->getSpecializedTemplate()->isMemberSpecialization())
@@ -129,11 +129,11 @@ Sema::getTemplateInstantiationArgs(Named
// Add template arguments from a function template specialization.
else if (FunctionDecl *Function = dyn_cast<FunctionDecl>(Ctx)) {
if (!RelativeToPrimary &&
- (Function->getTemplateSpecializationKind() ==
+ (Function->getTemplateSpecializationKind() ==
TSK_ExplicitSpecialization &&
!Function->getClassScopeSpecializationPattern()))
break;
-
+
if (const TemplateArgumentList *TemplateArgs
= Function->getTemplateSpecializationArgs()) {
// Add the template arguments for this specialization.
@@ -154,7 +154,7 @@ Sema::getTemplateInstantiationArgs(Named
// Add the "injected" template arguments.
Result.addOuterTemplateArguments(FunTmpl->getInjectedTemplateArgs());
}
-
+
// If this is a friend declaration and it declares an entity at
// namespace scope, take arguments from its lexical parent
// instead of its semantic parent, unless of course the pattern we're
@@ -200,7 +200,7 @@ bool Sema::CodeSynthesisContext::isInsta
case DeclaringSpecialMember:
case DefiningSynthesizedFunction:
return false;
-
+
// This function should never be called when Kind's value is Memoization.
case Memoization:
break;
@@ -413,7 +413,7 @@ bool Sema::InstantiatingTemplate::CheckI
SourceRange InstantiationRange) {
assert(SemaRef.NonInstantiationEntries <=
SemaRef.CodeSynthesisContexts.size());
- if ((SemaRef.CodeSynthesisContexts.size() -
+ if ((SemaRef.CodeSynthesisContexts.size() -
SemaRef.NonInstantiationEntries)
<= SemaRef.getLangOpts().InstantiationDepth)
return false;
@@ -517,9 +517,9 @@ void Sema::PrintInstantiationStack() {
FunctionTemplateDecl *FnTmpl = cast<FunctionTemplateDecl>(Active->Entity);
Diags.Report(Active->PointOfInstantiation,
diag::note_explicit_template_arg_substitution_here)
- << FnTmpl
- << getTemplateArgumentBindingsText(FnTmpl->getTemplateParameters(),
- Active->TemplateArgs,
+ << FnTmpl
+ << getTemplateArgumentBindingsText(FnTmpl->getTemplateParameters(),
+ Active->TemplateArgs,
Active->NumTemplateArgs)
<< Active->InstantiationRange;
break;
@@ -531,8 +531,8 @@ void Sema::PrintInstantiationStack() {
Diags.Report(Active->PointOfInstantiation,
diag::note_function_template_deduction_instantiation_here)
<< FnTmpl
- << getTemplateArgumentBindingsText(FnTmpl->getTemplateParameters(),
- Active->TemplateArgs,
+ << getTemplateArgumentBindingsText(FnTmpl->getTemplateParameters(),
+ Active->TemplateArgs,
Active->NumTemplateArgs)
<< Active->InstantiationRange;
} else {
@@ -556,7 +556,7 @@ void Sema::PrintInstantiationStack() {
Diags.Report(Active->PointOfInstantiation,
diag::note_deduced_template_arg_substitution_here)
<< IsVar << IsTemplate << cast<NamedDecl>(Active->Entity)
- << getTemplateArgumentBindingsText(Params, Active->TemplateArgs,
+ << getTemplateArgumentBindingsText(Params, Active->TemplateArgs,
Active->NumTemplateArgs)
<< Active->InstantiationRange;
}
@@ -596,8 +596,8 @@ void Sema::PrintInstantiationStack() {
diag::note_prior_template_arg_substitution)
<< isa<TemplateTemplateParmDecl>(Parm)
<< Name
- << getTemplateArgumentBindingsText(TemplateParams,
- Active->TemplateArgs,
+ << getTemplateArgumentBindingsText(TemplateParams,
+ Active->TemplateArgs,
Active->NumTemplateArgs)
<< Active->InstantiationRange;
break;
@@ -614,8 +614,8 @@ void Sema::PrintInstantiationStack() {
Diags.Report(Active->PointOfInstantiation,
diag::note_template_default_arg_checking)
- << getTemplateArgumentBindingsText(TemplateParams,
- Active->TemplateArgs,
+ << getTemplateArgumentBindingsText(TemplateParams,
+ Active->TemplateArgs,
Active->NumTemplateArgs)
<< Active->InstantiationRange;
break;
@@ -660,7 +660,7 @@ Optional<TemplateDeductionInfo *> Sema::
Active = CodeSynthesisContexts.rbegin(),
ActiveEnd = CodeSynthesisContexts.rend();
Active != ActiveEnd;
- ++Active)
+ ++Active)
{
switch (Active->Kind) {
case CodeSynthesisContext::TemplateInstantiation:
@@ -678,7 +678,7 @@ Optional<TemplateDeductionInfo *> Sema::
case CodeSynthesisContext::PriorTemplateArgumentSubstitution:
case CodeSynthesisContext::DefaultTemplateArgumentChecking:
// A default template argument instantiation and substitution into
- // template parameters with arguments for prior parameters may or may
+ // template parameters with arguments for prior parameters may or may
// not be a SFINAE context; look further up the stack.
break;
@@ -752,18 +752,18 @@ namespace {
ArrayRef<UnexpandedParameterPack> Unexpanded,
bool &ShouldExpand, bool &RetainExpansion,
Optional<unsigned> &NumExpansions) {
- return getSema().CheckParameterPacksForExpansion(EllipsisLoc,
+ return getSema().CheckParameterPacksForExpansion(EllipsisLoc,
PatternRange, Unexpanded,
- TemplateArgs,
+ TemplateArgs,
ShouldExpand,
RetainExpansion,
NumExpansions);
}
- void ExpandingFunctionParameterPack(ParmVarDecl *Pack) {
+ void ExpandingFunctionParameterPack(ParmVarDecl *Pack) {
SemaRef.CurrentInstantiationScope->MakeInstantiatedLocalArgPack(Pack);
}
-
+
TemplateArgument ForgetPartiallySubstitutedPack() {
TemplateArgument Result;
if (NamedDecl *PartialPack
@@ -777,14 +777,14 @@ namespace {
TemplateArgs.setArgument(Depth, Index, TemplateArgument());
}
}
-
+
return Result;
}
-
+
void RememberPartiallySubstitutedPack(TemplateArgument Arg) {
if (Arg.isNull())
return;
-
+
if (NamedDecl *PartialPack
= SemaRef.CurrentInstantiationScope->getPartiallySubstitutedPack()){
MultiLevelTemplateArgumentList &TemplateArgs
@@ -799,7 +799,7 @@ namespace {
/// this declaration.
Decl *TransformDecl(SourceLocation Loc, Decl *D);
- void transformAttrs(Decl *Old, Decl *New) {
+ void transformAttrs(Decl *Old, Decl *New) {
SemaRef.InstantiateAttrs(TemplateArgs, Old, New);
}
@@ -817,7 +817,7 @@ namespace {
NewMD->setInstantiationOfMemberFunction(OldMD,
TSK_ImplicitInstantiation);
}
-
+
SemaRef.CurrentInstantiationScope->InstantiatedLocal(Old, New);
// We recreated a local declaration, but not by instantiating it. There
@@ -825,7 +825,7 @@ namespace {
if (auto *DC = dyn_cast<DeclContext>(Old))
SemaRef.PerformDependentDiagnostics(DC, TemplateArgs);
}
-
+
/// Transform the definition of the given declaration by
/// instantiating it.
Decl *TransformDefinition(SourceLocation Loc, Decl *D);
@@ -833,20 +833,20 @@ namespace {
/// Transform the first qualifier within a scope by instantiating the
/// declaration.
NamedDecl *TransformFirstQualifierInScope(NamedDecl *D, SourceLocation Loc);
-
+
/// Rebuild the exception declaration and register the declaration
/// as an instantiated local.
- VarDecl *RebuildExceptionDecl(VarDecl *ExceptionDecl,
+ VarDecl *RebuildExceptionDecl(VarDecl *ExceptionDecl,
TypeSourceInfo *Declarator,
SourceLocation StartLoc,
SourceLocation NameLoc,
IdentifierInfo *Name);
- /// Rebuild the Objective-C exception declaration and register the
+ /// Rebuild the Objective-C exception declaration and register the
/// declaration as an instantiated local.
- VarDecl *RebuildObjCExceptionDecl(VarDecl *ExceptionDecl,
+ VarDecl *RebuildObjCExceptionDecl(VarDecl *ExceptionDecl,
TypeSourceInfo *TSInfo, QualType T);
-
+
/// Check for tag mismatches when instantiating an
/// elaborated type.
QualType RebuildElaboratedType(SourceLocation KeywordLoc,
@@ -921,11 +921,11 @@ namespace {
TemplateParameterList *TransformTemplateParameterList(
TemplateParameterList *OrigTPL) {
if (!OrigTPL || !OrigTPL->size()) return OrigTPL;
-
+
DeclContext *Owner = OrigTPL->getParam(0)->getDeclContext();
- TemplateDeclInstantiator DeclInstantiator(getSema(),
+ TemplateDeclInstantiator DeclInstantiator(getSema(),
/* DeclContext *Owner */ Owner, TemplateArgs);
- return DeclInstantiator.SubstTemplateParams(OrigTPL);
+ return DeclInstantiator.SubstTemplateParams(OrigTPL);
}
private:
ExprResult transformNonTypeTemplateParmRef(NonTypeTemplateParmDecl *parm,
@@ -937,17 +937,17 @@ namespace {
bool TemplateInstantiator::AlreadyTransformed(QualType T) {
if (T.isNull())
return true;
-
+
if (T->isInstantiationDependentType() || T->isVariablyModifiedType())
return false;
-
+
getSema().MarkDeclarationsReferencedInType(Loc, T);
return true;
}
static TemplateArgument
getPackSubstitutedTemplateArgument(Sema &S, TemplateArgument Arg) {
- assert(S.ArgumentPackSubstitutionIndex >= 0);
+ assert(S.ArgumentPackSubstitutionIndex >= 0);
assert(S.ArgumentPackSubstitutionIndex < (int)Arg.pack_size());
Arg = Arg.pack_begin()[S.ArgumentPackSubstitutionIndex];
if (Arg.isPackExpansion())
@@ -970,9 +970,9 @@ Decl *TemplateInstantiator::TransformDec
return D;
TemplateArgument Arg = TemplateArgs(TTP->getDepth(), TTP->getPosition());
-
+
if (TTP->isParameterPack()) {
- assert(Arg.getKind() == TemplateArgument::Pack &&
+ assert(Arg.getKind() == TemplateArgument::Pack &&
"Missing argument pack");
Arg = getPackSubstitutedTemplateArgument(getSema(), Arg);
}
@@ -1000,22 +1000,22 @@ Decl *TemplateInstantiator::TransformDef
}
NamedDecl *
-TemplateInstantiator::TransformFirstQualifierInScope(NamedDecl *D,
+TemplateInstantiator::TransformFirstQualifierInScope(NamedDecl *D,
SourceLocation Loc) {
- // If the first part of the nested-name-specifier was a template type
+ // If the first part of the nested-name-specifier was a template type
// parameter, instantiate that type parameter down to a tag type.
if (TemplateTypeParmDecl *TTPD = dyn_cast_or_null<TemplateTypeParmDecl>(D)) {
- const TemplateTypeParmType *TTP
+ const TemplateTypeParmType *TTP
= cast<TemplateTypeParmType>(getSema().Context.getTypeDeclType(TTPD));
-
+
if (TTP->getDepth() < TemplateArgs.getNumLevels()) {
// FIXME: This needs testing w/ member access expressions.
TemplateArgument Arg = TemplateArgs(TTP->getDepth(), TTP->getIndex());
-
+
if (TTP->isParameterPack()) {
- assert(Arg.getKind() == TemplateArgument::Pack &&
+ assert(Arg.getKind() == TemplateArgument::Pack &&
"Missing argument pack");
-
+
if (getSema().ArgumentPackSubstitutionIndex == -1)
return nullptr;
@@ -1025,16 +1025,16 @@ TemplateInstantiator::TransformFirstQual
QualType T = Arg.getAsType();
if (T.isNull())
return cast_or_null<NamedDecl>(TransformDecl(Loc, D));
-
+
if (const TagType *Tag = T->getAs<TagType>())
return Tag->getDecl();
-
+
// The resulting type is not a tag; complain.
getSema().Diag(Loc, diag::err_nested_name_spec_non_tag) << T;
return nullptr;
}
}
-
+
return cast_or_null<NamedDecl>(TransformDecl(Loc, D));
}
@@ -1051,8 +1051,8 @@ TemplateInstantiator::RebuildExceptionDe
return Var;
}
-VarDecl *TemplateInstantiator::RebuildObjCExceptionDecl(VarDecl *ExceptionDecl,
- TypeSourceInfo *TSInfo,
+VarDecl *TemplateInstantiator::RebuildObjCExceptionDecl(VarDecl *ExceptionDecl,
+ TypeSourceInfo *TSInfo,
QualType T) {
VarDecl *Var = inherited::RebuildObjCExceptionDecl(ExceptionDecl, TSInfo, T);
if (Var)
@@ -1107,13 +1107,13 @@ TemplateName TemplateInstantiator::Trans
if (!TemplateArgs.hasTemplateArgument(TTP->getDepth(),
TTP->getPosition()))
return Name;
-
+
TemplateArgument Arg = TemplateArgs(TTP->getDepth(), TTP->getPosition());
-
+
if (TTP->isParameterPack()) {
- assert(Arg.getKind() == TemplateArgument::Pack &&
+ assert(Arg.getKind() == TemplateArgument::Pack &&
"Missing argument pack");
-
+
if (getSema().ArgumentPackSubstitutionIndex == -1) {
// We have the template argument pack to substitute, but we're not
// actually expanding the enclosing pack expansion yet. So, just
@@ -1123,7 +1123,7 @@ TemplateName TemplateInstantiator::Trans
Arg = getPackSubstitutedTemplateArgument(getSema(), Arg);
}
-
+
TemplateName Template = Arg.getAsTemplate().getNameToSubstitute();
assert(!Template.isNull() && "Null template template argument");
assert(!Template.getAsQualifiedTemplateName() &&
@@ -1133,12 +1133,12 @@ TemplateName TemplateInstantiator::Trans
return Template;
}
}
-
+
if (SubstTemplateTemplateParmPackStorage *SubstPack
= Name.getAsSubstTemplateTemplateParmPack()) {
if (getSema().ArgumentPackSubstitutionIndex == -1)
return Name;
-
+
TemplateArgument Arg = SubstPack->getArgumentPack();
Arg = getPackSubstitutedTemplateArgument(getSema(), Arg);
return Arg.getAsTemplate().getNameToSubstitute();
@@ -1149,7 +1149,7 @@ TemplateName TemplateInstantiator::Trans
AllowInjectedClassName);
}
-ExprResult
+ExprResult
TemplateInstantiator::TransformPredefinedExpr(PredefinedExpr *E) {
if (!E->isTypeDependent())
return E;
@@ -1187,15 +1187,15 @@ TemplateInstantiator::TransformTemplateP
}
if (NTTP->isParameterPack()) {
- assert(Arg.getKind() == TemplateArgument::Pack &&
+ assert(Arg.getKind() == TemplateArgument::Pack &&
"Missing argument pack");
-
+
if (getSema().ArgumentPackSubstitutionIndex == -1) {
// We have an argument pack, but we can't select a particular argument
// out of it yet. Therefore, we'll build an expression to hold on to that
// argument pack.
QualType TargetType = SemaRef.SubstType(NTTP->getType(), TemplateArgs,
- E->getLocation(),
+ E->getLocation(),
NTTP->getDeclName());
if (TargetType.isNull())
return ExprError();
@@ -1205,7 +1205,7 @@ TemplateInstantiator::TransformTemplateP
TargetType->isReferenceType() ? VK_LValue : VK_RValue, NTTP,
E->getLocation(), Arg);
}
-
+
Arg = getPackSubstitutedTemplateArgument(getSema(), Arg);
}
@@ -1260,12 +1260,12 @@ ExprResult TemplateInstantiator::transfo
// Propagate NULL template argument.
VD = nullptr;
}
-
+
// Derive the type we want the substituted decl to have. This had
// better be non-dependent, or these checks will have serious problems.
if (parm->isExpandedParameterPack()) {
type = parm->getExpansionType(SemaRef.ArgumentPackSubstitutionIndex);
- } else if (parm->isParameterPack() &&
+ } else if (parm->isParameterPack() &&
isa<PackExpansionType>(parm->getType())) {
type = SemaRef.SubstType(
cast<PackExpansionType>(parm->getType())->getPattern(),
@@ -1292,8 +1292,8 @@ ExprResult TemplateInstantiator::transfo
return new (SemaRef.Context) SubstNonTypeTemplateParmExpr(
type, resultExpr->getValueKind(), loc, parm, resultExpr);
}
-
-ExprResult
+
+ExprResult
TemplateInstantiator::TransformSubstNonTypeTemplateParmPackExpr(
SubstNonTypeTemplateParmPackExpr *E) {
if (getSema().ArgumentPackSubstitutionIndex == -1) {
@@ -1387,7 +1387,7 @@ TemplateInstantiator::TransformDeclRefEx
if (NonTypeTemplateParmDecl *NTTP = dyn_cast<NonTypeTemplateParmDecl>(D)) {
if (NTTP->getDepth() < TemplateArgs.getNumLevels())
return TransformTemplateParmRefExpr(E, NTTP);
-
+
// We have a non-type template parameter that isn't fully substituted;
// FindInstantiatedDecl will find it in the local instantiation scope.
}
@@ -1406,7 +1406,7 @@ ExprResult TemplateInstantiator::Transfo
getDescribedFunctionTemplate() &&
"Default arg expressions are never formed in dependent cases.");
return SemaRef.BuildCXXDefaultArgExpr(E->getUsedLocation(),
- cast<FunctionDecl>(E->getParam()->getDeclContext()),
+ cast<FunctionDecl>(E->getParam()->getDeclContext()),
E->getParam());
}
@@ -1451,11 +1451,11 @@ TemplateInstantiator::TransformTemplateT
}
TemplateArgument Arg = TemplateArgs(T->getDepth(), T->getIndex());
-
+
if (T->isParameterPack()) {
- assert(Arg.getKind() == TemplateArgument::Pack &&
+ assert(Arg.getKind() == TemplateArgument::Pack &&
"Missing argument pack");
-
+
if (getSema().ArgumentPackSubstitutionIndex == -1) {
// We have the template argument pack, but we're not expanding the
// enclosing pack expansion yet. Just save the template argument
@@ -1467,10 +1467,10 @@ TemplateInstantiator::TransformTemplateT
NewTL.setNameLoc(TL.getNameLoc());
return Result;
}
-
+
Arg = getPackSubstitutedTemplateArgument(getSema(), Arg);
}
-
+
assert(Arg.getKind() == TemplateArgument::Type &&
"Template argument kind mismatch");
@@ -1502,7 +1502,7 @@ TemplateInstantiator::TransformTemplateT
return Result;
}
-QualType
+QualType
TemplateInstantiator::TransformSubstTemplateTypeParmPackType(
TypeLocBuilder &TLB,
SubstTemplateTypeParmPackTypeLoc TL) {
@@ -1565,8 +1565,8 @@ TypeSourceInfo *Sema::SubstType(TypeSour
assert(!CodeSynthesisContexts.empty() &&
"Cannot perform an instantiation without some context on the "
"instantiation stack");
-
- if (!T->getType()->isInstantiationDependentType() &&
+
+ if (!T->getType()->isInstantiationDependentType() &&
!T->getType()->isVariablyModifiedType())
return T;
@@ -1582,11 +1582,11 @@ TypeSourceInfo *Sema::SubstType(TypeLoc
assert(!CodeSynthesisContexts.empty() &&
"Cannot perform an instantiation without some context on the "
"instantiation stack");
-
+
if (TL.getType().isNull())
return nullptr;
- if (!TL.getType()->isInstantiationDependentType() &&
+ if (!TL.getType()->isInstantiationDependentType() &&
!TL.getType()->isVariablyModifiedType()) {
// FIXME: Make a copy of the TypeLoc data here, so that we can
// return a new TypeSourceInfo. Inefficient!
@@ -1716,7 +1716,7 @@ void Sema::SubstExceptionSpec(FunctionDe
UpdateExceptionSpec(New, ESI);
}
-ParmVarDecl *Sema::SubstParmVarDecl(ParmVarDecl *OldParm,
+ParmVarDecl *Sema::SubstParmVarDecl(ParmVarDecl *OldParm,
const MultiLevelTemplateArgumentList &TemplateArgs,
int indexAdjustment,
Optional<unsigned> NumExpansions,
@@ -1727,9 +1727,9 @@ ParmVarDecl *Sema::SubstParmVarDecl(Parm
TypeLoc OldTL = OldDI->getTypeLoc();
if (PackExpansionTypeLoc ExpansionTL = OldTL.getAs<PackExpansionTypeLoc>()) {
- // We have a function parameter pack. Substitute into the pattern of the
+ // We have a function parameter pack. Substitute into the pattern of the
// expansion.
- NewDI = SubstType(ExpansionTL.getPatternLoc(), TemplateArgs,
+ NewDI = SubstType(ExpansionTL.getPatternLoc(), TemplateArgs,
OldParm->getLocation(), OldParm->getDeclName());
if (!NewDI)
return nullptr;
@@ -1745,16 +1745,16 @@ ParmVarDecl *Sema::SubstParmVarDecl(Parm
// itself is not a pack expansion type), so complain. This can occur when
// the substitution goes through an alias template that "loses" the
// pack expansion.
- Diag(OldParm->getLocation(),
+ Diag(OldParm->getLocation(),
diag::err_function_parameter_pack_without_parameter_packs)
<< NewDI->getType();
return nullptr;
- }
+ }
} else {
- NewDI = SubstType(OldDI, TemplateArgs, OldParm->getLocation(),
+ NewDI = SubstType(OldDI, TemplateArgs, OldParm->getLocation(),
OldParm->getDeclName());
}
-
+
if (!NewDI)
return nullptr;
@@ -1801,15 +1801,15 @@ ParmVarDecl *Sema::SubstParmVarDecl(Parm
}
NewParm->setHasInheritedDefaultArg(OldParm->hasInheritedDefaultArg());
-
+
if (OldParm->isParameterPack() && !NewParm->isParameterPack()) {
// Add the new parameter to the instantiated parameter pack.
CurrentInstantiationScope->InstantiatedLocalPackArg(OldParm, NewParm);
} else {
// Introduce an Old -> New mapping
- CurrentInstantiationScope->InstantiatedLocal(OldParm, NewParm);
+ CurrentInstantiationScope->InstantiatedLocal(OldParm, NewParm);
}
-
+
// FIXME: OldParm may come from a FunctionProtoType, in which case CurContext
// can be anything, is this right ?
NewParm->setDeclContext(CurContext);
@@ -1819,7 +1819,7 @@ ParmVarDecl *Sema::SubstParmVarDecl(Parm
InstantiateAttrs(TemplateArgs, OldParm, NewParm);
- return NewParm;
+ return NewParm;
}
/// Substitute the given template arguments into the given set of
@@ -1835,8 +1835,8 @@ bool Sema::SubstParmTypes(
assert(!CodeSynthesisContexts.empty() &&
"Cannot perform an instantiation without some context on the "
"instantiation stack");
-
- TemplateInstantiator Instantiator(*this, TemplateArgs, Loc,
+
+ TemplateInstantiator Instantiator(*this, TemplateArgs, Loc,
DeclarationName());
return Instantiator.TransformFunctionTypeParams(
Loc, Params, nullptr, ExtParamInfos, ParamTypes, OutParams, ParamInfos);
@@ -1875,21 +1875,21 @@ Sema::SubstBaseSpecifiers(CXXRecordDecl
bool ShouldExpand = false;
bool RetainExpansion = false;
Optional<unsigned> NumExpansions;
- if (CheckParameterPacksForExpansion(Base.getEllipsisLoc(),
+ if (CheckParameterPacksForExpansion(Base.getEllipsisLoc(),
Base.getSourceRange(),
Unexpanded,
- TemplateArgs, ShouldExpand,
+ TemplateArgs, ShouldExpand,
RetainExpansion,
NumExpansions)) {
Invalid = true;
continue;
}
-
+
// If we should expand this pack expansion now, do so.
if (ShouldExpand) {
for (unsigned I = 0; I != *NumExpansions; ++I) {
Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(*this, I);
-
+
TypeSourceInfo *BaseTypeLoc = SubstType(Base.getTypeSourceInfo(),
TemplateArgs,
Base.getSourceRange().getBegin(),
@@ -1898,7 +1898,7 @@ Sema::SubstBaseSpecifiers(CXXRecordDecl
Invalid = true;
continue;
}
-
+
if (CXXBaseSpecifier *InstantiatedBase
= CheckBaseSpecifier(Instantiation,
Base.getSourceRange(),
@@ -1910,10 +1910,10 @@ Sema::SubstBaseSpecifiers(CXXRecordDecl
else
Invalid = true;
}
-
+
continue;
}
-
+
// The resulting base specifier will (still) be a pack expansion.
EllipsisLoc = Base.getEllipsisLoc();
Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(*this, -1);
@@ -1927,7 +1927,7 @@ Sema::SubstBaseSpecifiers(CXXRecordDecl
Base.getSourceRange().getBegin(),
DeclarationName());
}
-
+
if (!BaseTypeLoc) {
Invalid = true;
continue;
@@ -1999,11 +1999,11 @@ Sema::InstantiateClass(SourceLocation Po
Pattern = PatternDef;
// Record the point of instantiation.
- if (MemberSpecializationInfo *MSInfo
+ if (MemberSpecializationInfo *MSInfo
= Instantiation->getMemberSpecializationInfo()) {
MSInfo->setTemplateSpecializationKind(TSK);
MSInfo->setPointOfInstantiation(PointOfInstantiation);
- } else if (ClassTemplateSpecializationDecl *Spec
+ } else if (ClassTemplateSpecializationDecl *Spec
= dyn_cast<ClassTemplateSpecializationDecl>(Instantiation)) {
Spec->setTemplateSpecializationKind(TSK);
Spec->setPointOfInstantiation(PointOfInstantiation);
@@ -2563,15 +2563,15 @@ Sema::InstantiateClassMembers(SourceLoca
if (auto *Function = dyn_cast<FunctionDecl>(D)) {
if (FunctionDecl *Pattern
= Function->getInstantiatedFromMemberFunction()) {
- MemberSpecializationInfo *MSInfo
+ MemberSpecializationInfo *MSInfo
= Function->getMemberSpecializationInfo();
assert(MSInfo && "No member specialization information?");
if (MSInfo->getTemplateSpecializationKind()
== TSK_ExplicitSpecialization)
continue;
-
- if (CheckSpecializationInstantiationRedecl(PointOfInstantiation, TSK,
- Function,
+
+ if (CheckSpecializationInstantiationRedecl(PointOfInstantiation, TSK,
+ Function,
MSInfo->getTemplateSpecializationKind(),
MSInfo->getPointOfInstantiation(),
SuppressNew) ||
@@ -2610,31 +2610,31 @@ Sema::InstantiateClassMembers(SourceLoca
if (MSInfo->getTemplateSpecializationKind()
== TSK_ExplicitSpecialization)
continue;
-
- if (CheckSpecializationInstantiationRedecl(PointOfInstantiation, TSK,
- Var,
+
+ if (CheckSpecializationInstantiationRedecl(PointOfInstantiation, TSK,
+ Var,
MSInfo->getTemplateSpecializationKind(),
MSInfo->getPointOfInstantiation(),
SuppressNew) ||
SuppressNew)
continue;
-
+
if (TSK == TSK_ExplicitInstantiationDefinition) {
// C++0x [temp.explicit]p8:
// An explicit instantiation definition that names a class template
- // specialization explicitly instantiates the class template
- // specialization and is only an explicit instantiation definition
- // of members whose definition is visible at the point of
+ // specialization explicitly instantiates the class template
+ // specialization and is only an explicit instantiation definition
+ // of members whose definition is visible at the point of
// instantiation.
if (!Var->getInstantiatedFromStaticDataMember()->getDefinition())
continue;
-
+
Var->setTemplateSpecializationKind(TSK, PointOfInstantiation);
InstantiateVariableDefinition(PointOfInstantiation, Var);
} else {
Var->setTemplateSpecializationKind(TSK, PointOfInstantiation);
}
- }
+ }
} else if (auto *Record = dyn_cast<CXXRecordDecl>(D)) {
// Always skip the injected-class-name, along with any
// redeclarations of nested classes, since both would cause us
@@ -2644,10 +2644,10 @@ Sema::InstantiateClassMembers(SourceLoca
if (Record->isInjectedClassName() || Record->getPreviousDecl() ||
Record->isLambda())
continue;
-
+
MemberSpecializationInfo *MSInfo = Record->getMemberSpecializationInfo();
assert(MSInfo && "No member specialization information?");
-
+
if (MSInfo->getTemplateSpecializationKind()
== TSK_ExplicitSpecialization)
continue;
@@ -2660,33 +2660,33 @@ Sema::InstantiateClassMembers(SourceLoca
continue;
}
- if (CheckSpecializationInstantiationRedecl(PointOfInstantiation, TSK,
- Record,
+ if (CheckSpecializationInstantiationRedecl(PointOfInstantiation, TSK,
+ Record,
MSInfo->getTemplateSpecializationKind(),
MSInfo->getPointOfInstantiation(),
SuppressNew) ||
SuppressNew)
continue;
-
+
CXXRecordDecl *Pattern = Record->getInstantiatedFromMemberClass();
assert(Pattern && "Missing instantiated-from-template information");
-
+
if (!Record->getDefinition()) {
if (!Pattern->getDefinition()) {
// C++0x [temp.explicit]p8:
// An explicit instantiation definition that names a class template
- // specialization explicitly instantiates the class template
- // specialization and is only an explicit instantiation definition
- // of members whose definition is visible at the point of
+ // specialization explicitly instantiates the class template
+ // specialization and is only an explicit instantiation definition
+ // of members whose definition is visible at the point of
// instantiation.
if (TSK == TSK_ExplicitInstantiationDeclaration) {
MSInfo->setTemplateSpecializationKind(TSK);
MSInfo->setPointOfInstantiation(PointOfInstantiation);
}
-
+
continue;
}
-
+
InstantiateClass(PointOfInstantiation, Record, Pattern,
TemplateArgs,
TSK);
@@ -2698,10 +2698,10 @@ Sema::InstantiateClassMembers(SourceLoca
MarkVTableUsed(PointOfInstantiation, Record, true);
}
}
-
+
Pattern = cast_or_null<CXXRecordDecl>(Record->getDefinition());
if (Pattern)
- InstantiateClassMembers(PointOfInstantiation, Pattern, TemplateArgs,
+ InstantiateClassMembers(PointOfInstantiation, Pattern, TemplateArgs,
TSK);
} else if (auto *Enum = dyn_cast<EnumDecl>(D)) {
MemberSpecializationInfo *MSInfo = Enum->getMemberSpecializationInfo();
@@ -2816,10 +2816,10 @@ bool Sema::SubstExprs(ArrayRef<Expr *> E
NestedNameSpecifierLoc
Sema::SubstNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS,
- const MultiLevelTemplateArgumentList &TemplateArgs) {
+ const MultiLevelTemplateArgumentList &TemplateArgs) {
if (!NNS)
return NestedNameSpecifierLoc();
-
+
TemplateInstantiator Instantiator(*this, TemplateArgs, NNS.getBeginLoc(),
DeclarationName());
return Instantiator.TransformNestedNameSpecifierLoc(NNS);
@@ -2850,7 +2850,7 @@ bool Sema::Subst(const TemplateArgumentL
const MultiLevelTemplateArgumentList &TemplateArgs) {
TemplateInstantiator Instantiator(*this, TemplateArgs, SourceLocation(),
DeclarationName());
-
+
return Instantiator.TransformTemplateArguments(Args, NumArgs, Result);
}
@@ -2884,7 +2884,7 @@ LocalInstantiationScope::findInstantiati
LocalDeclsMap::iterator Found = Current->LocalDecls.find(CheckD);
if (Found != Current->LocalDecls.end())
return &Found->second;
-
+
// If this is a tag declaration, it's possible that we need to look for
// a previous declaration.
if (const TagDecl *Tag = dyn_cast<TagDecl>(CheckD))
@@ -2892,8 +2892,8 @@ LocalInstantiationScope::findInstantiati
else
CheckD = nullptr;
} while (CheckD);
-
- // If we aren't combined with our outer scope, we're done.
+
+ // If we aren't combined with our outer scope, we're done.
if (!Current->CombineWithOuterScope)
break;
}
@@ -2965,12 +2965,12 @@ void LocalInstantiationScope::MakeInstan
ArgumentPacks.push_back(Pack);
}
-void LocalInstantiationScope::SetPartiallySubstitutedPack(NamedDecl *Pack,
+void LocalInstantiationScope::SetPartiallySubstitutedPack(NamedDecl *Pack,
const TemplateArgument *ExplicitArgs,
unsigned NumExplicitArgs) {
assert((!PartiallySubstitutedPack || PartiallySubstitutedPack == Pack) &&
"Already have a partially-substituted pack");
- assert((!PartiallySubstitutedPack
+ assert((!PartiallySubstitutedPack
|| NumArgsInPartiallySubstitutedPack == NumExplicitArgs) &&
"Wrong number of arguments in partially-substituted pack");
PartiallySubstitutedPack = Pack;
@@ -2985,15 +2985,15 @@ NamedDecl *LocalInstantiationScope::getP
*ExplicitArgs = nullptr;
if (NumExplicitArgs)
*NumExplicitArgs = 0;
-
- for (const LocalInstantiationScope *Current = this; Current;
+
+ for (const LocalInstantiationScope *Current = this; Current;
Current = Current->Outer) {
if (Current->PartiallySubstitutedPack) {
if (ExplicitArgs)
*ExplicitArgs = Current->ArgsInPartiallySubstitutedPack;
if (NumExplicitArgs)
*NumExplicitArgs = Current->NumArgsInPartiallySubstitutedPack;
-
+
return Current->PartiallySubstitutedPack;
}
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Mon Jul 30 12:24:48 2018
@@ -729,7 +729,7 @@ Decl *TemplateDeclInstantiator::VisitVar
DI, D->getStorageClass());
// In ARC, infer 'retaining' for variables of retainable type.
- if (SemaRef.getLangOpts().ObjCAutoRefCount &&
+ if (SemaRef.getLangOpts().ObjCAutoRefCount &&
SemaRef.inferObjCARCLifetime(Var))
Var->setInvalidDecl();
@@ -2056,7 +2056,7 @@ TemplateDeclInstantiator::VisitCXXMethod
// previous declaration we just found.
if (isFriend && Method->getPreviousDecl())
Method->setAccess(Method->getPreviousDecl()->getAccess());
- else
+ else
Method->setAccess(D->getAccess());
if (FunctionTemplate)
FunctionTemplate->setAccess(Method->getAccess());
@@ -3417,7 +3417,7 @@ TemplateDeclInstantiator::SubstFunctionT
ThisContext = cast<CXXRecordDecl>(Owner);
ThisTypeQuals = Method->getTypeQualifiers();
}
-
+
TypeSourceInfo *NewTInfo
= SemaRef.SubstFunctionDeclType(OldTInfo, TemplateArgs,
D->getTypeSpecStartLoc(),
@@ -4890,14 +4890,14 @@ NamedDecl *Sema::FindInstantiatedDecl(So
const MultiLevelTemplateArgumentList &TemplateArgs,
bool FindingInstantiatedContext) {
DeclContext *ParentDC = D->getDeclContext();
- // FIXME: Parmeters of pointer to functions (y below) that are themselves
+ // FIXME: Parmeters of pointer to functions (y below) that are themselves
// parameters (p below) can have their ParentDC set to the translation-unit
- // - thus we can not consistently check if the ParentDC of such a parameter
+ // - thus we can not consistently check if the ParentDC of such a parameter
// is Dependent or/and a FunctionOrMethod.
- // For e.g. this code, during Template argument deduction tries to
+ // For e.g. this code, during Template argument deduction tries to
// find an instantiated decl for (T y) when the ParentDC for y is
- // the translation unit.
- // e.g. template <class T> void Foo(auto (*p)(T y) -> decltype(y())) {}
+ // the translation unit.
+ // e.g. template <class T> void Foo(auto (*p)(T y) -> decltype(y())) {}
// float baz(float(*)()) { return 0.0; }
// Foo(baz);
// The better fix here is perhaps to ensure that a ParmVarDecl, by the time
Modified: cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp Mon Jul 30 12:24:48 2018
@@ -29,7 +29,7 @@ using namespace clang;
namespace {
/// A class that collects unexpanded parameter packs.
class CollectUnexpandedParameterPacksVisitor :
- public RecursiveASTVisitor<CollectUnexpandedParameterPacksVisitor>
+ public RecursiveASTVisitor<CollectUnexpandedParameterPacksVisitor>
{
typedef RecursiveASTVisitor<CollectUnexpandedParameterPacksVisitor>
inherited;
@@ -58,7 +58,7 @@ namespace {
if (T->getDepth() < DepthLimit)
Unexpanded.push_back({T, Loc});
}
-
+
public:
explicit CollectUnexpandedParameterPacksVisitor(
SmallVectorImpl<UnexpandedParameterPack> &Unexpanded)
@@ -94,10 +94,10 @@ namespace {
bool VisitDeclRefExpr(DeclRefExpr *E) {
if (E->getDecl()->isParameterPack())
addUnexpanded(E->getDecl(), E->getLocation());
-
+
return true;
}
-
+
/// Record occurrences of template template parameter packs.
bool TraverseTemplateName(TemplateName Template) {
if (auto *TTP = dyn_cast_or_null<TemplateTemplateParmDecl>(
@@ -105,7 +105,7 @@ namespace {
if (TTP->isParameterPack())
addUnexpanded(TTP);
}
-
+
return inherited::TraverseTemplateName(Template);
}
@@ -131,7 +131,7 @@ namespace {
/// Suppress traversal into statements and expressions that
/// do not contain unexpanded parameter packs.
- bool TraverseStmt(Stmt *S) {
+ bool TraverseStmt(Stmt *S) {
Expr *E = dyn_cast_or_null<Expr>(S);
if ((E && E->containsUnexpandedParameterPack()) || InLambda)
return inherited::TraverseStmt(S);
@@ -151,7 +151,7 @@ namespace {
/// Suppress traversal into types with location information
/// that do not contain unexpanded parameter packs.
bool TraverseTypeLoc(TypeLoc TL) {
- if ((!TL.getType().isNull() &&
+ if ((!TL.getType().isNull() &&
TL.getType()->containsUnexpandedParameterPack()) ||
InLambda)
return inherited::TraverseTypeLoc(TL);
@@ -160,7 +160,7 @@ namespace {
}
/// Suppress traversal of parameter packs.
- bool TraverseDecl(Decl *D) {
+ bool TraverseDecl(Decl *D) {
// A function parameter pack is a pack expansion, so cannot contain
// an unexpanded parameter pack. Likewise for a template parameter
// pack that contains any references to other packs.
@@ -215,7 +215,7 @@ namespace {
bool TraverseTemplateArgumentLoc(const TemplateArgumentLoc &ArgLoc) {
if (ArgLoc.getArgument().isPackExpansion())
return true;
-
+
return inherited::TraverseTemplateArgumentLoc(ArgLoc);
}
@@ -335,7 +335,7 @@ Sema::DiagnoseUnexpandedParameterPacks(S
return false;
}
}
-
+
SmallVector<SourceLocation, 4> Locations;
SmallVector<IdentifierInfo *, 4> Names;
llvm::SmallPtrSet<IdentifierInfo *, 4> NamesKnown;
@@ -365,11 +365,11 @@ Sema::DiagnoseUnexpandedParameterPacks(S
return true;
}
-bool Sema::DiagnoseUnexpandedParameterPack(SourceLocation Loc,
+bool Sema::DiagnoseUnexpandedParameterPack(SourceLocation Loc,
TypeSourceInfo *T,
UnexpandedParameterPackContext UPPC) {
// C++0x [temp.variadic]p5:
- // An appearance of a name of a parameter pack that is not expanded is
+ // An appearance of a name of a parameter pack that is not expanded is
// ill-formed.
if (!T->getType()->containsUnexpandedParameterPack())
return false;
@@ -384,7 +384,7 @@ bool Sema::DiagnoseUnexpandedParameterPa
bool Sema::DiagnoseUnexpandedParameterPack(Expr *E,
UnexpandedParameterPackContext UPPC) {
// C++0x [temp.variadic]p5:
- // An appearance of a name of a parameter pack that is not expanded is
+ // An appearance of a name of a parameter pack that is not expanded is
// ill-formed.
if (!E->containsUnexpandedParameterPack())
return false;
@@ -398,9 +398,9 @@ bool Sema::DiagnoseUnexpandedParameterPa
bool Sema::DiagnoseUnexpandedParameterPack(const CXXScopeSpec &SS,
UnexpandedParameterPackContext UPPC) {
// C++0x [temp.variadic]p5:
- // An appearance of a name of a parameter pack that is not expanded is
+ // An appearance of a name of a parameter pack that is not expanded is
// ill-formed.
- if (!SS.getScopeRep() ||
+ if (!SS.getScopeRep() ||
!SS.getScopeRep()->containsUnexpandedParameterPack())
return false;
@@ -415,7 +415,7 @@ bool Sema::DiagnoseUnexpandedParameterPa
bool Sema::DiagnoseUnexpandedParameterPack(const DeclarationNameInfo &NameInfo,
UnexpandedParameterPackContext UPPC) {
// C++0x [temp.variadic]p5:
- // An appearance of a name of a parameter pack that is not expanded is
+ // An appearance of a name of a parameter pack that is not expanded is
// ill-formed.
switch (NameInfo.getName().getNameKind()) {
case DeclarationName::Identifier:
@@ -451,7 +451,7 @@ bool Sema::DiagnoseUnexpandedParameterPa
bool Sema::DiagnoseUnexpandedParameterPack(SourceLocation Loc,
TemplateName Template,
UnexpandedParameterPackContext UPPC) {
-
+
if (Template.isNull() || !Template.containsUnexpandedParameterPack())
return false;
@@ -464,10 +464,10 @@ bool Sema::DiagnoseUnexpandedParameterPa
bool Sema::DiagnoseUnexpandedParameterPack(TemplateArgumentLoc Arg,
UnexpandedParameterPackContext UPPC) {
- if (Arg.getArgument().isNull() ||
+ if (Arg.getArgument().isNull() ||
!Arg.getArgument().containsUnexpandedParameterPack())
return false;
-
+
SmallVector<UnexpandedParameterPack, 2> Unexpanded;
CollectUnexpandedParameterPacksVisitor(Unexpanded)
.TraverseTemplateArgumentLoc(Arg);
@@ -489,12 +489,12 @@ void Sema::collectUnexpandedParameterPac
void Sema::collectUnexpandedParameterPacks(QualType T,
SmallVectorImpl<UnexpandedParameterPack> &Unexpanded) {
- CollectUnexpandedParameterPacksVisitor(Unexpanded).TraverseType(T);
-}
+ CollectUnexpandedParameterPacksVisitor(Unexpanded).TraverseType(T);
+}
void Sema::collectUnexpandedParameterPacks(TypeLoc TL,
SmallVectorImpl<UnexpandedParameterPack> &Unexpanded) {
- CollectUnexpandedParameterPacksVisitor(Unexpanded).TraverseTypeLoc(TL);
+ CollectUnexpandedParameterPacksVisitor(Unexpanded).TraverseTypeLoc(TL);
}
void Sema::collectUnexpandedParameterPacks(
@@ -512,7 +512,7 @@ void Sema::collectUnexpandedParameterPac
}
-ParsedTemplateArgument
+ParsedTemplateArgument
Sema::ActOnPackExpansion(const ParsedTemplateArgument &Arg,
SourceLocation EllipsisLoc) {
if (Arg.isInvalid())
@@ -524,7 +524,7 @@ Sema::ActOnPackExpansion(const ParsedTem
if (Result.isInvalid())
return ParsedTemplateArgument();
- return ParsedTemplateArgument(Arg.getKind(), Result.get().getAsOpaquePtr(),
+ return ParsedTemplateArgument(Arg.getKind(), Result.get().getAsOpaquePtr(),
Arg.getLocation());
}
@@ -532,11 +532,11 @@ Sema::ActOnPackExpansion(const ParsedTem
ExprResult Result = ActOnPackExpansion(Arg.getAsExpr(), EllipsisLoc);
if (Result.isInvalid())
return ParsedTemplateArgument();
-
- return ParsedTemplateArgument(Arg.getKind(), Result.get(),
+
+ return ParsedTemplateArgument(Arg.getKind(), Result.get(),
Arg.getLocation());
}
-
+
case ParsedTemplateArgument::Template:
if (!Arg.getAsTemplate().get().containsUnexpandedParameterPack()) {
SourceRange R(Arg.getLocation());
@@ -546,13 +546,13 @@ Sema::ActOnPackExpansion(const ParsedTem
<< R;
return ParsedTemplateArgument();
}
-
+
return Arg.getTemplatePackExpansion(EllipsisLoc);
}
llvm_unreachable("Unhandled template argument kind?");
}
-TypeResult Sema::ActOnPackExpansion(ParsedType Type,
+TypeResult Sema::ActOnPackExpansion(ParsedType Type,
SourceLocation EllipsisLoc) {
TypeSourceInfo *TSInfo;
GetTypeFromParser(Type, &TSInfo);
@@ -562,7 +562,7 @@ TypeResult Sema::ActOnPackExpansion(Pars
TypeSourceInfo *TSResult = CheckPackExpansion(TSInfo, EllipsisLoc, None);
if (!TSResult)
return true;
-
+
return CreateParsedType(TSResult->getType(), TSResult);
}
@@ -570,7 +570,7 @@ TypeSourceInfo *
Sema::CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc,
Optional<unsigned> NumExpansions) {
// Create the pack expansion type and source-location information.
- QualType Result = CheckPackExpansion(Pattern->getType(),
+ QualType Result = CheckPackExpansion(Pattern->getType(),
Pattern->getTypeLoc().getSourceRange(),
EllipsisLoc, NumExpansions);
if (Result.isNull())
@@ -608,7 +608,7 @@ ExprResult Sema::CheckPackExpansion(Expr
Optional<unsigned> NumExpansions) {
if (!Pattern)
return ExprError();
-
+
// C++0x [temp.variadic]p5:
// The pattern of a pack expansion shall name one or more
// parameter packs that are not expanded by a nested pack
@@ -618,7 +618,7 @@ ExprResult Sema::CheckPackExpansion(Expr
<< Pattern->getSourceRange();
return ExprError();
}
-
+
// Create the pack expansion expression and source-location information.
return new (Context)
PackExpansionExpr(Context.DependentTy, Pattern, EllipsisLoc, NumExpansions);
@@ -643,7 +643,7 @@ bool Sema::CheckParameterPacksForExpansi
unsigned Depth = 0, Index = 0;
IdentifierInfo *Name;
bool IsFunctionParameterPack = false;
-
+
if (const TemplateTypeParmType *TTP
= i->first.dyn_cast<const TemplateTypeParmType *>()) {
Depth = TTP->getDepth();
@@ -658,13 +658,13 @@ bool Sema::CheckParameterPacksForExpansi
Name = ND->getIdentifier();
}
-
+
// Determine the size of this argument pack.
- unsigned NewPackSize;
+ unsigned NewPackSize;
if (IsFunctionParameterPack) {
// Figure out whether we're instantiating to an argument pack or not.
typedef LocalInstantiationScope::DeclArgumentPack DeclArgumentPack;
-
+
llvm::PointerUnion<Decl *, DeclArgumentPack *> *Instantiation
= CurrentInstantiationScope->findInstantiationOf(
i->first.get<NamedDecl *>());
@@ -678,25 +678,25 @@ bool Sema::CheckParameterPacksForExpansi
continue;
}
} else {
- // If we don't have a template argument at this depth/index, then we
- // cannot expand the pack expansion. Make a note of this, but we still
+ // If we don't have a template argument at this depth/index, then we
+ // cannot expand the pack expansion. Make a note of this, but we still
// want to check any parameter packs we *do* have arguments for.
if (Depth >= TemplateArgs.getNumLevels() ||
!TemplateArgs.hasTemplateArgument(Depth, Index)) {
ShouldExpand = false;
continue;
}
-
+
// Determine the size of the argument pack.
NewPackSize = TemplateArgs(Depth, Index).pack_size();
}
-
+
// C++0x [temp.arg.explicit]p9:
- // Template argument deduction can extend the sequence of template
+ // Template argument deduction can extend the sequence of template
// arguments corresponding to a template parameter pack, even when the
// sequence contains explicitly specified template arguments.
if (!IsFunctionParameterPack && CurrentInstantiationScope) {
- if (NamedDecl *PartialPack
+ if (NamedDecl *PartialPack
= CurrentInstantiationScope->getPartiallySubstitutedPack()){
unsigned PartialDepth, PartialIndex;
std::tie(PartialDepth, PartialIndex) = getDepthAndIndex(PartialPack);
@@ -709,9 +709,9 @@ bool Sema::CheckParameterPacksForExpansi
}
}
}
-
+
if (!NumExpansions) {
- // The is the first pack we've seen for which we have an argument.
+ // The is the first pack we've seen for which we have an argument.
// Record it.
NumExpansions = NewPackSize;
FirstPack.first = Name;
@@ -719,10 +719,10 @@ bool Sema::CheckParameterPacksForExpansi
HaveFirstPack = true;
continue;
}
-
+
if (NewPackSize != *NumExpansions) {
// C++0x [temp.variadic]p5:
- // All of the parameter packs expanded by a pack expansion shall have
+ // All of the parameter packs expanded by a pack expansion shall have
// the same number of arguments specified.
if (HaveFirstPack)
Diag(EllipsisLoc, diag::err_pack_expansion_length_conflict)
@@ -772,17 +772,17 @@ Optional<unsigned> Sema::getNumArguments
// Compute the depth and index for this parameter pack.
unsigned Depth;
unsigned Index;
-
+
if (const TemplateTypeParmType *TTP
= Unexpanded[I].first.dyn_cast<const TemplateTypeParmType *>()) {
Depth = TTP->getDepth();
Index = TTP->getIndex();
- } else {
+ } else {
NamedDecl *ND = Unexpanded[I].first.get<NamedDecl *>();
if (isa<ParmVarDecl>(ND)) {
// Function parameter pack.
typedef LocalInstantiationScope::DeclArgumentPack DeclArgumentPack;
-
+
llvm::PointerUnion<Decl *, DeclArgumentPack *> *Instantiation
= CurrentInstantiationScope->findInstantiationOf(
Unexpanded[I].first.get<NamedDecl *>());
@@ -804,13 +804,13 @@ Optional<unsigned> Sema::getNumArguments
// The pattern refers to an unknown template argument. We're not ready to
// expand this pack yet.
return None;
-
+
// Determine the size of the argument pack.
unsigned Size = TemplateArgs(Depth, Index).pack_size();
assert((!Result || *Result == Size) && "inconsistent pack sizes");
Result = Size;
}
-
+
return Result;
}
@@ -826,14 +826,14 @@ bool Sema::containsUnexpandedParameterPa
return true;
break;
}
-
+
case TST_typeofExpr:
case TST_decltype:
- if (DS.getRepAsExpr() &&
+ if (DS.getRepAsExpr() &&
DS.getRepAsExpr()->containsUnexpandedParameterPack())
return true;
break;
-
+
case TST_unspecified:
case TST_void:
case TST_char:
@@ -879,7 +879,7 @@ bool Sema::containsUnexpandedParameterPa
case DeclaratorChunk::BlockPointer:
// These declarator chunks cannot contain any parameter packs.
break;
-
+
case DeclaratorChunk::Array:
if (Chunk.Arr.NumElts &&
Chunk.Arr.NumElts->containsUnexpandedParameterPack())
@@ -964,7 +964,7 @@ ExprResult Sema::ActOnSizeofParameterPac
case LookupResult::Found:
ParameterPack = R.getFoundDecl();
break;
-
+
case LookupResult::NotFound:
case LookupResult::NotFoundInCurrentInstantiation:
if (TypoCorrection Corrected =
Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Mon Jul 30 12:24:48 2018
@@ -2851,7 +2851,7 @@ static QualType GetDeclSpecTypeForDeclar
case DeclaratorContext::ObjCParameterContext:
case DeclaratorContext::ObjCResultContext:
case DeclaratorContext::PrototypeContext:
- Error = 0;
+ Error = 0;
break;
case DeclaratorContext::LambdaExprParameterContext:
// In C++14, generic lambdas allow 'auto' in their parameters.
@@ -2859,7 +2859,7 @@ static QualType GetDeclSpecTypeForDeclar
!Auto || Auto->getKeyword() != AutoTypeKeyword::Auto)
Error = 16;
else {
- // If auto is mentioned in a lambda parameter context, convert it to a
+ // If auto is mentioned in a lambda parameter context, convert it to a
// template parameter type.
sema::LambdaScopeInfo *LSI = SemaRef.getCurLambda();
assert(LSI && "No LambdaScopeInfo on the stack!");
@@ -2877,7 +2877,7 @@ static QualType GetDeclSpecTypeForDeclar
TemplateParameterDepth, AutoParameterPosition,
/*Identifier*/nullptr, false, IsParameterPack);
LSI->AutoTemplateParams.push_back(CorrespondingTemplateParam);
- // Replace the 'auto' in the function parameter with this invented
+ // Replace the 'auto' in the function parameter with this invented
// template type parameter.
// FIXME: Retain some type sugar to indicate that this was written
// as 'auto'.
@@ -4440,7 +4440,7 @@ static TypeSourceInfo *GetFullTypeForDec
S.Diag(D.getIdentifierLoc(), diag::err_opencl_invalid_return)
<< T << 0 /*pointer hint*/;
D.setInvalidType(true);
- }
+ }
} else if (!S.getLangOpts().HalfArgsAndReturns) {
S.Diag(D.getIdentifierLoc(),
diag::err_parameters_retval_cannot_have_fp16_type) << 1;
@@ -5332,7 +5332,7 @@ namespace {
TL.copy(OldTL.castAs<TemplateSpecializationTypeLoc>());
assert(TL.getRAngleLoc() == OldTL.castAs<TemplateSpecializationTypeLoc>().getRAngleLoc());
}
-
+
}
void VisitTypeOfExprTypeLoc(TypeOfExprTypeLoc TL) {
assert(DS.getTypeSpecType() == DeclSpec::TST_typeofExpr);
@@ -5627,11 +5627,11 @@ Sema::GetTypeSourceInfoForDeclarator(Dec
}
for (unsigned i = 0, e = D.getNumTypeObjects(); i != e; ++i) {
-
+
if (DependentAddressSpaceTypeLoc DASTL =
CurrTL.getAs<DependentAddressSpaceTypeLoc>()) {
fillDependentAddressSpaceTypeLoc(DASTL, D.getTypeObject(i).getAttrs());
- CurrTL = DASTL.getPointeeTypeLoc().getUnqualifiedLoc();
+ CurrTL = DASTL.getPointeeTypeLoc().getUnqualifiedLoc();
}
// An AtomicTypeLoc might be produced by an atomic qualifier in this
@@ -5727,13 +5727,13 @@ ParsedType Sema::ActOnObjCInstanceType(S
// Type Attribute Processing
//===----------------------------------------------------------------------===//
-/// BuildAddressSpaceAttr - Builds a DependentAddressSpaceType if an expression
-/// is uninstantiated. If instantiated it will apply the appropriate address space
+/// BuildAddressSpaceAttr - Builds a DependentAddressSpaceType if an expression
+/// is uninstantiated. If instantiated it will apply the appropriate address space
/// to the type. This function allows dependent template variables to be used in
-/// conjunction with the address_space attribute
+/// conjunction with the address_space attribute
QualType Sema::BuildAddressSpaceAttr(QualType &T, Expr *AddrSpace,
SourceLocation AttrLoc) {
- if (!AddrSpace->isValueDependent()) {
+ if (!AddrSpace->isValueDependent()) {
llvm::APSInt addrSpace(32);
if (!AddrSpace->isIntegerConstantExpr(addrSpace, Context)) {
@@ -5783,8 +5783,8 @@ QualType Sema::BuildAddressSpaceAttr(Qua
}
// A check with similar intentions as checking if a type already has an
- // address space except for on a dependent types, basically if the
- // current type is already a DependentAddressSpaceType then its already
+ // address space except for on a dependent types, basically if the
+ // current type is already a DependentAddressSpaceType then its already
// lined up to have another address space on it and we can't have
// multiple address spaces on the one pointer indirection
if (T->getAs<DependentAddressSpaceType>()) {
@@ -6116,7 +6116,7 @@ static bool handleObjCGCTypeAttr(TypePro
attr.setInvalid();
return true;
}
-
+
// Check the attribute arguments.
if (!attr.isArgIdent(0)) {
S.Diag(attr.getLoc(), diag::err_attribute_argument_type)
@@ -6327,7 +6327,7 @@ static bool handleMSPointerTypeQualifier
<< "'__sptr'" << "'__uptr'";
return true;
}
-
+
Desugared = AT->getEquivalentType();
AT = dyn_cast<AttributedType>(Desugared);
}
@@ -6384,7 +6384,7 @@ bool Sema::checkNullabilityTypeSpecifier
<< FixItHint::CreateRemoval(nullabilityLoc);
break;
- }
+ }
// Conflicting nullability.
Diag(nullabilityLoc, diag::err_nullability_conflicting)
@@ -6430,7 +6430,7 @@ bool Sema::checkNullabilityTypeSpecifier
<< DiagNullabilityKind(nullability, isContextSensitive) << type;
return true;
}
-
+
// For the context-sensitive keywords/Objective-C property
// attributes, require that the type be a single-level pointer.
if (isContextSensitive) {
@@ -6472,7 +6472,7 @@ bool Sema::checkObjCKindOfType(QualType
// Find out if it's an Objective-C object or object pointer type;
const ObjCObjectPointerType *ptrType = type->getAs<ObjCObjectPointerType>();
- const ObjCObjectType *objType = ptrType ? ptrType->getObjectType()
+ const ObjCObjectType *objType = ptrType ? ptrType->getObjectType()
: type->getAs<ObjCObjectType>();
// If not, we can't apply __kindof.
@@ -6501,7 +6501,7 @@ bool Sema::checkObjCKindOfType(QualType
}
// Build the attributed type to record where __kindof occurred.
- type = Context.getAttributedType(AttributedType::attr_objc_kindof,
+ type = Context.getAttributedType(AttributedType::attr_objc_kindof,
type,
equivType);
@@ -6601,7 +6601,7 @@ static bool distributeNullabilityTypeAtt
}
return false;
-
+
// Don't walk through these.
case DeclaratorChunk::Reference:
case DeclaratorChunk::Pipe:
@@ -6732,7 +6732,7 @@ static bool handleFunctionTypeAttr(TypeP
if (S.CheckAttrTarget(attr) || S.CheckAttrNoArgs(attr))
return true;
- // If this is not a function type, warning will be asserted by subject
+ // If this is not a function type, warning will be asserted by subject
// check.
if (!unwrapped.isFunctionType())
return true;
@@ -7972,7 +7972,7 @@ static QualType getDecltypeForExpr(Sema
} else if (auto *PE = dyn_cast<PredefinedExpr>(E)) {
return PE->getType();
}
-
+
// C++11 [expr.lambda.prim]p18:
// Every occurrence of decltype((x)) where x is a possibly
// parenthesized id-expression that names an entity of automatic
Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Mon Jul 30 12:24:48 2018
@@ -1815,7 +1815,7 @@ public:
OMPClause *RebuildOMPNumTeamsClause(Expr *NumTeams, SourceLocation StartLoc,
SourceLocation LParenLoc,
SourceLocation EndLoc) {
- return getSema().ActOnOpenMPNumTeamsClause(NumTeams, StartLoc, LParenLoc,
+ return getSema().ActOnOpenMPNumTeamsClause(NumTeams, StartLoc, LParenLoc,
EndLoc);
}
@@ -3033,7 +3033,7 @@ public:
Sel, Method, LBracLoc, SelectorLocs,
RBracLoc, Args);
-
+
}
/// Build a new Objective-C ivar reference expression.
@@ -6356,7 +6356,7 @@ TreeTransform<Derived>::TransformObjCObj
TypeLocBuilder TypeArgBuilder;
TypeArgBuilder.reserve(PatternLoc.getFullDataSize());
- QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
+ QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
PatternLoc);
if (NewPatternType.isNull())
return QualType();
@@ -10963,7 +10963,7 @@ TreeTransform<Derived>::TransformLambdaE
TypeSourceInfo *NewCallOpTSI = nullptr;
{
TypeSourceInfo *OldCallOpTSI = E->getCallOperator()->getTypeSourceInfo();
- FunctionProtoTypeLoc OldCallOpFPTL =
+ FunctionProtoTypeLoc OldCallOpFPTL =
OldCallOpTSI->getTypeLoc().getAs<FunctionProtoTypeLoc>();
TypeLocBuilder NewCallOpTLBuilder;
@@ -11059,7 +11059,7 @@ TreeTransform<Derived>::TransformLambdaE
// Rebuild init-captures, including the implied field declaration.
if (E->isInitCapture(C)) {
- InitCaptureInfoTy InitExprTypePair =
+ InitCaptureInfoTy InitExprTypePair =
InitCaptureExprsAndTypes[C - E->capture_begin()];
ExprResult Init = InitExprTypePair.first;
QualType InitQualType = InitExprTypePair.second;
Modified: cfe/trunk/lib/Sema/TypeLocBuilder.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TypeLocBuilder.h?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TypeLocBuilder.h (original)
+++ cfe/trunk/lib/Sema/TypeLocBuilder.h Mon Jul 30 12:24:48 2018
@@ -37,7 +37,7 @@ class TypeLocBuilder {
/// The last type pushed on this builder.
QualType LastTy;
#endif
-
+
/// The inline buffer.
enum { BufferMaxAlignment = alignof(void *) };
llvm::AlignedCharArray<BufferMaxAlignment, InlineCapacity> InlineBuffer;
@@ -81,7 +81,7 @@ class TypeLocBuilder {
#endif
Index = Capacity;
NumBytesAtAlign4 = NumBytesAtAlign8 = 0;
- }
+ }
/// Tell the TypeLocBuilder that the type it is storing has been
/// modified in some safe way that doesn't affect type-location information.
@@ -90,7 +90,7 @@ class TypeLocBuilder {
LastTy = T;
#endif
}
-
+
/// Pushes space for a new TypeLoc of the given type. Invalidates
/// any TypeLocs previously retrieved from this builder.
template <class TyLocType> TyLocType push(QualType T) {
@@ -112,13 +112,13 @@ class TypeLocBuilder {
return DI;
}
- /// Copies the type-location information to the given AST context and
+ /// Copies the type-location information to the given AST context and
/// returns a \c TypeLoc referring into the AST context.
TypeLoc getTypeLocInContext(ASTContext &Context, QualType T) {
#ifndef NDEBUG
assert(T == LastTy && "type doesn't match last type pushed!");
#endif
-
+
size_t FullDataSize = Capacity - Index;
void *Mem = Context.Allocate(FullDataSize);
memcpy(Mem, &Buffer[Index], FullDataSize);
@@ -135,7 +135,7 @@ private:
/// Retrieve a temporary TypeLoc that refers into this \c TypeLocBuilder
/// object.
///
- /// The resulting \c TypeLoc should only be used so long as the
+ /// The resulting \c TypeLoc should only be used so long as the
/// \c TypeLocBuilder is active and has not had more type information
/// pushed into it.
TypeLoc getTemporaryTypeLoc(QualType T) {
Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Mon Jul 30 12:24:48 2018
@@ -6032,7 +6032,7 @@ QualType ASTReader::readTypeRecord(unsig
}
QualType ResultType = readType(*Loc.F, Record, Idx);
FunctionType::ExtInfo Info(Record[1], Record[2], Record[3],
- (CallingConv)Record[4], Record[5], Record[6],
+ (CallingConv)Record[4], Record[5], Record[6],
Record[7]);
return Context.getFunctionNoProtoType(ResultType, Info);
}
Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Mon Jul 30 12:24:48 2018
@@ -569,7 +569,7 @@ void ASTDeclReader::VisitDecl(Decl *D) {
Reader.addPendingDeclContextInfo(D,
SemaDCIDForTemplateParmDecl,
LexicalDCIDForTemplateParmDecl);
- D->setDeclContext(Reader.getContext().getTranslationUnitDecl());
+ D->setDeclContext(Reader.getContext().getTranslationUnitDecl());
} else {
auto *SemaDC = ReadDeclAs<DeclContext>();
auto *LexicalDC = ReadDeclAs<DeclContext>();
@@ -701,7 +701,7 @@ void ASTDeclReader::VisitTypeAliasDecl(T
ASTDeclReader::RedeclarableResult ASTDeclReader::VisitTagDecl(TagDecl *TD) {
RedeclarableResult Redecl = VisitRedeclarable(TD);
VisitTypeDecl(TD);
-
+
TD->IdentifierNamespace = Record.readInt();
TD->setTagKind((TagDecl::TagKind)Record.readInt());
if (!isa<CXXRecordDecl>(TD))
@@ -710,7 +710,7 @@ ASTDeclReader::RedeclarableResult ASTDec
TD->setFreeStanding(Record.readInt());
TD->setCompleteDefinitionRequired(Record.readInt());
TD->setBraceRange(ReadSourceRange());
-
+
switch (Record.readInt()) {
case 0:
break;
@@ -1717,7 +1717,7 @@ void ASTDeclReader::ReadCXXDefinitionDat
bool IsImplicit = Record.readInt();
auto Kind = static_cast<LambdaCaptureKind>(Record.readInt());
switch (Kind) {
- case LCK_StarThis:
+ case LCK_StarThis:
case LCK_This:
case LCK_VLAType:
*ToCapture++ = Capture(Loc, IsImplicit, Kind, nullptr,SourceLocation());
@@ -2691,8 +2691,8 @@ static bool isConsumerInterestedIn(ASTCo
return false;
}
- if (isa<FileScopeAsmDecl>(D) ||
- isa<ObjCProtocolDecl>(D) ||
+ if (isa<FileScopeAsmDecl>(D) ||
+ isa<ObjCProtocolDecl>(D) ||
isa<ObjCImplDecl>(D) ||
isa<ImportDecl>(D) ||
isa<PragmaCommentDecl>(D) ||
@@ -3274,7 +3274,7 @@ ASTDeclReader::FindExistingResult ASTDec
}
} UpToDate(Name.getAsIdentifierInfo());
- for (IdentifierResolver::iterator I = IdResolver.begin(Name),
+ for (IdentifierResolver::iterator I = IdResolver.begin(Name),
IEnd = IdResolver.end();
I != IEnd; ++I) {
if (NamedDecl *Existing = getDeclForMerging(*I, TypedefNameForLinkage))
@@ -3759,7 +3759,7 @@ Decl *ASTReader::ReadDeclRecord(DeclID I
Error("attempt to read a C++ ctor initializer record as a declaration");
return nullptr;
case DECL_IMPORT:
- // Note: last entry of the ImportDecl record is the number of stored source
+ // Note: last entry of the ImportDecl record is the number of stored source
// locations.
D = ImportDecl::CreateDeserialized(Context, ID, Record.back());
break;
@@ -3819,7 +3819,7 @@ Decl *ASTReader::ReadDeclRecord(DeclID I
if (Class->isThisDeclarationADefinition() ||
PendingDefinitions.count(Class))
loadObjCCategories(ID, Class);
-
+
// If we have deserialized a declaration that has a definition the
// AST consumer might need to know about, queue it.
// We don't pass it to the consumer immediately because we may be in recursive
@@ -3981,17 +3981,17 @@ namespace {
llvm::DenseMap<DeclarationName, ObjCCategoryDecl *> NameCategoryMap;
serialization::GlobalDeclID InterfaceID;
unsigned PreviousGeneration;
-
+
void add(ObjCCategoryDecl *Cat) {
// Only process each category once.
if (!Deserialized.erase(Cat))
return;
-
+
// Check for duplicate categories.
if (Cat->getDeclName()) {
ObjCCategoryDecl *&Existing = NameCategoryMap[Cat->getDeclName()];
- if (Existing &&
- Reader.getOwningModuleFile(Existing)
+ if (Existing &&
+ Reader.getOwningModuleFile(Existing)
!= Reader.getOwningModuleFile(Cat)) {
// FIXME: We should not warn for duplicates in diamond:
//
@@ -4001,8 +4001,8 @@ namespace {
// \ / //
// MB //
//
- // If there are duplicates in ML/MR, there will be warning when
- // creating MB *and* when importing MB. We should not warn when
+ // If there are duplicates in ML/MR, there will be warning when
+ // creating MB *and* when importing MB. We should not warn when
// importing.
Reader.Diag(Cat->getLocation(), diag::warn_dup_category_def)
<< Interface->getDeclName() << Cat->getDeclName();
@@ -4012,7 +4012,7 @@ namespace {
Existing = Cat;
}
}
-
+
// Add this category to the end of the chain.
if (Tail)
ASTDeclReader::setNextObjCCategory(Tail, Cat);
@@ -4020,7 +4020,7 @@ namespace {
Interface->setCategoryListRaw(Cat);
Tail = Cat;
}
-
+
public:
ObjCCategoriesVisitor(ASTReader &Reader,
ObjCInterfaceDecl *Interface,
@@ -4033,7 +4033,7 @@ namespace {
for (auto *Cat : Interface->known_categories()) {
if (Cat->getDeclName())
NameCategoryMap[Cat->getDeclName()] = Cat;
-
+
// Keep track of the tail of the category list.
Tail = Cat;
}
@@ -4044,8 +4044,8 @@ namespace {
// this module file, we're done.
if (M.Generation <= PreviousGeneration)
return true;
-
- // Map global ID of the definition down to the local ID used in this
+
+ // Map global ID of the definition down to the local ID used in this
// module file. If there is no such mapping, we'll find nothing here
// (or in any module it imports).
DeclID LocalID = Reader.mapGlobalIDToModuleFileGlobalID(M, InterfaceID);
@@ -4057,7 +4057,7 @@ namespace {
const ObjCCategoriesInfo Compare = { LocalID, 0 };
const ObjCCategoriesInfo *Result
= std::lower_bound(M.ObjCCategoriesMap,
- M.ObjCCategoriesMap + M.LocalNumObjCCategoriesInMap,
+ M.ObjCCategoriesMap + M.LocalNumObjCCategoriesInMap,
Compare);
if (Result == M.ObjCCategoriesMap + M.LocalNumObjCCategoriesInMap ||
Result->DefinitionID != LocalID) {
@@ -4066,7 +4066,7 @@ namespace {
// so suppress further lookup.
return Reader.isDeclIDFromModule(InterfaceID, M);
}
-
+
// We found something. Dig out all of the categories.
unsigned Offset = Result->Offset;
unsigned N = M.ObjCCategories[Offset];
Modified: cfe/trunk/lib/Serialization/ASTReaderInternals.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderInternals.h?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderInternals.h (original)
+++ cfe/trunk/lib/Serialization/ASTReaderInternals.h Mon Jul 30 12:24:48 2018
@@ -33,7 +33,7 @@ struct HeaderFileInfo;
class HeaderSearch;
class IdentifierTable;
class ObjCMethodDecl;
-
+
namespace serialization {
class ModuleFile;
@@ -45,7 +45,7 @@ namespace reader {
class ASTDeclContextNameLookupTrait {
ASTReader &Reader;
ModuleFile &F;
-
+
public:
// Maximum number of lookup tables we allow before condensing the tables.
static const int MaxTables = 4;
@@ -141,31 +141,31 @@ public:
}
static hash_value_type ComputeHash(const internal_key_type& a);
-
+
static std::pair<unsigned, unsigned>
ReadKeyDataLength(const unsigned char*& d);
// This hopefully will just get inlined and removed by the optimizer.
static const internal_key_type&
GetInternalKey(const external_key_type& x) { return x; }
-
+
// This hopefully will just get inlined and removed by the optimizer.
static const external_key_type&
GetExternalKey(const internal_key_type& x) { return x; }
- static internal_key_type ReadKey(const unsigned char* d, unsigned n);
+ static internal_key_type ReadKey(const unsigned char* d, unsigned n);
};
/// Class that performs lookup for an identifier stored in an AST file.
class ASTIdentifierLookupTrait : public ASTIdentifierLookupTraitBase {
ASTReader &Reader;
ModuleFile &F;
-
+
// If we know the IdentifierInfo in advance, it is here and we will
// not build a new one. Used when deserializing information about an
// identifier that was constructed before the AST file was read.
IdentifierInfo *KnownII;
-
+
public:
using data_type = IdentifierInfo *;
@@ -176,12 +176,12 @@ public:
data_type ReadData(const internal_key_type& k,
const unsigned char* d,
unsigned DataLen);
-
+
IdentID ReadIdentifierID(const unsigned char *d);
ASTReader &getReader() const { return Reader; }
};
-
+
/// The on-disk hash table used to contain information about
/// all of the identifiers in the program.
using ASTIdentifierLookupTable =
@@ -192,7 +192,7 @@ using ASTIdentifierLookupTable =
class ASTSelectorLookupTrait {
ASTReader &Reader;
ModuleFile &F;
-
+
public:
struct data_type {
SelectorID ID;
@@ -203,40 +203,40 @@ public:
SmallVector<ObjCMethodDecl *, 2> Instance;
SmallVector<ObjCMethodDecl *, 2> Factory;
};
-
+
using external_key_type = Selector;
using internal_key_type = external_key_type;
using hash_value_type = unsigned;
using offset_type = unsigned;
-
+
ASTSelectorLookupTrait(ASTReader &Reader, ModuleFile &F)
: Reader(Reader), F(F) {}
-
+
static bool EqualKey(const internal_key_type& a,
const internal_key_type& b) {
return a == b;
}
-
+
static hash_value_type ComputeHash(Selector Sel);
-
+
static const internal_key_type&
GetInternalKey(const external_key_type& x) { return x; }
-
+
static std::pair<unsigned, unsigned>
ReadKeyDataLength(const unsigned char*& d);
-
+
internal_key_type ReadKey(const unsigned char* d, unsigned);
data_type ReadData(Selector, const unsigned char* d, unsigned DataLen);
};
-
+
/// The on-disk hash table used for the global method pool.
using ASTSelectorLookupTable =
llvm::OnDiskChainedHashTable<ASTSelectorLookupTrait>;
-
+
/// Trait class used to search the on-disk hash table containing all of
/// the header search information.
///
-/// The on-disk hash table contains a mapping from each header path to
+/// The on-disk hash table contains a mapping from each header path to
/// information about that header (how many times it has been included, its
/// controlling macro, etc.). Note that we actually hash based on the size
/// and mtime, and support "deep" comparisons of file names based on current
@@ -259,31 +259,31 @@ public:
};
using internal_key_ref = const internal_key_type &;
-
+
using data_type = HeaderFileInfo;
using hash_value_type = unsigned;
using offset_type = unsigned;
-
+
HeaderFileInfoTrait(ASTReader &Reader, ModuleFile &M, HeaderSearch *HS,
const char *FrameworkStrings)
: Reader(Reader), M(M), HS(HS), FrameworkStrings(FrameworkStrings) {}
-
+
static hash_value_type ComputeHash(internal_key_ref ikey);
internal_key_type GetInternalKey(const FileEntry *FE);
bool EqualKey(internal_key_ref a, internal_key_ref b);
-
+
static std::pair<unsigned, unsigned>
ReadKeyDataLength(const unsigned char*& d);
-
+
static internal_key_type ReadKey(const unsigned char *d, unsigned);
-
+
data_type ReadData(internal_key_ref,const unsigned char *d, unsigned DataLen);
};
/// The on-disk hash table used for known header files.
using HeaderFileInfoLookupTable =
llvm::OnDiskChainedHashTable<HeaderFileInfoTrait>;
-
+
} // namespace reader
} // namespace serialization
Modified: cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterDecl.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriterDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriterDecl.cpp Mon Jul 30 12:24:48 2018
@@ -271,7 +271,7 @@ void ASTDeclWriter::Visit(Decl *D) {
// Handle FunctionDecl's body here and write it after all other Stmts/Exprs
// have been written. We want it last because we will not read it back when
- // retrieving it from the AST, we'll just lazily set the offset.
+ // retrieving it from the AST, we'll just lazily set the offset.
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
Record.push_back(FD->doesThisDeclarationHaveABody());
if (FD->doesThisDeclarationHaveABody())
@@ -526,10 +526,10 @@ void ASTDeclWriter::VisitFunctionDecl(Fu
VisitDeclaratorDecl(D);
Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
Record.push_back(D->getIdentifierNamespace());
-
+
// FunctionDecl's body is handled last at ASTWriterDecl::Visit,
// after everything else is written.
-
+
Record.push_back((int)D->SClass); // FIXME: stable encoding
Record.push_back(D->IsInline);
Record.push_back(D->IsInlineSpecified);
@@ -576,10 +576,10 @@ void ASTDeclWriter::VisitFunctionDecl(Fu
Record.AddDeclRef(FTSInfo->getTemplate());
Record.push_back(FTSInfo->getTemplateSpecializationKind());
-
+
// Template arguments.
Record.AddTemplateArgumentList(FTSInfo->TemplateArguments);
-
+
// Template args as written.
Record.push_back(FTSInfo->TemplateArgumentsAsWritten != nullptr);
if (FTSInfo->TemplateArgumentsAsWritten) {
@@ -591,7 +591,7 @@ void ASTDeclWriter::VisitFunctionDecl(Fu
Record.AddSourceLocation(FTSInfo->TemplateArgumentsAsWritten->LAngleLoc);
Record.AddSourceLocation(FTSInfo->TemplateArgumentsAsWritten->RAngleLoc);
}
-
+
Record.AddSourceLocation(FTSInfo->getPointOfInstantiation());
if (D->isCanonicalDecl()) {
@@ -604,12 +604,12 @@ void ASTDeclWriter::VisitFunctionDecl(Fu
case FunctionDecl::TK_DependentFunctionTemplateSpecialization: {
DependentFunctionTemplateSpecializationInfo *
DFTSInfo = D->getDependentSpecializationInfo();
-
+
// Templates.
Record.push_back(DFTSInfo->getNumTemplates());
for (int i=0, e = DFTSInfo->getNumTemplates(); i != e; ++i)
Record.AddDeclRef(DFTSInfo->getTemplate(i));
-
+
// Templates args.
Record.push_back(DFTSInfo->getNumTemplateArgs());
for (int i=0, e = DFTSInfo->getNumTemplateArgs(); i != e; ++i)
@@ -707,7 +707,7 @@ void ASTDeclWriter::VisitObjCInterfaceDe
if (D->isThisDeclarationADefinition()) {
// Write the DefinitionData
ObjCInterfaceDecl::DefinitionData &Data = D->data();
-
+
Record.AddTypeSourceInfo(D->getSuperClassTInfo());
Record.AddSourceLocation(D->getEndOfDefinitionLoc());
Record.push_back(Data.HasDesignatedInitializers);
@@ -718,7 +718,7 @@ void ASTDeclWriter::VisitObjCInterfaceDe
Record.AddDeclRef(P);
for (const auto &PL : D->protocol_locs())
Record.AddSourceLocation(PL);
-
+
// Write out the protocols that are transitively referenced.
Record.push_back(Data.AllReferencedProtocols.size());
for (ObjCList<ObjCProtocolDecl>::iterator
@@ -727,17 +727,17 @@ void ASTDeclWriter::VisitObjCInterfaceDe
P != PEnd; ++P)
Record.AddDeclRef(*P);
-
+
if (ObjCCategoryDecl *Cat = D->getCategoryListRaw()) {
// Ensure that we write out the set of categories for this class.
Writer.ObjCClassesWithCategories.insert(D);
-
+
// Make sure that the categories get serialized.
for (; Cat; Cat = Cat->getNextClassCategoryRaw())
(void)Writer.GetDeclRef(Cat);
}
- }
-
+ }
+
Code = serialization::DECL_OBJC_INTERFACE;
}
@@ -765,7 +765,7 @@ void ASTDeclWriter::VisitObjCIvarDecl(Ob
void ASTDeclWriter::VisitObjCProtocolDecl(ObjCProtocolDecl *D) {
VisitRedeclarable(D);
VisitObjCContainerDecl(D);
-
+
Record.push_back(D->isThisDeclarationADefinition());
if (D->isThisDeclarationADefinition()) {
Record.push_back(D->protocol_size());
@@ -774,7 +774,7 @@ void ASTDeclWriter::VisitObjCProtocolDec
for (const auto &PL : D->protocol_locs())
Record.AddSourceLocation(PL);
}
-
+
Code = serialization::DECL_OBJC_PROTOCOL;
}
@@ -964,7 +964,7 @@ void ASTDeclWriter::VisitVarDecl(VarDecl
if (ModulesCodegen)
Writer.ModularCodegenDecls.push_back(Writer.GetDeclRef(D));
}
-
+
enum {
VarNotTemplate = 0, VarTemplate, StaticDataMemberSpecialization
};
@@ -1158,7 +1158,7 @@ void ASTDeclWriter::VisitNamespaceDecl(N
Record.AddDeclRef(D->getAnonymousNamespace());
Code = serialization::DECL_NAMESPACE;
- if (Writer.hasChain() && D->isAnonymousNamespace() &&
+ if (Writer.hasChain() && D->isAnonymousNamespace() &&
D == D->getMostRecentDecl()) {
// This is a most recent reopening of the anonymous namespace. If its parent
// is in a previous PCH (or is the TU), mark that parent for update, because
@@ -1412,7 +1412,7 @@ void ASTDeclWriter::VisitRedeclarableTem
if (D->getInstantiatedFromMemberTemplate())
Record.push_back(D->isMemberSpecialization());
}
-
+
VisitTemplateDecl(D);
Record.push_back(D->getIdentifierNamespace());
}
@@ -1447,7 +1447,7 @@ void ASTDeclWriter::VisitClassTemplateSp
Record.push_back(D->isCanonicalDecl());
if (D->isCanonicalDecl()) {
- // When reading, we'll add it to the folding set of the following template.
+ // When reading, we'll add it to the folding set of the following template.
Record.AddDeclRef(D->getSpecializedTemplate()->getCanonicalDecl());
}
@@ -1573,18 +1573,18 @@ void ASTDeclWriter::VisitNonTypeTemplate
// memory.
if (D->isExpandedParameterPack())
Record.push_back(D->getNumExpansionTypes());
-
+
VisitDeclaratorDecl(D);
// TemplateParmPosition.
Record.push_back(D->getDepth());
Record.push_back(D->getPosition());
-
+
if (D->isExpandedParameterPack()) {
for (unsigned I = 0, N = D->getNumExpansionTypes(); I != N; ++I) {
Record.AddTypeRef(D->getExpansionType(I));
Record.AddTypeSourceInfo(D->getExpansionTypeSourceInfo(I));
}
-
+
Code = serialization::DECL_EXPANDED_NON_TYPE_TEMPLATE_PARM_PACK;
} else {
// Rest of NonTypeTemplateParmDecl.
@@ -1709,7 +1709,7 @@ void ASTDeclWriter::VisitRedeclarable(Re
Record.AddDeclRef(FirstLocal);
}
- // Make sure that we serialize both the previous and the most-recent
+ // Make sure that we serialize both the previous and the most-recent
// declarations, which (transitively) ensures that all declarations in the
// chain get serialized.
//
@@ -2252,11 +2252,11 @@ void ASTWriter::WriteDecl(ASTContext &Co
serialization::DeclID &IDR = DeclIDs[D];
if (IDR == 0)
IDR = NextDeclID++;
-
+
ID = IDR;
assert(ID >= FirstDeclID && "invalid decl ID");
-
+
RecordData Record;
ASTDeclWriter W(*this, Context, Record);
Modified: cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterStmt.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriterStmt.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriterStmt.cpp Mon Jul 30 12:24:48 2018
@@ -247,7 +247,7 @@ void ASTStmtWriter::VisitGCCAsmStmt(GCCA
Record.AddStmt(S->getAsmString());
// Outputs
- for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) {
+ for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) {
Record.AddIdentifierRef(S->getOutputIdentifier(I));
Record.AddStmt(S->getOutputConstraintLiteral(I));
Record.AddStmt(S->getOutputExpr(I));
@@ -1000,7 +1000,7 @@ void ASTStmtWriter::VisitObjCDictionaryL
Record.push_back(NumExpansions);
}
}
-
+
Record.AddDeclRef(E->getDictWithObjectsMethod());
Record.AddSourceRange(E->getSourceRange());
Code = serialization::EXPR_OBJC_DICTIONARY_LITERAL;
@@ -1064,7 +1064,7 @@ void ASTStmtWriter::VisitObjCPropertyRef
Record.push_back(2);
Record.AddDeclRef(E->getClassReceiver());
}
-
+
Code = serialization::EXPR_OBJC_PROPERTY_REF_EXPR;
}
@@ -1075,7 +1075,7 @@ void ASTStmtWriter::VisitObjCSubscriptRe
Record.AddStmt(E->getKeyExpr());
Record.AddDeclRef(E->getAtIndexMethodDecl());
Record.AddDeclRef(E->setAtIndexMethodDecl());
-
+
Code = serialization::EXPR_OBJC_SUBSCRIPT_REF_EXPR;
}
@@ -1108,9 +1108,9 @@ void ASTStmtWriter::VisitObjCMessageExpr
Record.AddDeclRef(E->getMethodDecl());
} else {
Record.push_back(0);
- Record.AddSelectorRef(E->getSelector());
+ Record.AddSelectorRef(E->getSelector());
}
-
+
Record.AddSourceLocation(E->getLeftLoc());
Record.AddSourceLocation(E->getRightLoc());
@@ -1296,14 +1296,14 @@ void ASTStmtWriter::VisitLambdaExpr(Lamb
Record.push_back(E->ExplicitParams);
Record.push_back(E->ExplicitResultType);
Record.AddSourceLocation(E->ClosingBrace);
-
+
// Add capture initializers.
for (LambdaExpr::capture_init_iterator C = E->capture_init_begin(),
CEnd = E->capture_init_end();
C != CEnd; ++C) {
Record.AddStmt(*C);
}
-
+
Code = serialization::EXPR_LAMBDA;
}
@@ -1450,7 +1450,7 @@ void ASTStmtWriter::VisitCXXDeleteExpr(C
Record.AddDeclRef(E->getOperatorDelete());
Record.AddStmt(E->getArgument());
Record.AddSourceLocation(E->getSourceRange().getBegin());
-
+
Code = serialization::EXPR_CXX_DELETE;
}
@@ -2691,7 +2691,7 @@ void ASTWriter::WriteSubStmt(Stmt *S) {
RecordData Record;
ASTStmtWriter Writer(*this, Record);
++NumStatements;
-
+
if (!S) {
Stream.EmitRecord(serialization::STMT_NULL_PTR, Record);
return;
@@ -2724,7 +2724,7 @@ void ASTWriter::WriteSubStmt(Stmt *S) {
#endif
Writer.Visit(S);
-
+
uint64_t Offset = Writer.Emit();
SubStmtEntries[S] = Offset;
}
@@ -2739,7 +2739,7 @@ void ASTRecordWriter::FlushStmts() {
for (unsigned I = 0, N = StmtsToEmit.size(); I != N; ++I) {
Writer->WriteSubStmt(StmtsToEmit[I]);
-
+
assert(N == StmtsToEmit.size() && "record modified while being written!");
// Note that we are at the end of a full expression. Any
Modified: cfe/trunk/lib/Serialization/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/Module.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/Module.cpp (original)
+++ cfe/trunk/lib/Serialization/Module.cpp Mon Jul 30 12:24:48 2018
@@ -30,16 +30,16 @@ ModuleFile::~ModuleFile() {
}
template<typename Key, typename Offset, unsigned InitialCapacity>
-static void
+static void
dumpLocalRemap(StringRef Name,
const ContinuousRangeMap<Key, Offset, InitialCapacity> &Map) {
if (Map.begin() == Map.end())
return;
-
+
using MapType = ContinuousRangeMap<Key, Offset, InitialCapacity>;
llvm::errs() << " " << Name << ":\n";
- for (typename MapType::const_iterator I = Map.begin(), IEnd = Map.end();
+ for (typename MapType::const_iterator I = Map.begin(), IEnd = Map.end();
I != IEnd; ++I) {
llvm::errs() << " " << I->first << " -> " << I->second << "\n";
}
@@ -56,12 +56,12 @@ LLVM_DUMP_METHOD void ModuleFile::dump()
}
llvm::errs() << "\n";
}
-
+
// Remapping tables.
- llvm::errs() << " Base source location offset: " << SLocEntryBaseOffset
+ llvm::errs() << " Base source location offset: " << SLocEntryBaseOffset
<< '\n';
dumpLocalRemap("Source location offset local -> global map", SLocRemap);
-
+
llvm::errs() << " Base identifier ID: " << BaseIdentifierID << '\n'
<< " Number of identifiers: " << LocalNumIdentifiers << '\n';
dumpLocalRemap("Identifier ID local -> global map", IdentifierRemap);
@@ -77,18 +77,18 @@ LLVM_DUMP_METHOD void ModuleFile::dump()
llvm::errs() << " Base selector ID: " << BaseSelectorID << '\n'
<< " Number of selectors: " << LocalNumSelectors << '\n';
dumpLocalRemap("Selector ID local -> global map", SelectorRemap);
-
+
llvm::errs() << " Base preprocessed entity ID: " << BasePreprocessedEntityID
- << '\n'
- << " Number of preprocessed entities: "
+ << '\n'
+ << " Number of preprocessed entities: "
<< NumPreprocessedEntities << '\n';
- dumpLocalRemap("Preprocessed entity ID local -> global map",
+ dumpLocalRemap("Preprocessed entity ID local -> global map",
PreprocessedEntityRemap);
-
+
llvm::errs() << " Base type index: " << BaseTypeIndex << '\n'
<< " Number of types: " << LocalNumTypes << '\n';
dumpLocalRemap("Type index local -> global map", TypeRemap);
-
+
llvm::errs() << " Base decl ID: " << BaseDeclID << '\n'
<< " Number of decls: " << LocalNumDecls << '\n';
dumpLocalRemap("Decl ID local -> global map", DeclRemap);
Modified: cfe/trunk/lib/Serialization/ModuleManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ModuleManager.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ModuleManager.cpp (original)
+++ cfe/trunk/lib/Serialization/ModuleManager.cpp Mon Jul 30 12:24:48 2018
@@ -340,7 +340,7 @@ void ModuleManager::visit(llvm::function
unsigned N = size();
VisitOrder.clear();
VisitOrder.reserve(N);
-
+
// Record the number of incoming edges for each module. When we
// encounter a module with no incoming edges, push it into the queue
// to seed the queue.
@@ -477,21 +477,21 @@ namespace llvm {
static ChildIteratorType child_end(NodeRef Node) {
return Node->Imports.end();
}
-
+
static nodes_iterator nodes_begin(const ModuleManager &Manager) {
return nodes_iterator(Manager.begin());
}
-
+
static nodes_iterator nodes_end(const ModuleManager &Manager) {
return nodes_iterator(Manager.end());
}
};
-
+
template<>
struct DOTGraphTraits<ModuleManager> : public DefaultDOTGraphTraits {
explicit DOTGraphTraits(bool IsSimple = false)
: DefaultDOTGraphTraits(IsSimple) {}
-
+
static bool renderGraphFromBottomUp() { return true; }
std::string getNodeLabel(ModuleFile *M, const ModuleManager&) {
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp Mon Jul 30 12:24:48 2018
@@ -179,11 +179,11 @@ public:
II_strdup(nullptr), II_win_strdup(nullptr), II_kmalloc(nullptr),
II_if_nameindex(nullptr), II_if_freenameindex(nullptr),
II_wcsdup(nullptr), II_win_wcsdup(nullptr), II_g_malloc(nullptr),
- II_g_malloc0(nullptr), II_g_realloc(nullptr), II_g_try_malloc(nullptr),
- II_g_try_malloc0(nullptr), II_g_try_realloc(nullptr),
- II_g_free(nullptr), II_g_memdup(nullptr), II_g_malloc_n(nullptr),
- II_g_malloc0_n(nullptr), II_g_realloc_n(nullptr),
- II_g_try_malloc_n(nullptr), II_g_try_malloc0_n(nullptr),
+ II_g_malloc0(nullptr), II_g_realloc(nullptr), II_g_try_malloc(nullptr),
+ II_g_try_malloc0(nullptr), II_g_try_realloc(nullptr),
+ II_g_free(nullptr), II_g_memdup(nullptr), II_g_malloc_n(nullptr),
+ II_g_malloc0_n(nullptr), II_g_realloc_n(nullptr),
+ II_g_try_malloc_n(nullptr), II_g_try_malloc0_n(nullptr),
II_g_try_realloc_n(nullptr) {}
/// In pessimistic mode, the checker assumes that it does not know which
@@ -248,11 +248,11 @@ private:
*II_realloc, *II_calloc, *II_valloc, *II_reallocf,
*II_strndup, *II_strdup, *II_win_strdup, *II_kmalloc,
*II_if_nameindex, *II_if_freenameindex, *II_wcsdup,
- *II_win_wcsdup, *II_g_malloc, *II_g_malloc0,
- *II_g_realloc, *II_g_try_malloc, *II_g_try_malloc0,
- *II_g_try_realloc, *II_g_free, *II_g_memdup,
- *II_g_malloc_n, *II_g_malloc0_n, *II_g_realloc_n,
- *II_g_try_malloc_n, *II_g_try_malloc0_n,
+ *II_win_wcsdup, *II_g_malloc, *II_g_malloc0,
+ *II_g_realloc, *II_g_try_malloc, *II_g_try_malloc0,
+ *II_g_try_realloc, *II_g_free, *II_g_memdup,
+ *II_g_malloc_n, *II_g_malloc0_n, *II_g_realloc_n,
+ *II_g_try_malloc_n, *II_g_try_malloc0_n,
*II_g_try_realloc_n;
mutable Optional<uint64_t> KernelZeroFlagVal;
@@ -346,7 +346,7 @@ private:
ProgramStateRef ReallocMemAux(CheckerContext &C, const CallExpr *CE,
bool FreesMemOnFailure,
- ProgramStateRef State,
+ ProgramStateRef State,
bool SuffixWithN = false) const;
static SVal evalMulForBufferSize(CheckerContext &C, const Expr *Blocks,
const Expr *BlockBytes);
@@ -652,7 +652,7 @@ bool MallocChecker::isCMemFunction(const
initIdentifierInfo(C);
if (Family == AF_Malloc && CheckFree) {
- if (FunI == II_free || FunI == II_realloc || FunI == II_reallocf ||
+ if (FunI == II_free || FunI == II_realloc || FunI == II_reallocf ||
FunI == II_g_free)
return true;
}
@@ -662,12 +662,12 @@ bool MallocChecker::isCMemFunction(const
FunI == II_calloc || FunI == II_valloc || FunI == II_strdup ||
FunI == II_win_strdup || FunI == II_strndup || FunI == II_wcsdup ||
FunI == II_win_wcsdup || FunI == II_kmalloc ||
- FunI == II_g_malloc || FunI == II_g_malloc0 ||
- FunI == II_g_realloc || FunI == II_g_try_malloc ||
+ FunI == II_g_malloc || FunI == II_g_malloc0 ||
+ FunI == II_g_realloc || FunI == II_g_try_malloc ||
FunI == II_g_try_malloc0 || FunI == II_g_try_realloc ||
- FunI == II_g_memdup || FunI == II_g_malloc_n ||
- FunI == II_g_malloc0_n || FunI == II_g_realloc_n ||
- FunI == II_g_try_malloc_n || FunI == II_g_try_malloc0_n ||
+ FunI == II_g_memdup || FunI == II_g_malloc_n ||
+ FunI == II_g_malloc0_n || FunI == II_g_realloc_n ||
+ FunI == II_g_try_malloc_n || FunI == II_g_try_malloc0_n ||
FunI == II_g_try_realloc_n)
return true;
}
@@ -873,7 +873,7 @@ void MallocChecker::checkPostStmt(const
return;
State = MallocMemAux(C, CE, CE->getArg(0), UndefinedVal(), State);
State = ProcessZeroAllocation(C, CE, 0, State);
- } else if (FunI == II_realloc || FunI == II_g_realloc ||
+ } else if (FunI == II_realloc || FunI == II_g_realloc ||
FunI == II_g_try_realloc) {
State = ReallocMemAux(C, CE, false, State);
State = ProcessZeroAllocation(C, CE, 1, State);
@@ -936,7 +936,7 @@ void MallocChecker::checkPostStmt(const
return;
State = MallocMemAux(C, CE, CE->getArg(1), UndefinedVal(), State);
State = ProcessZeroAllocation(C, CE, 1, State);
- } else if (FunI == II_g_malloc_n || FunI == II_g_try_malloc_n ||
+ } else if (FunI == II_g_malloc_n || FunI == II_g_try_malloc_n ||
FunI == II_g_malloc0_n || FunI == II_g_try_malloc0_n) {
if (CE->getNumArgs() < 2)
return;
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp Mon Jul 30 12:24:48 2018
@@ -4000,7 +4000,7 @@ void RetainCountChecker::checkEndFunctio
// Don't process anything within synthesized bodies.
const LocationContext *LCtx = Pred->getLocationContext();
if (LCtx->getAnalysisDeclContext()->isBodyAutosynthesized()) {
- assert(!LCtx->inTopFrame());
+ assert(!LCtx->inTopFrame());
return;
}
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp Mon Jul 30 12:24:48 2018
@@ -129,7 +129,7 @@ bool StackAddrEscapeChecker::isSemaphore
for (const auto &C : B.captures()) {
const auto *T = C.getVariable()->getType()->getAs<TypedefType>();
if (T && T->getDecl()->getIdentifier() == dispatch_semaphore_tII)
- return true;
+ return true;
}
return false;
}
@@ -175,9 +175,9 @@ void StackAddrEscapeChecker::checkAsyncE
// There is a not-too-uncommon idiom
// where a block passed to dispatch_async captures a semaphore
// and then the thread (which called dispatch_async) is blocked on waiting
- // for the completion of the execution of the block
- // via dispatch_semaphore_wait. To avoid false-positives (for now)
- // we ignore all the blocks which have captured
+ // for the completion of the execution of the block
+ // via dispatch_semaphore_wait. To avoid false-positives (for now)
+ // we ignore all the blocks which have captured
// a variable of the type "dispatch_semaphore_t".
if (isSemaphoreCaptured(*B.getDecl()))
return;
@@ -263,7 +263,7 @@ void StackAddrEscapeChecker::checkPreStm
if (const BlockDataRegion *B = dyn_cast<BlockDataRegion>(R))
checkReturnedBlockCaptures(*B, C);
- if (!isa<StackSpaceRegion>(R->getMemorySpace()) ||
+ if (!isa<StackSpaceRegion>(R->getMemorySpace()) ||
isNotInCurrentFrame(R, C) || isArcManagedBlock(R, C))
return;
Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp Mon Jul 30 12:24:48 2018
@@ -2338,7 +2338,7 @@ void ExprEngine::processSwitch(SwitchNod
// Evaluate the LHS of the case value.
llvm::APSInt V1 = Case->getLHS()->EvaluateKnownConstInt(getContext());
assert(V1.getBitWidth() == getContext().getIntWidth(CondE->getType()));
-
+
// Get the RHS of the case, if it exists.
llvm::APSInt V2;
if (const Expr *E = Case->getRHS())
@@ -2538,12 +2538,12 @@ void ExprEngine::VisitMemberExpr(const M
ExplodedNodeSet CheckedSet;
getCheckerManager().runCheckersForPreStmt(CheckedSet, Pred, M, *this);
- ExplodedNodeSet EvalSet;
- ValueDecl *Member = M->getMemberDecl();
+ ExplodedNodeSet EvalSet;
+ ValueDecl *Member = M->getMemberDecl();
// Handle static member variables and enum constants accessed via
// member syntax.
- if (isa<VarDecl>(Member) || isa<EnumConstantDecl>(Member)) {
+ if (isa<VarDecl>(Member) || isa<EnumConstantDecl>(Member)) {
for (const auto I : CheckedSet)
VisitCommonDeclRefExpr(M, Member, I, EvalSet);
} else {
Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp Mon Jul 30 12:24:48 2018
@@ -684,7 +684,7 @@ void ExprEngine::VisitLogicalExpr(const
// known to be false, 1 if the value is known to be true and a new symbol
// when the assumption is unknown.
nonloc::ConcreteInt Zero(getBasicVals().getValue(0, B->getType()));
- X = evalBinOp(N->getState(), BO_NE,
+ X = evalBinOp(N->getState(), BO_NE,
svalBuilder.evalCast(RHSVal, B->getType(), RHS->getType()),
Zero, B->getType());
}
Modified: cfe/trunk/lib/StaticAnalyzer/Core/IssueHash.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/IssueHash.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/IssueHash.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/IssueHash.cpp Mon Jul 30 12:24:48 2018
@@ -26,7 +26,7 @@
using namespace clang;
-// Get a string representation of the parts of the signature that can be
+// Get a string representation of the parts of the signature that can be
// overloaded on.
static std::string GetSignature(const FunctionDecl *Target) {
if (!Target)
Modified: cfe/trunk/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp Mon Jul 30 12:24:48 2018
@@ -440,7 +440,7 @@ static bool shouldRearrange(ProgramState
SymbolRef Sym, llvm::APSInt Int, QualType Ty) {
return Sym->getType() == Ty &&
(!BinaryOperator::isComparisonOp(Op) ||
- (isWithinConstantOverflowBounds(Sym, State) &&
+ (isWithinConstantOverflowBounds(Sym, State) &&
isWithinConstantOverflowBounds(Int)));
}
Modified: cfe/trunk/lib/StaticAnalyzer/Core/Store.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/Store.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/Store.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/Store.cpp Mon Jul 30 12:24:48 2018
@@ -448,10 +448,10 @@ SVal StoreManager::getLValueElement(Qual
// value. See also the similar FIXME in getLValueFieldOrIvar().
if (Base.isUnknownOrUndef() || Base.getAs<loc::ConcreteInt>())
return Base;
-
+
if (Base.getAs<loc::GotoLabel>())
return UnknownVal();
-
+
const SubRegion *BaseRegion =
Base.castAs<loc::MemRegionVal>().getRegionAs<SubRegion>();
More information about the cfe-commits
mailing list