r313828 - [MS Compat]Allow __interfaces to have properties.
Nico Weber via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 21 13:23:45 PDT 2017
In the future, please land whitespace changes in a separate commit.
On Sep 20, 2017 6:29 PM, "Erich Keane via cfe-commits" <
cfe-commits at lists.llvm.org> wrote:
> Author: erichkeane
> Date: Wed Sep 20 15:28:24 2017
> New Revision: 313828
>
> URL: http://llvm.org/viewvc/llvm-project?rev=313828&view=rev
> Log:
> [MS Compat]Allow __interfaces to have properties.
>
> __interface types are allowed in MSVC to have "property" data members
> (marked with declspec property). This patch alters Sema to allow property
> data members.
>
> Differential Revision: https://reviews.llvm.org/D38092
>
>
> Modified:
> cfe/trunk/lib/Sema/SemaDeclCXX.cpp
> cfe/trunk/test/SemaCXX/ms-interface.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/
> SemaDeclCXX.cpp?rev=313828&r1=313827&r2=313828&view=diff
> ============================================================
> ==================
> --- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Wed Sep 20 15:28:24 2017
> @@ -143,7 +143,7 @@ namespace {
> if (Lambda->capture_begin() == Lambda->capture_end())
> return false;
>
> - return S->Diag(Lambda->getLocStart(),
> + return S->Diag(Lambda->getLocStart(),
> diag::err_lambda_capture_default_arg);
> }
> }
> @@ -276,18 +276,18 @@ Sema::SetParamDefaultArgument(ParmVarDec
> // Okay: add the default argument to the parameter
> Param->setDefaultArg(Arg);
>
> - // We have already instantiated this parameter; provide each of the
> + // We have already instantiated this parameter; provide each of the
> // instantiations with the uninstantiated default argument.
> UnparsedDefaultArgInstantiationsMap::iterator InstPos
> = UnparsedDefaultArgInstantiations.find(Param);
> if (InstPos != UnparsedDefaultArgInstantiations.end()) {
> for (unsigned I = 0, N = InstPos->second.size(); I != N; ++I)
> InstPos->second[I]->setUninstantiatedDefaultArg(Arg);
> -
> +
> // We're done tracking this parameter's instantiations.
> UnparsedDefaultArgInstantiations.erase(InstPos);
> }
> -
> +
> return false;
> }
>
> @@ -524,8 +524,8 @@ bool Sema::MergeCXXFunctionDecl(Function
> Invalid = false;
> }
> }
> -
> - // FIXME: If we knew where the '=' was, we could easily provide a
> fix-it
> +
> + // FIXME: If we knew where the '=' was, we could easily provide a
> fix-it
> // hint here. Alternatively, we could walk the type-source
> information
> // for NewParam to find the last source location in the type... but
> it
> // isn't worth the effort right now. This is the kind of test case
> that
> @@ -535,7 +535,7 @@ bool Sema::MergeCXXFunctionDecl(Function
> // void g(int (*fp)(int) = &f);
> Diag(NewParam->getLocation(), DiagDefaultParamID)
> << NewParam->getDefaultArgRange();
> -
> +
> // Look for the function declaration where the default argument was
> // actually written, which may be a declaration prior to Old.
> for (auto Older = PrevForDefaultArgs;
> @@ -581,9 +581,9 @@ bool Sema::MergeCXXFunctionDecl(Function
> // or a definition for one of the following explicit
> specializations:
> // - the explicit specialization of a function template;
> // - the explicit specialization of a member function
> template;
> - // - the explicit specialization of a member function of a
> class
> + // - the explicit specialization of a member function of a
> class
> // template where the class template specialization to
> which the
> - // member function specialization belongs is implicitly
> + // member function specialization belongs is implicitly
> // instantiated.
> Diag(NewParam->getLocation(), diag::err_template_spec_
> default_arg)
> << (New->getTemplateSpecializationKind()
> ==TSK_ExplicitSpecialization)
> @@ -591,16 +591,16 @@ bool Sema::MergeCXXFunctionDecl(Function
> << NewParam->getDefaultArgRange();
> } else if (New->getDeclContext()->isDependentContext()) {
> // C++ [dcl.fct.default]p6 (DR217):
> - // Default arguments for a member function of a class template
> shall
> - // be specified on the initial declaration of the member
> function
> + // Default arguments for a member function of a class template
> shall
> + // be specified on the initial declaration of the member
> function
> // within the class template.
> //
> - // Reading the tea leaves a bit in DR217 and its reference to
> DR205
> - // leads me to the conclusion that one cannot add default function
> - // arguments for an out-of-line definition of a member function
> of a
> + // Reading the tea leaves a bit in DR217 and its reference to
> DR205
> + // leads me to the conclusion that one cannot add default function
> + // arguments for an out-of-line definition of a member function
> of a
> // dependent type.
> int WhichKind = 2;
> - if (CXXRecordDecl *Record
> + if (CXXRecordDecl *Record
> = dyn_cast<CXXRecordDecl>(New->getDeclContext())) {
> if (Record->getDescribedClassTemplate())
> WhichKind = 0;
> @@ -609,8 +609,8 @@ bool Sema::MergeCXXFunctionDecl(Function
> else
> WhichKind = 2;
> }
> -
> - Diag(NewParam->getLocation(),
> +
> + Diag(NewParam->getLocation(),
> diag::err_param_default_argument_member_template_redecl)
> << WhichKind
> << NewParam->getDefaultArgRange();
> @@ -2148,7 +2148,7 @@ Sema::CheckBaseSpecifier(CXXRecordDecl *
> return nullptr;
> }
>
> - if (EllipsisLoc.isValid() &&
> + if (EllipsisLoc.isValid() &&
> !TInfo->getType()->containsUnexpandedParameterPack()) {
> Diag(EllipsisLoc, diag::err_pack_expansion_without_parameter_packs)
> << TInfo->getTypeLoc().getSourceRange();
> @@ -2297,10 +2297,10 @@ Sema::ActOnBaseSpecifier(Decl *classdecl
> GetTypeFromParser(basetype, &TInfo);
>
> if (EllipsisLoc.isInvalid() &&
> - DiagnoseUnexpandedParameterPack(SpecifierRange.getBegin(), TInfo,
> + DiagnoseUnexpandedParameterPack(SpecifierRange.getBegin(), TInfo,
> UPPC_BaseType))
> return true;
> -
> +
> if (CXXBaseSpecifier *BaseSpec = CheckBaseSpecifier(Class,
> SpecifierRange,
> Virtual, Access,
> TInfo,
> EllipsisLoc))
> @@ -2384,7 +2384,7 @@ bool Sema::AttachBaseSpecifiers(CXXRecor
> // Note this base's direct & indirect bases, if there could be
> ambiguity.
> if (Bases.size() > 1)
> NoteIndirectBases(Context, IndirectBaseTypes, NewBaseType);
> -
> +
> if (const RecordType *Record = NewBaseType->getAs<RecordType>()) {
> const CXXRecordDecl *RD = cast<CXXRecordDecl>(Record->getDecl());
> if (Class->isInterface() &&
> @@ -2405,7 +2405,7 @@ bool Sema::AttachBaseSpecifiers(CXXRecor
>
> // Attach the remaining base class specifiers to the derived class.
> Class->setBases(Bases.data(), NumGoodBases);
> -
> +
> for (unsigned idx = 0; idx < NumGoodBases; ++idx) {
> // Check whether this direct base is inaccessible due to ambiguity.
> QualType BaseType = Bases[idx]->getType();
> @@ -2457,7 +2457,7 @@ bool Sema::IsDerivedFrom(SourceLocation
> CXXRecordDecl *DerivedRD = Derived->getAsCXXRecordDecl();
> if (!DerivedRD)
> return false;
> -
> +
> CXXRecordDecl *BaseRD = Base->getAsCXXRecordDecl();
> if (!BaseRD)
> return false;
> @@ -2471,7 +2471,7 @@ bool Sema::IsDerivedFrom(SourceLocation
> // to be able to use the inheritance relationship?
> if (!isCompleteType(Loc, Derived) && !DerivedRD->isBeingDefined())
> return false;
> -
> +
> return DerivedRD->isDerivedFrom(BaseRD);
> }
>
> @@ -2481,28 +2481,28 @@ bool Sema::IsDerivedFrom(SourceLocation
> CXXBasePaths &Paths) {
> if (!getLangOpts().CPlusPlus)
> return false;
> -
> +
> CXXRecordDecl *DerivedRD = Derived->getAsCXXRecordDecl();
> if (!DerivedRD)
> return false;
> -
> +
> CXXRecordDecl *BaseRD = Base->getAsCXXRecordDecl();
> if (!BaseRD)
> return false;
> -
> +
> if (!isCompleteType(Loc, Derived) && !DerivedRD->isBeingDefined())
> return false;
> -
> +
> return DerivedRD->isDerivedFrom(BaseRD, Paths);
> }
>
> -void Sema::BuildBasePathArray(const CXXBasePaths &Paths,
> +void Sema::BuildBasePathArray(const CXXBasePaths &Paths,
> CXXCastPath &BasePathArray) {
> assert(BasePathArray.empty() && "Base path array must be empty!");
> assert(Paths.isRecordingPaths() && "Must record paths!");
> -
> +
> const CXXBasePath &Path = Paths.front();
> -
> +
> // We first go backward and check if we have a virtual base.
> // FIXME: It would be better if CXXBasePath had the base specifier for
> // the nearest virtual base.
> @@ -2549,27 +2549,27 @@ Sema::CheckDerivedToBaseConversion(QualT
> assert(DerivationOkay &&
> "Can only be used with a derived-to-base conversion");
> (void)DerivationOkay;
> -
> +
> if (!Paths.isAmbiguous(Context.getCanonicalType(Base).getUnqualifiedType()))
> {
> if (!IgnoreAccess) {
> // Check that the base class can be accessed.
> switch (CheckBaseClassAccess(Loc, Base, Derived, Paths.front(),
> InaccessibleBaseID)) {
> - case AR_inaccessible:
> + case AR_inaccessible:
> return true;
> - case AR_accessible:
> + case AR_accessible:
> case AR_dependent:
> case AR_delayed:
> break;
> }
> }
> -
> +
> // Build a base path if necessary.
> if (BasePath)
> BuildBasePathArray(Paths, *BasePath);
> return false;
> }
> -
> +
> if (AmbigiousBaseConvID) {
> // We know that the derived-to-base conversion is ambiguous, and
> // we're going to produce a diagnostic. Perform the derived-to-base
> @@ -2634,7 +2634,7 @@ std::string Sema::getAmbiguousPathsDispl
> PathDisplayStr += " -> " + Element->Base->getType().
> getAsString();
> }
> }
> -
> +
> return PathDisplayStr;
> }
>
> @@ -2857,6 +2857,8 @@ Sema::ActOnCXXMemberDeclarator(Scope *S,
> assert(!DS.isFriendSpecified());
>
> bool isFunc = D.isDeclarationOfFunction();
> + AttributeList *MSPropertyAttr =
> + getMSPropertyAttr(D.getDeclSpec().getAttributes().getList());
>
> if (cast<CXXRecordDecl>(CurContext)->isInterface()) {
> // The Microsoft extension __interface only permits public member
> functions
> @@ -2864,8 +2866,11 @@ Sema::ActOnCXXMemberDeclarator(Scope *S,
> // functions, static methods and data members.
> unsigned InvalidDecl;
> bool ShowDeclName = true;
> - if (!isFunc)
> - InvalidDecl = (DS.getStorageClassSpec() == DeclSpec::SCS_typedef) ?
> 0 : 1;
> + if (!isFunc &&
> + (DS.getStorageClassSpec() == DeclSpec::SCS_typedef ||
> MSPropertyAttr))
> + InvalidDecl = 0;
> + else if (!isFunc)
> + InvalidDecl = 1;
> else if (AS != AS_public)
> InvalidDecl = 2;
> else if (DS.getStorageClassSpec() == DeclSpec::SCS_static)
> @@ -3013,12 +3018,10 @@ Sema::ActOnCXXMemberDeclarator(Scope *S,
> else
> Diag(D.getIdentifierLoc(), diag::err_member_qualification)
> << Name << SS.getRange();
> -
> +
> SS.clear();
> }
>
> - AttributeList *MSPropertyAttr =
> - getMSPropertyAttr(D.getDeclSpec().getAttributes().getList());
> if (MSPropertyAttr) {
> Member = HandleMSProperty(S, cast<CXXRecordDecl>(CurContext), Loc,
> D,
> BitWidth, InitStyle, AS, MSPropertyAttr);
> @@ -3582,7 +3585,7 @@ void Sema::ActOnFinishCXXInClassMemberIn
> /// \brief Find the direct and/or virtual base specifiers that
> /// correspond to the given base type, for use in base initialization
> /// within a constructor.
> -static bool FindBaseInitializer(Sema &SemaRef,
> +static bool FindBaseInitializer(Sema &SemaRef,
> CXXRecordDecl *ClassDecl,
> QualType BaseType,
> const CXXBaseSpecifier *&DirectBaseSpec,
> @@ -3766,7 +3769,7 @@ Sema::BuildMemInitializer(Decl *Construc
> if (SS.isSet() && isDependentScopeSpecifier(SS)) {
> bool NotUnknownSpecialization = false;
> DeclContext *DC = computeDeclContext(SS, false);
> - if (CXXRecordDecl *Record = dyn_cast_or_null<CXXRecordDecl>(DC))
> + if (CXXRecordDecl *Record = dyn_cast_or_null<CXXRecordDecl>(DC))
> NotUnknownSpecialization = !Record->hasAnyDependentBases();
>
> if (!NotUnknownSpecialization) {
> @@ -3810,7 +3813,7 @@ Sema::BuildMemInitializer(Decl *Construc
> } else if (TypeDecl *Type = Corr.getCorrectionDeclAs<TypeDecl>())
> {
> const CXXBaseSpecifier *DirectBaseSpec;
> const CXXBaseSpecifier *VirtualBaseSpec;
> - if (FindBaseInitializer(*this, ClassDecl,
> + if (FindBaseInitializer(*this, ClassDecl,
> Context.getTypeDeclType(Type),
> DirectBaseSpec, VirtualBaseSpec)) {
> // We have found a direct or virtual base class with a
> @@ -4035,7 +4038,7 @@ Sema::BuildDelegatingInitializer(TypeSou
> if (CurContext->isDependentContext())
> DelegationInit = Init;
>
> - return new (Context) CXXCtorInitializer(Context, TInfo,
> InitRange.getBegin(),
> + return new (Context) CXXCtorInitializer(Context, TInfo,
> InitRange.getBegin(),
> DelegationInit.getAs<Expr>(),
> InitRange.getEnd());
> }
> @@ -4080,12 +4083,12 @@ Sema::BuildBaseInitializer(QualType Base
> // Check for direct and virtual base classes.
> const CXXBaseSpecifier *DirectBaseSpec = nullptr;
> const CXXBaseSpecifier *VirtualBaseSpec = nullptr;
> - if (!Dependent) {
> + if (!Dependent) {
> if (Context.hasSameUnqualifiedType(QualType(ClassDecl->
> getTypeForDecl(),0),
> BaseType))
> return BuildDelegatingInitializer(BaseTInfo, Init, ClassDecl);
>
> - FindBaseInitializer(*this, ClassDecl, BaseType, DirectBaseSpec,
> + FindBaseInitializer(*this, ClassDecl, BaseType, DirectBaseSpec,
> VirtualBaseSpec);
>
> // C++ [base.class.init]p2:
> @@ -4205,7 +4208,7 @@ BuildImplicitBaseInitializer(Sema &SemaR
> IsInheritedVirtualBase);
>
> ExprResult BaseInit;
> -
> +
> switch (ImplicitInitKind) {
> case IIK_Inherit:
> case IIK_Default: {
> @@ -4222,7 +4225,7 @@ BuildImplicitBaseInitializer(Sema &SemaR
> ParmVarDecl *Param = Constructor->getParamDecl(0);
> QualType ParamType = Param->getType().getNonReferenceType();
>
> - Expr *CopyCtorArg =
> + Expr *CopyCtorArg =
> DeclRefExpr::Create(SemaRef.Context, NestedNameSpecifierLoc(),
> SourceLocation(), Param, false,
> Constructor->getLocation(), ParamType,
> @@ -4231,8 +4234,8 @@ BuildImplicitBaseInitializer(Sema &SemaR
> SemaRef.MarkDeclRefReferenced(cast<DeclRefExpr>(CopyCtorArg));
>
> // Cast to the base class to avoid ambiguities.
> - QualType ArgTy =
> - SemaRef.Context.getQualifiedType(BaseSpec->
> getType().getUnqualifiedType(),
> + QualType ArgTy =
> + SemaRef.Context.getQualifiedType(BaseSpec->
> getType().getUnqualifiedType(),
> ParamType.getQualifiers());
>
> if (Moving) {
> @@ -4258,10 +4261,10 @@ BuildImplicitBaseInitializer(Sema &SemaR
> BaseInit = SemaRef.MaybeCreateExprWithCleanups(BaseInit);
> if (BaseInit.isInvalid())
> return true;
> -
> +
> CXXBaseInit =
> new (SemaRef.Context) CXXCtorInitializer(SemaRef.Context,
> - SemaRef.Context.getTrivialTypeSourceInfo(
> BaseSpec->getType(),
> + SemaRef.Context.getTrivialTypeSourceInfo(
> BaseSpec->getType(),
> SourceLocation()),
> BaseSpec->isVirtual(),
> SourceLocation(),
> @@ -4295,8 +4298,8 @@ BuildImplicitMemberInitializer(Sema &Sem
> // Suppress copying zero-width bitfields.
> if (Field->isBitField() && Field->getBitWidthValue(SemaRef.Context)
> == 0)
> return false;
> -
> - Expr *MemberExprBase =
> +
> + Expr *MemberExprBase =
> DeclRefExpr::Create(SemaRef.Context, NestedNameSpecifierLoc(),
> SourceLocation(), Param, false,
> Loc, ParamType, VK_LValue, nullptr);
> @@ -4314,7 +4317,7 @@ BuildImplicitMemberInitializer(Sema &Sem
> MemberLookup.addDecl(Indirect ? cast<ValueDecl>(Indirect)
> : cast<ValueDecl>(Field), AS_public);
> MemberLookup.resolveKind();
> - ExprResult CtorArg
> + ExprResult CtorArg
> = SemaRef.BuildMemberReferenceExpr(MemberExprBase,
> ParamType, Loc,
> /*IsArrow=*/false,
> @@ -4343,7 +4346,7 @@ BuildImplicitMemberInitializer(Sema &Sem
> // Direct-initialize to use the copy constructor.
> InitializationKind InitKind =
> InitializationKind::CreateDirect(Loc, SourceLocation(),
> SourceLocation());
> -
> +
> Expr *CtorArgE = CtorArg.getAs<Expr>();
> InitializationSequence InitSeq(SemaRef, Entity, InitKind, CtorArgE);
> ExprResult MemberInit =
> @@ -4364,16 +4367,16 @@ BuildImplicitMemberInitializer(Sema &Sem
> assert((ImplicitInitKind == IIK_Default || ImplicitInitKind ==
> IIK_Inherit) &&
> "Unhandled implicit init kind!");
>
> - QualType FieldBaseElementType =
> + QualType FieldBaseElementType =
> SemaRef.Context.getBaseElementType(Field->getType());
> -
> +
> if (FieldBaseElementType->isRecordType()) {
> InitializedEntity InitEntity =
> Indirect ? InitializedEntity::InitializeMember(Indirect, nullptr,
> /*Implicit*/ true)
> : InitializedEntity::InitializeMember(Field, nullptr,
> /*Implicit*/ true);
> - InitializationKind InitKind =
> + InitializationKind InitKind =
> InitializationKind::CreateDefault(Loc);
>
> InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, None);
> @@ -4383,10 +4386,10 @@ BuildImplicitMemberInitializer(Sema &Sem
> MemberInit = SemaRef.MaybeCreateExprWithCleanups(MemberInit);
> if (MemberInit.isInvalid())
> return true;
> -
> +
> if (Indirect)
> CXXMemberInit = new (SemaRef.Context) CXXCtorInitializer(SemaRef.
> Context,
> - Indirect,
> Loc,
> + Indirect,
> Loc,
> Loc,
>
> MemberInit.get(),
> Loc);
> @@ -4400,9 +4403,9 @@ BuildImplicitMemberInitializer(Sema &Sem
>
> if (!Field->getParent()->isUnion()) {
> if (FieldBaseElementType->isReferenceType()) {
> - SemaRef.Diag(Constructor->getLocation(),
> + SemaRef.Diag(Constructor->getLocation(),
> diag::err_uninitialized_member_in_ctor)
> - << (int)Constructor->isImplicit()
> + << (int)Constructor->isImplicit()
> << SemaRef.Context.getTagDeclType(Constructor->getParent())
> << 0 << Field->getDeclName();
> SemaRef.Diag(Field->getLocation(), diag::note_declared_at);
> @@ -4410,27 +4413,27 @@ BuildImplicitMemberInitializer(Sema &Sem
> }
>
> if (FieldBaseElementType.isConstQualified()) {
> - SemaRef.Diag(Constructor->getLocation(),
> + SemaRef.Diag(Constructor->getLocation(),
> diag::err_uninitialized_member_in_ctor)
> - << (int)Constructor->isImplicit()
> + << (int)Constructor->isImplicit()
> << SemaRef.Context.getTagDeclType(Constructor->getParent())
> << 1 << Field->getDeclName();
> SemaRef.Diag(Field->getLocation(), diag::note_declared_at);
> return true;
> }
> }
> -
> +
> if (FieldBaseElementType.hasNonTrivialObjCLifetime()) {
> // ARC and Weak:
> // Default-initialize Objective-C pointers to NULL.
> CXXMemberInit
> - = new (SemaRef.Context) CXXCtorInitializer(SemaRef.Context, Field,
> - Loc, Loc,
> - new (SemaRef.Context) ImplicitValueInitExpr(Field->
> getType()),
> + = new (SemaRef.Context) CXXCtorInitializer(SemaRef.Context, Field,
> + Loc, Loc,
> + new (SemaRef.Context) ImplicitValueInitExpr(Field->
> getType()),
> Loc);
> return false;
> }
> -
> +
> // Nothing to initialize.
> CXXMemberInit = nullptr;
> return false;
> @@ -4458,13 +4461,13 @@ struct BaseAndFieldInfo {
> else
> IIK = IIK_Default;
> }
> -
> +
> bool isImplicitCopyOrMove() const {
> switch (IIK) {
> case IIK_Copy:
> case IIK_Move:
> return true;
> -
> +
> case IIK_Default:
> case IIK_Inherit:
> return false;
> @@ -4531,19 +4534,19 @@ struct BaseAndFieldInfo {
> static bool isIncompleteOrZeroLengthArrayType(ASTContext &Context,
> QualType T) {
> if (T->isIncompleteArrayType())
> return true;
> -
> +
> while (const ConstantArrayType *ArrayT = Context.getAsConstantArrayType(T))
> {
> if (!ArrayT->getSize())
> return true;
> -
> +
> T = ArrayT->getElementType();
> }
> -
> +
> return false;
> }
>
> static bool CollectFieldInitializer(Sema &SemaRef, BaseAndFieldInfo &Info,
> - FieldDecl *Field,
> + FieldDecl *Field,
> IndirectFieldDecl *Indirect =
> nullptr) {
> if (Field->isInvalidDecl())
> return false;
> @@ -4656,7 +4659,7 @@ bool Sema::SetCtorInitializers(CXXConstr
> CXXRecordDecl *ClassDecl = Constructor->getParent()->getDefinition();
> if (!ClassDecl)
> return true;
> -
> +
> bool HadError = false;
>
> for (unsigned i = 0; i < Initializers.size(); i++) {
> @@ -4755,34 +4758,34 @@ bool Sema::SetCtorInitializers(CXXConstr
> // initialized.
> if (F->isUnnamedBitfield())
> continue;
> -
> +
> // If we're not generating the implicit copy/move constructor, then
> we'll
> // handle anonymous struct/union fields based on their individual
> // indirect fields.
> if (F->isAnonymousStructOrUnion() && !Info.isImplicitCopyOrMove())
> continue;
> -
> +
> if (CollectFieldInitializer(*this, Info, F))
> HadError = true;
> continue;
> }
> -
> +
> // Beyond this point, we only consider default initialization.
> if (Info.isImplicitCopyOrMove())
> continue;
> -
> +
> if (auto *F = dyn_cast<IndirectFieldDecl>(Mem)) {
> if (F->getType()->isIncompleteArrayType()) {
> assert(ClassDecl->hasFlexibleArrayMember() &&
> "Incomplete array type is not valid");
> continue;
> }
> -
> +
> // Initialize each field of an anonymous struct individually.
> if (CollectFieldInitializer(*this, Info, F->getAnonField(), F))
> HadError = true;
> -
> - continue;
> +
> + continue;
> }
> }
>
> @@ -4824,7 +4827,7 @@ static const void *GetKeyForMember(ASTCo
> CXXCtorInitializer *Member) {
> if (!Member->isAnyMemberInitializer())
> return GetKeyForBase(Context, QualType(Member->getBaseClass(), 0));
> -
> +
> return Member->getAnyMember()->getCanonicalDecl();
> }
>
> @@ -4835,7 +4838,7 @@ static void DiagnoseBaseOrMemInitializer
> return;
>
> // Don't check initializers order unless the warning is enabled at the
> - // location of at least one initializer.
> + // location of at least one initializer.
> bool ShouldCheckOrder = false;
> for (unsigned InitIndex = 0; InitIndex != Inits.size(); ++InitIndex) {
> CXXCtorInitializer *Init = Inits[InitIndex];
> @@ -4847,7 +4850,7 @@ static void DiagnoseBaseOrMemInitializer
> }
> if (!ShouldCheckOrder)
> return;
> -
> +
> // Build the list of bases and members in the order that they'll
> // actually be initialized. The explicit initializers should be in
> // this same order but may be missing things.
> @@ -4870,10 +4873,10 @@ static void DiagnoseBaseOrMemInitializer
> for (auto *Field : ClassDecl->fields()) {
> if (Field->isUnnamedBitfield())
> continue;
> -
> +
> PopulateKeysForFields(Field, IdealInitKeys);
> }
> -
> +
> unsigned NumIdealInits = IdealInitKeys.size();
> unsigned IdealIndex = 0;
>
> @@ -4900,7 +4903,7 @@ static void DiagnoseBaseOrMemInitializer
> D << 0 << PrevInit->getAnyMember()->getDeclName();
> else
> D << 1 << PrevInit->getTypeSourceInfo()->getType();
> -
> +
> if (Init->isAnyMemberInitializer())
> D << 0 << Init->getAnyMember()->getDeclName();
> else
> @@ -4968,7 +4971,7 @@ bool CheckRedundantUnionInit(Sema &S,
> S.Diag(En.second->getSourceLocation(), diag::note_previous_
> initializer)
> << 0 << En.second->getSourceRange();
> return true;
> - }
> + }
> if (!En.first) {
> En.first = Child;
> En.second = Init;
> @@ -5002,7 +5005,7 @@ void Sema::ActOnMemInitializers(Decl *Co
> Diag(ColonLoc, diag::err_only_constructors_take_base_inits);
> return;
> }
> -
> +
> // Mapping for the duplicate initializers check.
> // For member initializers, this is keyed with a FieldDecl*.
> // For base initializers, this is keyed with a Type*.
> @@ -5064,22 +5067,22 @@ Sema::MarkBaseAndMemberDestructorsRefere
> // field/base declaration. That's probably good; that said, the
> // user might reasonably want to know why the destructor is being
> // emitted, and we currently don't say.
> -
> +
> // Non-static data members.
> for (auto *Field : ClassDecl->fields()) {
> if (Field->isInvalidDecl())
> continue;
> -
> +
> // Don't destroy incomplete or zero-length arrays.
> if (isIncompleteOrZeroLengthArrayType(Context, Field->getType()))
> continue;
>
> QualType FieldType = Context.getBaseElementType(Field->getType());
> -
> +
> const RecordType* RT = FieldType->getAs<RecordType>();
> if (!RT)
> continue;
> -
> +
> CXXRecordDecl *FieldClassDecl = cast<CXXRecordDecl>(RT->getDecl());
> if (FieldClassDecl->isInvalidDecl())
> continue;
> @@ -5134,14 +5137,14 @@ Sema::MarkBaseAndMemberDestructorsRefere
> << Base.getType()
> << Base.getSourceRange(),
> Context.getTypeDeclType(ClassDecl));
> -
> +
> MarkFunctionReferenced(Location, Dtor);
> DiagnoseUseOfDecl(Dtor, Location);
> }
>
> if (!VisitVirtualBases)
> return;
> -
> +
> // Virtual bases.
> for (const auto &VBase : ClassDecl->vbases()) {
> // Bases are always records in a well-formed non-dependent class.
> @@ -5238,12 +5241,12 @@ void Sema::DiagnoseAbstractType(const CX
> // Keep a set of seen pure methods so we won't diagnose the same method
> // more than once.
> llvm::SmallPtrSet<const CXXMethodDecl *, 8> SeenPureMethods;
> -
> - for (CXXFinalOverriderMap::iterator M = FinalOverriders.begin(),
> +
> + for (CXXFinalOverriderMap::iterator M = FinalOverriders.begin(),
> MEnd = FinalOverriders.end();
> - M != MEnd;
> + M != MEnd;
> ++M) {
> - for (OverridingMethods::iterator SO = M->second.begin(),
> + for (OverridingMethods::iterator SO = M->second.begin(),
> SOEnd = M->second.end();
> SO != SOEnd; ++SO) {
> // C++ [class.abstract]p4:
> @@ -5251,7 +5254,7 @@ void Sema::DiagnoseAbstractType(const CX
> // pure virtual function for which the final overrider is pure
> // virtual.
>
> - //
> + //
> if (SO->second.size() != 1)
> continue;
>
> @@ -5261,8 +5264,8 @@ void Sema::DiagnoseAbstractType(const CX
> if (!SeenPureMethods.insert(SO->second.front().Method).second)
> continue;
>
> - Diag(SO->second.front().Method->getLocation(),
> - diag::note_pure_virtual_function)
> + Diag(SO->second.front().Method->getLocation(),
> + diag::note_pure_virtual_function)
> << SO->second.front().Method->getDeclName() << RD->getDeclName();
> }
> }
> @@ -5742,7 +5745,7 @@ static bool computeCanPassInRegisters(Se
> !D->defaultedCopyConstructorIsDeleted()) {
> if (!D->hasTrivialCopyConstructor())
> return false;
> - HasNonDeletedCopyOrMove = true;
> + HasNonDeletedCopyOrMove = true;
> }
>
> if (S.getLangOpts().CPlusPlus11 && D->needsImplicitMoveConstructor() &&
> @@ -5784,7 +5787,7 @@ void Sema::CheckCompletedCXXClass(CXXRec
> AbstractUsageInfo Info(*this, Record);
> CheckAbstractClassUsage(Info, Record);
> }
> -
> +
> // If this is not an aggregate type and has no user-declared
> constructor,
> // complain about any non-static data members of reference or const
> scalar
> // type, since they will never get initializers.
> @@ -5803,7 +5806,7 @@ void Sema::CheckCompletedCXXClass(CXXRec
> << Record->getTagKind() << Record;
> Complained = true;
> }
> -
> +
> Diag(F->getLocation(), diag::note_refconst_member_
> not_initialized)
> << F->getType()->isReferenceType()
> << F->getDeclName();
> @@ -5813,12 +5816,12 @@ void Sema::CheckCompletedCXXClass(CXXRec
>
> if (Record->getIdentifier()) {
> // C++ [class.mem]p13:
> - // If T is the name of a class, then each of the following shall
> have a
> + // If T is the name of a class, then each of the following shall
> have a
> // name different from T:
> // - every member of every anonymous union that is a member of
> class T.
> //
> // C++ [class.mem]p14:
> - // In addition, if class T has a user-declared constructor (12.1),
> every
> + // In addition, if class T has a user-declared constructor (12.1),
> every
> // non-static data member of class T shall have a name different
> from T.
> DeclContext::lookup_result R = Record->lookup(Record->getDeclName());
> for (DeclContext::lookup_iterator I = R.begin(), E = R.end(); I != E;
> @@ -7818,11 +7821,11 @@ QualType Sema::CheckConstructorDeclarato
> // A constructor shall not be declared with a ref-qualifier.
> if (FTI.hasRefQualifier()) {
> Diag(FTI.getRefQualifierLoc(), diag::err_ref_qualifier_constructor)
> - << FTI.RefQualifierIsLValueRef
> + << FTI.RefQualifierIsLValueRef
> << FixItHint::CreateRemoval(FTI.getRefQualifierLoc());
> D.setInvalidType();
> }
> -
> +
> // Rebuild the function type "R" without any type qualifiers (in
> // case any of the errors above fired) and with "void" as the
> // return type, since constructors don't have return types.
> @@ -7861,8 +7864,8 @@ void Sema::CheckConstructor(CXXConstruct
> QualType ClassTy = Context.getTagDeclType(ClassDecl);
> if (Context.getCanonicalType(ParamType).getUnqualifiedType() ==
> ClassTy) {
> SourceLocation ParamLoc = Constructor->getParamDecl(0)->
> getLocation();
> - const char *ConstRef
> - = Constructor->getParamDecl(0)->getIdentifier() ? "const &"
> + const char *ConstRef
> + = Constructor->getParamDecl(0)->getIdentifier() ? "const &"
> : " const &";
> Diag(ParamLoc, diag::err_constructor_byvalue_arg)
> << FixItHint::CreateInsertion(ParamLoc, ConstRef);
> @@ -7879,15 +7882,15 @@ void Sema::CheckConstructor(CXXConstruct
> /// on error.
> bool Sema::CheckDestructor(CXXDestructorDecl *Destructor) {
> CXXRecordDecl *RD = Destructor->getParent();
> -
> +
> if (!Destructor->getOperatorDelete() && Destructor->isVirtual()) {
> SourceLocation Loc;
> -
> +
> if (!Destructor->isImplicit())
> Loc = Destructor->getLocation();
> else
> Loc = RD->getLocation();
> -
> +
> // If we have a virtual destructor, look up the deallocation function
> if (FunctionDecl *OperatorDelete =
> FindDeallocationFunctionForDestructor(Loc, RD)) {
> @@ -7895,7 +7898,7 @@ bool Sema::CheckDestructor(CXXDestructor
> Destructor->setOperatorDelete(OperatorDelete);
> }
> }
> -
> +
> return false;
> }
>
> @@ -7936,7 +7939,7 @@ QualType Sema::CheckDestructorDeclarator
> << "static" << SourceRange(D.getDeclSpec().
> getStorageClassSpecLoc())
> << SourceRange(D.getIdentifierLoc())
> << FixItHint::CreateRemoval(D.getDeclSpec().
> getStorageClassSpecLoc());
> -
> +
> SC = SC_None;
> }
> if (!D.isInvalidType()) {
> @@ -7985,7 +7988,7 @@ QualType Sema::CheckDestructorDeclarator
> << FixItHint::CreateRemoval(FTI.getRefQualifierLoc());
> D.setInvalidType();
> }
> -
> +
> // Make sure we don't have any parameters.
> if (FTIHasNonVoidParameters(FTI)) {
> Diag(D.getIdentifierLoc(), diag::err_destructor_with_params);
> @@ -8004,7 +8007,7 @@ QualType Sema::CheckDestructorDeclarator
> // Rebuild the function type "R" without any type qualifiers or
> // parameters (in case any of the errors above fired) and with
> // "void" as the return type, since destructors don't have return
> - // types.
> + // types.
> if (!D.isInvalidType())
> return R;
>
> @@ -8233,7 +8236,7 @@ Decl *Sema::ActOnConversionDeclarator(CX
> if (FunctionTemplateDecl *ConversionTemplate
> = Conversion->
> getDescribedFunctionTemplate())
> return ConversionTemplate;
> -
> +
> return Conversion;
> }
>
> @@ -8492,7 +8495,7 @@ Decl *Sema::ActOnStartNamespaceDef(Scope
> }
> } else {
> // Anonymous namespaces.
> -
> +
> // Determine whether the parent already has an anonymous namespace.
> DeclContext *Parent = CurContext->getRedeclContext();
> if (TranslationUnitDecl *TU = dyn_cast<TranslationUnitDecl>(Parent))
> {
> @@ -8506,12 +8509,12 @@ Decl *Sema::ActOnStartNamespaceDef(Scope
> DiagnoseNamespaceInlineMismatch(*this, NamespaceLoc, NamespaceLoc,
> II,
> &IsInline, PrevNS);
> }
> -
> +
> NamespaceDecl *Namespc = NamespaceDecl::Create(Context, CurContext,
> IsInline,
> StartLoc, Loc, II,
> PrevNS);
> if (IsInvalid)
> Namespc->setInvalidDecl();
> -
> +
> ProcessDeclAttributeList(DeclRegionScope, Namespc, AttrList);
> AddPragmaAttributes(DeclRegionScope, Namespc);
>
> @@ -8523,7 +8526,7 @@ Decl *Sema::ActOnStartNamespaceDef(Scope
> StdNamespace = Namespc;
> if (AddToKnown)
> KnownNamespaces[Namespc] = false;
> -
> +
> if (II) {
> PushOnScopeChains(Namespc, DeclRegionScope);
> } else {
> @@ -8624,12 +8627,12 @@ NamespaceDecl *Sema::lookupStdExperiment
> return StdExperimentalNamespaceCache;
> }
>
> -/// \brief Retrieve the special "std" namespace, which may require us to
> +/// \brief Retrieve the special "std" namespace, which may require us to
> /// implicitly define the namespace.
> NamespaceDecl *Sema::getOrCreateStdNamespace() {
> if (!StdNamespace) {
> // The "std" namespace has not yet been defined, so build one
> implicitly.
> - StdNamespace = NamespaceDecl::Create(Context,
> + StdNamespace = NamespaceDecl::Create(Context,
> Context.
> getTranslationUnitDecl(),
> /*Inline=*/false,
> SourceLocation(),
> SourceLocation(),
> @@ -8842,7 +8845,7 @@ Decl *Sema::ActOnUsingDirective(Scope *S
> NestedNameSpecifier *Qualifier = nullptr;
> if (SS.isSet())
> Qualifier = SS.getScopeRep();
> -
> +
> // Lookup namespace name.
> LookupResult R(*this, NamespcName, IdentLoc, LookupNamespaceName);
> LookupParsedName(R, S, &SS);
> @@ -8851,18 +8854,18 @@ Decl *Sema::ActOnUsingDirective(Scope *S
>
> if (R.empty()) {
> R.clear();
> - // Allow "using namespace std;" or "using namespace ::std;" even if
> + // Allow "using namespace std;" or "using namespace ::std;" even if
> // "std" hasn't been defined yet, for GCC compatibility.
> if ((!Qualifier || Qualifier->getKind() ==
> NestedNameSpecifier::Global) &&
> NamespcName->isStr("std")) {
> Diag(IdentLoc, diag::ext_using_undefined_std);
> R.addDecl(getOrCreateStdNamespace());
> R.resolveKind();
> - }
> + }
> // Otherwise, attempt typo correction.
> else TryNamespaceTypoCorrection(*this, R, S, SS, IdentLoc,
> NamespcName);
> }
> -
> +
> if (!R.empty()) {
> NamedDecl *Named = R.getRepresentativeDecl();
> NamespaceDecl *NS = R.getAsSingle<NamespaceDecl>();
> @@ -8943,7 +8946,7 @@ Decl *Sema::ActOnUsingDeclaration(Scope
> case UnqualifiedId::IK_LiteralOperatorId:
> case UnqualifiedId::IK_ConversionFunctionId:
> break;
> -
> +
> case UnqualifiedId::IK_ConstructorName:
> case UnqualifiedId::IK_ConstructorTemplateId:
> // C++11 inheriting constructors.
> @@ -9086,7 +9089,7 @@ bool Sema::CheckUsingShadowDecl(UsingDec
>
> // If the target happens to be one of the previous declarations, we
> // don't have a conflict.
> - //
> + //
> // FIXME: but we might be increasing its access, in which case we
> // should redeclare it.
> NamedDecl *NonTag = nullptr, *Tag = nullptr;
> @@ -9461,7 +9464,7 @@ NamedDecl *Sema::BuildUsingDeclaration(S
> IdentLoc,
> NameInfo.getName(),
> EllipsisLoc);
> } else {
> - D = UnresolvedUsingValueDecl::Create(Context, CurContext, UsingLoc,
> + D = UnresolvedUsingValueDecl::Create(Context, CurContext, UsingLoc,
> QualifierLoc, NameInfo,
> EllipsisLoc);
> }
> D->setAccess(AS);
> @@ -9974,7 +9977,7 @@ Decl *Sema::ActOnAliasDeclaration(Scope
> if (DiagnoseUnexpandedParameterPack(Name.StartLocation, TInfo,
> UPPC_DeclarationType)) {
> Invalid = true;
> - TInfo = Context.getTrivialTypeSourceInfo(Context.IntTy,
> + TInfo = Context.getTrivialTypeSourceInfo(Context.IntTy,
> TInfo->getTypeLoc().
> getBeginLoc());
> }
>
> @@ -10137,7 +10140,7 @@ Decl *Sema::ActOnNamespaceAliasDef(Scope
> /*AllowInlineNamespace*/false);
>
> // Find the previous declaration and check that we can redeclare it.
> - NamespaceAliasDecl *Prev = nullptr;
> + NamespaceAliasDecl *Prev = nullptr;
> if (PrevR.isSingleResult()) {
> NamedDecl *PrevDecl = PrevR.getRepresentativeDecl();
> if (NamespaceAliasDecl *AD = dyn_cast<NamespaceAliasDecl>(PrevDecl))
> {
> @@ -10258,7 +10261,7 @@ ComputeDefaultedSpecialMemberExceptionSp
> CXXRecordDecl *ClassDecl = MD->getParent();
>
> // C++ [except.spec]p14:
> - // An implicitly declared special member function (Clause 12) shall
> have an
> + // An implicitly declared special member function (Clause 12) shall
> have an
> // exception-specification. [...]
> SpecialMemberExceptionSpecInfo Info(S, MD, CSM, ICI, Loc);
> if (ClassDecl->isInvalidDecl())
> @@ -11123,7 +11126,7 @@ buildSingleCopyAssignRecursively(Sema &S
> //
> // for (__SIZE_TYPE__ i0 = 0; i0 != array-size; ++i0)
> //
> - // that will copy each of the array elements.
> + // that will copy each of the array elements.
> QualType SizeType = S.Context.getSizeType();
>
> // Create the iteration variable.
> @@ -11335,7 +11338,7 @@ static void diagnoseDeprecatedCopyOperat
>
> void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation,
> CXXMethodDecl
> *CopyAssignOperator) {
> - assert((CopyAssignOperator->isDefaulted() &&
> + assert((CopyAssignOperator->isDefaulted() &&
> CopyAssignOperator->isOverloadedOperator() &&
> CopyAssignOperator->getOverloadedOperator() == OO_Equal &&
> !CopyAssignOperator->doesThisDeclarationHaveABody() &&
> @@ -11369,15 +11372,15 @@ void Sema::DefineImplicitCopyAssignment(
>
> // C++0x [class.copy]p30:
> // The implicitly-defined or explicitly-defaulted copy assignment
> operator
> - // for a non-union class X performs memberwise copy assignment of its
> - // subobjects. The direct base classes of X are assigned first, in the
> - // order of their declaration in the base-specifier-list, and then the
> - // immediate non-static data members of X are assigned, in the order
> in
> + // for a non-union class X performs memberwise copy assignment of its
> + // subobjects. The direct base classes of X are assigned first, in the
> + // order of their declaration in the base-specifier-list, and then the
> + // immediate non-static data members of X are assigned, in the order
> in
> // which they were declared in the class definition.
> -
> +
> // The statements that form the synthesized function body.
> SmallVector<Stmt*, 8> Statements;
> -
> +
> // The parameter for the "other" object, which we are copying from.
> ParmVarDecl *Other = CopyAssignOperator->getParamDecl(0);
> Qualifiers OtherQuals = Other->getType().getQualifiers();
> @@ -11387,7 +11390,7 @@ void Sema::DefineImplicitCopyAssignment(
> OtherRefType = OtherRef->getPointeeType();
> OtherQuals = OtherRefType.getQualifiers();
> }
> -
> +
> // Our location for everything implicitly-generated.
> SourceLocation Loc = CopyAssignOperator->getLocEnd().isValid()
> ? CopyAssignOperator->getLocEnd()
> @@ -11398,7 +11401,7 @@ void Sema::DefineImplicitCopyAssignment(
>
> // Builds the "this" pointer.
> ThisBuilder This;
> -
> +
> // Assign base classes.
> bool Invalid = false;
> for (auto &Base : ClassDecl->bases()) {
> @@ -11434,11 +11437,11 @@ void Sema::DefineImplicitCopyAssignment(
> CopyAssignOperator->setInvalidDecl();
> return;
> }
> -
> +
> // Success! Record the copy.
> Statements.push_back(Copy.getAs<Expr>());
> }
> -
> +
> // Assign non-static members.
> for (auto *Field : ClassDecl->fields()) {
> // FIXME: We should form some kind of AST representation for the
> implied
> @@ -11459,28 +11462,28 @@ void Sema::DefineImplicitCopyAssignment(
> Invalid = true;
> continue;
> }
> -
> +
> // Check for members of const-qualified, non-class type.
> QualType BaseType = Context.getBaseElementType(Field->getType());
> if (!BaseType->getAs<RecordType>() && BaseType.isConstQualified()) {
> Diag(ClassDecl->getLocation(), diag::err_uninitialized_
> member_for_assign)
> << Context.getTagDeclType(ClassDecl) << 1 <<
> Field->getDeclName();
> Diag(Field->getLocation(), diag::note_declared_at);
> - Invalid = true;
> + Invalid = true;
> continue;
> }
>
> // Suppress assigning zero-width bitfields.
> if (Field->isBitField() && Field->getBitWidthValue(Context) == 0)
> continue;
> -
> +
> QualType FieldType = Field->getType().getNonReferenceType();
> if (FieldType->isIncompleteArrayType()) {
> - assert(ClassDecl->hasFlexibleArrayMember() &&
> + assert(ClassDecl->hasFlexibleArrayMember() &&
> "Incomplete array type is not valid");
> continue;
> }
> -
> +
> // Build references to the field in the object we're copying from and
> to.
> CXXScopeSpec SS; // Intentionally empty
> LookupResult MemberLookup(*this, Field->getDeclName(), Loc,
> @@ -11501,7 +11504,7 @@ void Sema::DefineImplicitCopyAssignment(
> CopyAssignOperator->setInvalidDecl();
> return;
> }
> -
> +
> // Success! Record the copy.
> Statements.push_back(Copy.getAs<Stmt>());
> }
> @@ -11509,7 +11512,7 @@ void Sema::DefineImplicitCopyAssignment(
> if (!Invalid) {
> // Add a "return *this;"
> ExprResult ThisObj = CreateBuiltinUnaryOp(Loc, UO_Deref,
> This.build(*this, Loc));
> -
> +
> StmtResult Return = BuildReturnStmt(Loc, ThisObj.get());
> if (Return.isInvalid())
> Invalid = true;
> @@ -11697,7 +11700,7 @@ static void checkMoveAssignmentForRepeat
>
> void Sema::DefineImplicitMoveAssignment(SourceLocation CurrentLocation,
> CXXMethodDecl
> *MoveAssignOperator) {
> - assert((MoveAssignOperator->isDefaulted() &&
> + assert((MoveAssignOperator->isDefaulted() &&
> MoveAssignOperator->isOverloadedOperator() &&
> MoveAssignOperator->getOverloadedOperator() == OO_Equal &&
> !MoveAssignOperator->doesThisDeclarationHaveABody() &&
> @@ -11711,7 +11714,7 @@ void Sema::DefineImplicitMoveAssignment(
> MoveAssignOperator->setInvalidDecl();
> return;
> }
> -
> +
> // C++0x [class.copy]p28:
> // The implicitly-defined or move assignment operator for a non-union
> class
> // X performs memberwise move assignment of its subobjects. The
> direct base
> @@ -11833,21 +11836,21 @@ void Sema::DefineImplicitMoveAssignment(
> Diag(ClassDecl->getLocation(), diag::err_uninitialized_
> member_for_assign)
> << Context.getTagDeclType(ClassDecl) << 1 <<
> Field->getDeclName();
> Diag(Field->getLocation(), diag::note_declared_at);
> - Invalid = true;
> + Invalid = true;
> continue;
> }
>
> // Suppress assigning zero-width bitfields.
> if (Field->isBitField() && Field->getBitWidthValue(Context) == 0)
> continue;
> -
> +
> QualType FieldType = Field->getType().getNonReferenceType();
> if (FieldType->isIncompleteArrayType()) {
> - assert(ClassDecl->hasFlexibleArrayMember() &&
> + assert(ClassDecl->hasFlexibleArrayMember() &&
> "Incomplete array type is not valid");
> continue;
> }
> -
> +
> // Build references to the field in the object we're copying from and
> to.
> LookupResult MemberLookup(*this, Field->getDeclName(), Loc,
> LookupMemberName);
> @@ -12161,26 +12164,26 @@ void Sema::DefineImplicitLambdaToFunctio
> SourceLocation CurrentLocation,
> CXXConversionDecl *Conv) {
> SynthesizedFunctionScope Scope(*this, Conv);
> -
> +
> CXXRecordDecl *Lambda = Conv->getParent();
> CXXMethodDecl *CallOp = Lambda->getLambdaCallOperator();
> // If we are defining a specialization of a conversion to function-ptr
> // cache the deduced template arguments for this specialization
> // so that we can use them to retrieve the corresponding call-operator
> - // and static-invoker.
> + // and static-invoker.
> const TemplateArgumentList *DeducedTemplateArgs = nullptr;
>
> // Retrieve the corresponding call-operator specialization.
> if (Lambda->isGenericLambda()) {
> assert(Conv->isFunctionTemplateSpecialization());
> - FunctionTemplateDecl *CallOpTemplate =
> + FunctionTemplateDecl *CallOpTemplate =
> CallOp->getDescribedFunctionTemplate();
> DeducedTemplateArgs = Conv->getTemplateSpecializationArgs();
> void *InsertPos = nullptr;
> FunctionDecl *CallOpSpec = CallOpTemplate->findSpecialization(
>
> DeducedTemplateArgs->asArray(),
> InsertPos);
> - assert(CallOpSpec &&
> + assert(CallOpSpec &&
> "Conversion operator must have a corresponding call operator");
> CallOp = cast<CXXMethodDecl>(CallOpSpec);
> }
> @@ -12196,15 +12199,15 @@ void Sema::DefineImplicitLambdaToFunctio
> CXXMethodDecl *Invoker = Lambda->getLambdaStaticInvoker();
> // ... and get the corresponding specialization for a generic lambda.
> if (Lambda->isGenericLambda()) {
> - assert(DeducedTemplateArgs &&
> + assert(DeducedTemplateArgs &&
> "Must have deduced template arguments from Conversion Operator");
> - FunctionTemplateDecl *InvokeTemplate =
> + FunctionTemplateDecl *InvokeTemplate =
> Invoker->getDescribedFunctionTemplate();
> void *InsertPos = nullptr;
> FunctionDecl *InvokeSpec = InvokeTemplate->findSpecialization(
>
> DeducedTemplateArgs->asArray(),
> InsertPos);
> - assert(InvokeSpec &&
> + assert(InvokeSpec &&
> "Must have a corresponding static invoker specialization");
> Invoker = cast<CXXMethodDecl>(InvokeSpec);
> }
> @@ -12219,13 +12222,13 @@ void Sema::DefineImplicitLambdaToFunctio
>
> Conv->markUsed(Context);
> Conv->setReferenced();
> -
> +
> // Fill in the __invoke function with a dummy implementation. IR
> generation
> // will fill in the actual details.
> Invoker->markUsed(Context);
> Invoker->setReferenced();
> Invoker->setBody(new (Context) CompoundStmt(Conv->getLocation()));
> -
> +
> if (ASTMutationListener *L = getASTMutationListener()) {
> L->CompletedImplicitDefinition(Conv);
> L->CompletedImplicitDefinition(Invoker);
> @@ -12236,16 +12239,16 @@ void Sema::DefineImplicitLambdaToFunctio
>
> void Sema::DefineImplicitLambdaToBlockPointerConversion(
> SourceLocation CurrentLocation,
> - CXXConversionDecl *Conv)
> + CXXConversionDecl *Conv)
> {
> assert(!Conv->getParent()->isGenericLambda());
>
> SynthesizedFunctionScope Scope(*this, Conv);
> -
> +
> // Copy-initialize the lambda object as needed to capture it.
> Expr *This = ActOnCXXThis(CurrentLocation).get();
> Expr *DerefThis =CreateBuiltinUnaryOp(CurrentLocation, UO_Deref,
> This).get();
> -
> +
> ExprResult BuildBlock = BuildBlockForLambdaConversion(CurrentLocation,
>
> Conv->getLocation(),
> Conv, DerefThis);
> @@ -12280,29 +12283,29 @@ void Sema::DefineImplicitLambdaToBlockPo
> Conv->getLocation(),
> Conv->getLocation()));
> Conv->markUsed(Context);
> -
> +
> // We're done; notify the mutation listener, if any.
> if (ASTMutationListener *L = getASTMutationListener()) {
> L->CompletedImplicitDefinition(Conv);
> }
> }
>
> -/// \brief Determine whether the given list arguments contains exactly one
> +/// \brief Determine whether the given list arguments contains exactly one
> /// "real" (non-default) argument.
> static bool hasOneRealArgument(MultiExprArg Args) {
> switch (Args.size()) {
> case 0:
> return false;
> -
> +
> default:
> if (!Args[1]->isDefaultArgument())
> return false;
> -
> +
> // fall through
> case 1:
> return !Args[0]->isDefaultArgument();
> }
> -
> +
> return false;
> }
>
> @@ -12359,7 +12362,7 @@ Sema::BuildCXXConstructExpr(SourceLocati
> if (auto *Shadow = dyn_cast<ConstructorUsingShadowDecl>(FoundDecl)) {
> Constructor = findInheritingConstructor(ConstructLoc, Constructor,
> Shadow);
> if (DiagnoseUseOfDecl(Constructor, ConstructLoc))
> - return ExprError();
> + return ExprError();
> }
>
> return BuildCXXConstructExpr(
> @@ -12503,7 +12506,7 @@ void Sema::FinalizeVarWithDestructor(Var
> /// to form a proper call to this constructor.
> ///
> /// \returns true if an error occurred, false otherwise.
> -bool
> +bool
> Sema::CompleteConstructorCall(CXXConstructorDecl *Constructor,
> MultiExprArg ArgsPtr,
> SourceLocation Loc,
> @@ -12514,7 +12517,7 @@ Sema::CompleteConstructorCall(CXXConstru
> unsigned NumArgs = ArgsPtr.size();
> Expr **Args = ArgsPtr.data();
>
> - const FunctionProtoType *Proto
> + const FunctionProtoType *Proto
> = Constructor->getType()->getAs<FunctionProtoType>();
> assert(Proto && "Constructor without a prototype?");
> unsigned NumParams = Proto->getNumParams();
> @@ -12525,7 +12528,7 @@ Sema::CompleteConstructorCall(CXXConstru
> else
> ConvertedArgs.reserve(NumArgs);
>
> - VariadicCallType CallType =
> + VariadicCallType CallType =
> Proto->isVariadic() ? VariadicConstructor : VariadicDoesNotApply;
> SmallVector<Expr *, 8> AllArgs;
> bool Invalid = GatherArgumentsForCall(Loc, Constructor,
> @@ -12546,22 +12549,22 @@ Sema::CompleteConstructorCall(CXXConstru
> }
>
> static inline bool
> -CheckOperatorNewDeleteDeclarationScope(Sema &SemaRef,
> +CheckOperatorNewDeleteDeclarationScope(Sema &SemaRef,
> const FunctionDecl *FnDecl) {
> const DeclContext *DC = FnDecl->getDeclContext()->getRedeclContext();
> if (isa<NamespaceDecl>(DC)) {
> - return SemaRef.Diag(FnDecl->getLocation(),
> + return SemaRef.Diag(FnDecl->getLocation(),
> diag::err_operator_new_delete_
> declared_in_namespace)
> << FnDecl->getDeclName();
> }
> -
> - if (isa<TranslationUnitDecl>(DC) &&
> +
> + if (isa<TranslationUnitDecl>(DC) &&
> FnDecl->getStorageClass() == SC_Static) {
> return SemaRef.Diag(FnDecl->getLocation(),
> diag::err_operator_new_delete_declared_static)
> << FnDecl->getDeclName();
> }
> -
> +
> return false;
> }
>
> @@ -12583,21 +12586,21 @@ CheckOperatorNewDeleteTypes(Sema &SemaRe
> // Check that the result type is what we expect.
> if (SemaRef.Context.getCanonicalType(ResultType) != ExpectedResultType)
> return SemaRef.Diag(FnDecl->getLocation(),
> - diag::err_operator_new_delete_
> invalid_result_type)
> + diag::err_operator_new_delete_
> invalid_result_type)
> << FnDecl->getDeclName() << ExpectedResultType;
> -
> +
> // A function template must have at least 2 parameters.
> if (FnDecl->getDescribedFunctionTemplate() && FnDecl->getNumParams() <
> 2)
> return SemaRef.Diag(FnDecl->getLocation(),
> diag::err_operator_new_delete_
> template_too_few_parameters)
> << FnDecl->getDeclName();
> -
> +
> // The function decl must have at least 1 parameter.
> if (FnDecl->getNumParams() == 0)
> return SemaRef.Diag(FnDecl->getLocation(),
> diag::err_operator_new_delete_too_few_parameters)
> << FnDecl->getDeclName();
> -
> +
> // Check the first parameter type is not dependent.
> QualType FirstParamType = FnDecl->getParamDecl(0)->getType();
> if (FirstParamType->isDependentType())
> @@ -12605,11 +12608,11 @@ CheckOperatorNewDeleteTypes(Sema &SemaRe
> << FnDecl->getDeclName() << ExpectedFirstParamType;
>
> // Check that the first parameter type is what we expect.
> - if (SemaRef.Context.getCanonicalType(FirstParamType).getUnqualifiedType()
> !=
> + if (SemaRef.Context.getCanonicalType(FirstParamType).getUnqualifiedType()
> !=
> ExpectedFirstParamType)
> return SemaRef.Diag(FnDecl->getLocation(), InvalidParamTypeDiag)
> << FnDecl->getDeclName() << ExpectedFirstParamType;
> -
> +
> return false;
> }
>
> @@ -12617,18 +12620,18 @@ static bool
> CheckOperatorNewDeclaration(Sema &SemaRef, const FunctionDecl *FnDecl) {
> // C++ [basic.stc.dynamic.allocation]p1:
> // A program is ill-formed if an allocation function is declared in a
> - // namespace scope other than global scope or declared static in
> global
> + // namespace scope other than global scope or declared static in
> global
> // scope.
> if (CheckOperatorNewDeleteDeclarationScope(SemaRef, FnDecl))
> return true;
>
> - CanQualType SizeTy =
> + CanQualType SizeTy =
> SemaRef.Context.getCanonicalType(SemaRef.Context.getSizeType());
>
> // C++ [basic.stc.dynamic.allocation]p1:
> - // The return type shall be void*. The first parameter shall have type
> + // The return type shall be void*. The first parameter shall have type
> // std::size_t.
> - if (CheckOperatorNewDeleteTypes(SemaRef, FnDecl,
> SemaRef.Context.VoidPtrTy,
> + if (CheckOperatorNewDeleteTypes(SemaRef, FnDecl,
> SemaRef.Context.VoidPtrTy,
> SizeTy,
> diag::err_operator_new_
> dependent_param_type,
> diag::err_operator_new_param_type))
> @@ -12648,15 +12651,15 @@ static bool
> CheckOperatorDeleteDeclaration(Sema &SemaRef, FunctionDecl *FnDecl) {
> // C++ [basic.stc.dynamic.deallocation]p1:
> // A program is ill-formed if deallocation functions are declared in a
> - // namespace scope other than global scope or declared static in
> global
> + // namespace scope other than global scope or declared static in
> global
> // scope.
> if (CheckOperatorNewDeleteDeclarationScope(SemaRef, FnDecl))
> return true;
>
> // C++ [basic.stc.dynamic.deallocation]p2:
> - // Each deallocation function shall return void and its first
> parameter
> + // Each deallocation function shall return void and its first
> parameter
> // shall be void*.
> - if (CheckOperatorNewDeleteTypes(SemaRef, FnDecl,
> SemaRef.Context.VoidTy,
> + if (CheckOperatorNewDeleteTypes(SemaRef, FnDecl,
> SemaRef.Context.VoidTy,
> SemaRef.Context.VoidPtrTy,
> diag::err_operator_delete_
> dependent_param_type,
> diag::err_operator_delete_param_type))
> @@ -12682,7 +12685,7 @@ bool Sema::CheckOverloadedOperatorDeclar
> // explicitly stated in 3.7.3.
> if (Op == OO_Delete || Op == OO_Array_Delete)
> return CheckOperatorDeleteDeclaration(*this, FnDecl);
> -
> +
> if (Op == OO_New || Op == OO_Array_New)
> return CheckOperatorNewDeclaration(*this, FnDecl);
>
> @@ -13085,7 +13088,7 @@ VarDecl *Sema::BuildExceptionDeclaration
> IdentifierInfo *Name) {
> bool Invalid = false;
> QualType ExDeclType = TInfo->getType();
> -
> +
> // Arrays and functions decay.
> if (ExDeclType->isArrayType())
> ExDeclType = Context.getArrayDecayedType(ExDeclType);
> @@ -13149,7 +13152,7 @@ VarDecl *Sema::BuildExceptionDeclaration
> VarDecl *ExDecl = VarDecl::Create(Context, CurContext, StartLoc, Loc,
> Name,
> ExDeclType, TInfo, SC_None);
> ExDecl->setExceptionVariable(true);
> -
> +
> // In ARC, infer 'retaining' for variables of retainable type.
> if (getLangOpts().ObjCAutoRefCount && inferObjCARCLifetime(ExDecl))
> Invalid = true;
> @@ -13190,13 +13193,13 @@ VarDecl *Sema::BuildExceptionDeclaration
> Expr *init = MaybeCreateExprWithCleanups(construct);
> ExDecl->setInit(init);
> }
> -
> +
> // And make sure it's destructable.
> FinalizeVarWithDestructor(ExDecl, recordType);
> }
> }
> }
> -
> +
> if (Invalid)
> ExDecl->setInvalidDecl();
>
> @@ -13212,7 +13215,7 @@ Decl *Sema::ActOnExceptionDeclarator(Sco
> // Check for unexpanded parameter packs.
> if (DiagnoseUnexpandedParameterPack(D.getIdentifierLoc(), TInfo,
> UPPC_ExceptionType)) {
> - TInfo = Context.getTrivialTypeSourceInfo(Context.IntTy,
> + TInfo = Context.getTrivialTypeSourceInfo(Context.IntTy,
> D.getIdentifierLoc());
> Invalid = true;
> }
> @@ -13338,10 +13341,10 @@ FriendDecl *Sema::CheckFriendTypeDecl(So
> SourceLocation FriendLoc,
> TypeSourceInfo *TSInfo) {
> assert(TSInfo && "NULL TypeSourceInfo for friend type declaration");
> -
> +
> QualType T = TSInfo->getType();
> SourceRange TypeRange = TSInfo->getTypeLoc().getLocalSourceRange();
> -
> +
> // C++03 [class.friend]p2:
> // An elaborated-type-specifier shall be used in a friend declaration
> // for a class.*
> @@ -13385,7 +13388,7 @@ FriendDecl *Sema::CheckFriendTypeDecl(So
> << T
> << TypeRange;
> }
> -
> +
> // C++11 [class.friend]p3:
> // A friend declaration that does not declare a function shall have
> one
> // of the following forms:
> @@ -13498,9 +13501,9 @@ Decl *Sema::ActOnTemplatedFriendTag(Scop
> CurContext->addDecl(Friend);
> return Friend;
> }
> -
> +
> assert(SS.isNotEmpty() && "valid templated tag with no SS and no
> direct?");
> -
> +
>
>
> // Handle the case of a templated-scope friend class. e.g.
> @@ -13580,7 +13583,7 @@ Decl *Sema::ActOnFriendTypeDecl(Scope *S
> << DS.getSourceRange();
> return nullptr;
> }
> -
> +
> // C++98 [class.friend]p1: A friend of a class is a function
> // or class that is not a member of the class . . .
> // This is fixed in DR77, which just barely didn't make the C++03
> @@ -13600,7 +13603,7 @@ Decl *Sema::ActOnFriendTypeDecl(Scope *S
> DS.getFriendSpecLoc());
> else
> D = CheckFriendTypeDecl(Loc, DS.getFriendSpecLoc(), TSI);
> -
> +
> if (!D)
> return nullptr;
>
> @@ -13800,15 +13803,15 @@ NamedDecl *Sema::ActOnFriendFunctionDecl
> getLangOpts().CPlusPlus11 ?
> diag::warn_cxx98_compat_friend_is_member :
> diag::err_friend_is_member);
> -
> +
> if (D.isFunctionDefinition()) {
> // C++ [class.friend]p6:
> - // A function can be defined in a friend declaration of a class
> if and
> + // A function can be defined in a friend declaration of a class
> if and
> // only if the class is a non-local class (9.8), the function
> name is
> // unqualified, and the function has namespace scope.
> SemaDiagnosticBuilder DB
> = Diag(SS.getRange().getBegin(), diag::err_qualified_friend_def);
> -
> +
> DB << SS.getScopeRep();
> if (DC->isFileContext())
> DB << FixItHint::CreateRemoval(SS.getRange());
> @@ -13823,13 +13826,13 @@ NamedDecl *Sema::ActOnFriendFunctionDecl
> } else {
> if (D.isFunctionDefinition()) {
> // C++ [class.friend]p6:
> - // A function can be defined in a friend declaration of a class
> if and
> + // A function can be defined in a friend declaration of a class
> if and
> // only if the class is a non-local class (9.8), the function
> name is
> // unqualified, and the function has namespace scope.
> Diag(SS.getRange().getBegin(), diag::err_qualified_friend_def)
> << SS.getScopeRep();
> }
> -
> +
> DC = CurContext;
> assert(isa<CXXRecordDecl>(DC) && "friend declaration not in class?");
> }
> @@ -13865,7 +13868,7 @@ NamedDecl *Sema::ActOnFriendFunctionDecl
> }
>
> // FIXME: This is an egregious hack to cope with cases where the scope
> stack
> - // does not contain the declaration context, i.e., in an out-of-line
> + // does not contain the declaration context, i.e., in an out-of-line
> // definition of a class.
> Scope FakeDCScope(S, Scope::DeclScope, Diags);
> if (!DCScope) {
> @@ -14316,7 +14319,7 @@ DeclResult Sema::ActOnCXXConditionDeclar
> void Sema::LoadExternalVTableUses() {
> if (!ExternalSource)
> return;
> -
> +
> SmallVector<ExternalVTableUse, 4> VTables;
> ExternalSource->ReadUsedVTables(VTables);
> SmallVector<VTableUse, 4> NewUses;
> @@ -14329,11 +14332,11 @@ void Sema::LoadExternalVTableUses() {
> Pos->second = true;
> continue;
> }
> -
> +
> VTablesUsed[VTables[I].Record] = VTables[I].DefinitionRequired;
> NewUses.push_back(VTableUse(VTables[I].Record, VTables[I].Location));
> }
> -
> +
> VTableUses.insert(VTableUses.begin(), NewUses.begin(), NewUses.end());
> }
>
> @@ -14540,17 +14543,17 @@ void Sema::SetIvarInitializers(ObjCImple
> FieldDecl *Field = ivars[i];
> if (Field->isInvalidDecl())
> continue;
> -
> +
> CXXCtorInitializer *Member;
> InitializedEntity InitEntity = InitializedEntity::
> InitializeMember(Field);
> - InitializationKind InitKind =
> + InitializationKind InitKind =
> InitializationKind::CreateDefault(ObjCImplementation->
> getLocation());
>
> InitializationSequence InitSeq(*this, InitEntity, InitKind, None);
> ExprResult MemberInit =
> InitSeq.Perform(*this, InitEntity, InitKind, None);
> MemberInit = MaybeCreateExprWithCleanups(MemberInit);
> - // Note, MemberInit could actually come back empty if no
> initialization
> + // Note, MemberInit could actually come back empty if no
> initialization
> // is required (e.g., because it would call a trivial default
> constructor)
> if (!MemberInit.get() || MemberInit.isInvalid())
> continue;
> @@ -14561,7 +14564,7 @@ void Sema::SetIvarInitializers(ObjCImple
> MemberInit.getAs<Expr>(),
> SourceLocation());
> AllToInit.push_back(Member);
> -
> +
> // Be sure that the destructor is accessible and is marked as
> referenced.
> if (const RecordType *RecordTy =
> Context.getBaseElementType(Field->getType())
> @@ -14573,9 +14576,9 @@ void Sema::SetIvarInitializers(ObjCImple
> PDiag(diag::err_access_dtor_ivar)
> << Context.getBaseElementType(
> Field->getType()));
> }
> - }
> + }
> }
> - ObjCImplementation->setIvarInitializers(Context,
> + ObjCImplementation->setIvarInitializers(Context,
> AllToInit.data(),
> AllToInit.size());
> }
> }
> @@ -14643,7 +14646,7 @@ void DelegatingCycleHelper(CXXConstructo
> DelegatingCycleHelper(Target, Valid, Invalid, Current, S);
> }
> }
> -
> +
>
> void Sema::CheckDelegatingCtorCycles() {
> llvm::SmallSet<CXXConstructorDecl*, 4> Valid, Invalid, Current;
> @@ -14664,10 +14667,10 @@ namespace {
> /// \brief AST visitor that finds references to the 'this' expression.
> class FindCXXThisExpr : public RecursiveASTVisitor<FindCXXThisExpr> {
> Sema &S;
> -
> +
> public:
> explicit FindCXXThisExpr(Sema &S) : S(S) { }
> -
> +
> bool VisitCXXThisExpr(CXXThisExpr *E) {
> S.Diag(E->getLocation(), diag::err_this_static_member_func)
> << E->isImplicit();
> @@ -14680,22 +14683,22 @@ bool Sema::checkThisInStaticMemberFuncti
> TypeSourceInfo *TSInfo = Method->getTypeSourceInfo();
> if (!TSInfo)
> return false;
> -
> +
> TypeLoc TL = TSInfo->getTypeLoc();
> FunctionProtoTypeLoc ProtoTL = TL.getAs<FunctionProtoTypeLoc>();
> if (!ProtoTL)
> return false;
> -
> +
> // C++11 [expr.prim.general]p3:
> - // [The expression this] shall not appear before the optional
> - // cv-qualifier-seq and it shall not appear within the declaration of
> a
> + // [The expression this] shall not appear before the optional
> + // cv-qualifier-seq and it shall not appear within the declaration of
> a
> // static member function (although its type and value category are
> defined
> // within a static member function as they are within a non-static
> member
> // function). [ Note: this is because declaration matching does not
> occur
> // until the complete declarator is known. - end note ]
> const FunctionProtoType *Proto = ProtoTL.getTypePtr();
> FindCXXThisExpr Finder(*this);
> -
> +
> // If the return type came after the cv-qualifier-seq, check it now.
> if (Proto->hasTrailingReturn() &&
> !Finder.TraverseTypeLoc(ProtoTL.getReturnLoc()))
> @@ -14704,7 +14707,7 @@ bool Sema::checkThisInStaticMemberFuncti
> // Check the exception specification.
> if (checkThisInStaticMemberFunctionExceptionSpec(Method))
> return true;
> -
> +
> return checkThisInStaticMemberFunctionAttributes(Method);
> }
>
> @@ -14712,12 +14715,12 @@ bool Sema::checkThisInStaticMemberFuncti
> TypeSourceInfo *TSInfo = Method->getTypeSourceInfo();
> if (!TSInfo)
> return false;
> -
> +
> TypeLoc TL = TSInfo->getTypeLoc();
> FunctionProtoTypeLoc ProtoTL = TL.getAs<FunctionProtoTypeLoc>();
> if (!ProtoTL)
> return false;
> -
> +
> const FunctionProtoType *Proto = ProtoTL.getTypePtr();
> FindCXXThisExpr Finder(*this);
>
> @@ -14730,12 +14733,12 @@ bool Sema::checkThisInStaticMemberFuncti
> case EST_MSAny:
> case EST_None:
> break;
> -
> +
> case EST_ComputedNoexcept:
> if (!Finder.TraverseStmt(Proto->getNoexceptExpr()))
> return true;
> LLVM_FALLTHROUGH;
> -
> +
> case EST_Dynamic:
> for (const auto &E : Proto->exceptions()) {
> if (!Finder.TraverseType(E))
> @@ -14784,13 +14787,13 @@ bool Sema::checkThisInStaticMemberFuncti
>
> if (Arg && !Finder.TraverseStmt(Arg))
> return true;
> -
> +
> for (unsigned I = 0, N = Args.size(); I != N; ++I) {
> if (!Finder.TraverseStmt(Args[I]))
> return true;
> }
> }
> -
> +
> return false;
> }
>
>
> Modified: cfe/trunk/test/SemaCXX/ms-interface.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/
> SemaCXX/ms-interface.cpp?rev=313828&r1=313827&r2=313828&view=diff
> ============================================================
> ==================
> --- cfe/trunk/test/SemaCXX/ms-interface.cpp (original)
> +++ cfe/trunk/test/SemaCXX/ms-interface.cpp Wed Sep 20 15:28:24 2017
> @@ -77,3 +77,32 @@ class C1 : I6<C> {
>
> class C2 : I6<I> {
> };
> +
> +
> +// MSVC makes a special case in that an interface is allowed to have a
> data
> +// member if it is a property.
> +__interface HasProp {
> + __declspec(property(get = Get, put = Put)) int data;
> + int Get(void);
> + void Put(int);
> +};
> +
> +struct __declspec(uuid("00000000-0000-0000-C000-000000000046"))
> + IUnknown {
> + void foo();
> + __declspec(property(get = Get, put = Put), deprecated) int data;
> + int Get(void);
> + void Put(int);
> +};
> +
> +struct IFaceStruct : IUnknown {
> + __declspec(property(get = Get2, put = Put2), deprecated) int data2;
> + int Get2(void);
> + void Put2(int);
> +};
> +
> +__interface IFaceInheritsStruct : IFaceStruct {};
> +static_assert(!__is_interface_class(HasProp), "oops");
> +static_assert(!__is_interface_class(IUnknown), "oops");
> +static_assert(!__is_interface_class(IFaceStruct), "oops");
> +static_assert(!__is_interface_class(IFaceInheritsStruct), "oops");
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170921/291e0a60/attachment-0001.html>
More information about the cfe-commits
mailing list