r338641 - [AST][4/4] Move the bit-fields from ObjCMethodDecl and ObjCContainerDecl into DeclContext

David Jones via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 1 15:24:24 PDT 2018


FYI, this breaks clang:

.../llvm/tools/clang/lib/AST/DeclObjC.cpp:793:7: error: static_assert
expression is not an integral constant expression
      static_cast<unsigned>(ObjCMethodDeclBits.ObjCMethodFamilyBitWidth) ==
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../llvm/tools/clang/lib/AST/DeclObjC.cpp:793:29: note: implicit use of
'this' pointer is only allowed within the evaluation of a call to a
'constexpr' member function
      static_cast<unsigned>(ObjCMethodDeclBits.ObjCMethodFamilyBitWidth) ==
                            ^
1 error generated.


On Wed, Aug 1, 2018 at 2:31 PM Erich Keane via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Author: erichkeane
> Date: Wed Aug  1 14:31:08 2018
> New Revision: 338641
>
> URL: http://llvm.org/viewvc/llvm-project?rev=338641&view=rev
> Log:
> [AST][4/4] Move the bit-fields from ObjCMethodDecl and ObjCContainerDecl
> into DeclContext
>
> This patch follows https://reviews.llvm.org/D49729,
> https://reviews.llvm.org/D49732 and
> https://reviews.llvm.org/D49733.
>
> Move the bits from ObjCMethodDecl and ObjCContainerDecl
> into DeclContext.
>
> Differential Revision: https://reviews.llvm.org/D49734
>
> Patch By: bricci
>
> Modified:
>     cfe/trunk/include/clang/AST/DeclObjC.h
>     cfe/trunk/lib/AST/DeclObjC.cpp
>     cfe/trunk/lib/Sema/SemaDeclObjC.cpp
>     cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
>     cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
>
> Modified: cfe/trunk/include/clang/AST/DeclObjC.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=338641&r1=338640&r2=338641&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/AST/DeclObjC.h (original)
> +++ cfe/trunk/include/clang/AST/DeclObjC.h Wed Aug  1 14:31:08 2018
> @@ -141,58 +141,10 @@ public:
>    enum ImplementationControl { None, Required, Optional };
>
>  private:
> -  // The conventional meaning of this method; an ObjCMethodFamily.
> -  // This is not serialized; instead, it is computed on demand and
> -  // cached.
> -  mutable unsigned Family : ObjCMethodFamilyBitWidth;
> -
> -  /// instance (true) or class (false) method.
> -  unsigned IsInstance : 1;
> -  unsigned IsVariadic : 1;
> -
> -  /// True if this method is the getter or setter for an explicit
> property.
> -  unsigned IsPropertyAccessor : 1;
> -
> -  // Method has a definition.
> -  unsigned IsDefined : 1;
> -
> -  /// Method redeclaration in the same interface.
> -  unsigned IsRedeclaration : 1;
> -
> -  /// Is redeclared in the same interface.
> -  mutable unsigned HasRedeclaration : 1;
> -
> -  // NOTE: VC++ treats enums as signed, avoid using ImplementationControl
> enum
> -  /// \@required/\@optional
> -  unsigned DeclImplementation : 2;
> -
> -  // NOTE: VC++ treats enums as signed, avoid using the ObjCDeclQualifier
> enum
> -  /// in, inout, etc.
> -  unsigned objcDeclQualifier : 7;
> -
> -  /// Indicates whether this method has a related result type.
> -  unsigned RelatedResultType : 1;
> -
> -  /// Whether the locations of the selector identifiers are in a
> -  /// "standard" position, a enum SelectorLocationsKind.
> -  unsigned SelLocsKind : 2;
> -
> -  /// Whether this method overrides any other in the class hierarchy.
> -  ///
> -  /// A method is said to override any method in the class's
> -  /// base classes, its protocols, or its categories' protocols, that has
> -  /// the same selector and is of the same kind (class or instance).
> -  /// A method in an implementation is not considered as overriding the
> same
> -  /// method in the interface or its categories.
> -  unsigned IsOverriding : 1;
> -
> -  /// Indicates if the method was a definition but its body was skipped.
> -  unsigned HasSkippedBody : 1;
> -
> -  // Return type of this method.
> +  /// Return type of this method.
>    QualType MethodDeclType;
>
> -  // Type source information for the return type.
> +  /// Type source information for the return type.
>    TypeSourceInfo *ReturnTInfo;
>
>    /// Array of ParmVarDecls for the formal parameters of this method
> @@ -203,7 +155,7 @@ private:
>    /// List of attributes for this method declaration.
>    SourceLocation DeclEndLoc; // the location of the ';' or '{'.
>
> -  // The following are only used for method definitions, null otherwise.
> +  /// The following are only used for method definitions, null otherwise.
>    LazyDeclStmtPtr Body;
>
>    /// SelfDecl - Decl for the implicit self parameter. This is lazily
> @@ -220,21 +172,14 @@ private:
>                   bool isVariadic = false, bool isPropertyAccessor = false,
>                   bool isImplicitlyDeclared = false, bool isDefined =
> false,
>                   ImplementationControl impControl = None,
> -                 bool HasRelatedResultType = false)
> -      : NamedDecl(ObjCMethod, contextDecl, beginLoc, SelInfo),
> -        DeclContext(ObjCMethod), Family(InvalidObjCMethodFamily),
> -        IsInstance(isInstance), IsVariadic(isVariadic),
> -        IsPropertyAccessor(isPropertyAccessor), IsDefined(isDefined),
> -        IsRedeclaration(0), HasRedeclaration(0),
> DeclImplementation(impControl),
> -        objcDeclQualifier(OBJC_TQ_None),
> -        RelatedResultType(HasRelatedResultType),
> -        SelLocsKind(SelLoc_StandardNoSpace), IsOverriding(0),
> HasSkippedBody(0),
> -        MethodDeclType(T), ReturnTInfo(ReturnTInfo), DeclEndLoc(endLoc) {
> -    setImplicit(isImplicitlyDeclared);
> -  }
> +                 bool HasRelatedResultType = false);
>
>    SelectorLocationsKind getSelLocsKind() const {
> -    return (SelectorLocationsKind)SelLocsKind;
> +    return
> static_cast<SelectorLocationsKind>(ObjCMethodDeclBits.SelLocsKind);
> +  }
> +
> +  void setSelLocsKind(SelectorLocationsKind Kind) {
> +    ObjCMethodDeclBits.SelLocsKind = Kind;
>    }
>
>    bool hasStandardSelLocs() const {
> @@ -244,10 +189,10 @@ private:
>    /// Get a pointer to the stored selector identifiers locations array.
>    /// No locations will be stored if HasStandardSelLocs is true.
>    SourceLocation *getStoredSelLocs() {
> -    return reinterpret_cast<SourceLocation*>(getParams() + NumParams);
> +    return reinterpret_cast<SourceLocation *>(getParams() + NumParams);
>    }
>    const SourceLocation *getStoredSelLocs() const {
> -    return reinterpret_cast<const SourceLocation*>(getParams() +
> NumParams);
> +    return reinterpret_cast<const SourceLocation *>(getParams() +
> NumParams);
>    }
>
>    /// Get a pointer to the stored selector identifiers locations array.
> @@ -297,21 +242,35 @@ public:
>    }
>
>    ObjCDeclQualifier getObjCDeclQualifier() const {
> -    return ObjCDeclQualifier(objcDeclQualifier);
> +    return
> static_cast<ObjCDeclQualifier>(ObjCMethodDeclBits.objcDeclQualifier);
> +  }
> +
> +  void setObjCDeclQualifier(ObjCDeclQualifier QV) {
> +    ObjCMethodDeclBits.objcDeclQualifier = QV;
>    }
> -  void setObjCDeclQualifier(ObjCDeclQualifier QV) { objcDeclQualifier =
> QV; }
>
>    /// Determine whether this method has a result type that is related
>    /// to the message receiver's type.
> -  bool hasRelatedResultType() const { return RelatedResultType; }
> +  bool hasRelatedResultType() const {
> +    return ObjCMethodDeclBits.RelatedResultType;
> +  }
>
>    /// Note whether this method has a related result type.
> -  void SetRelatedResultType(bool RRT = true) { RelatedResultType = RRT; }
> +  void setRelatedResultType(bool RRT = true) {
> +    ObjCMethodDeclBits.RelatedResultType = RRT;
> +  }
>
>    /// True if this is a method redeclaration in the same interface.
> -  bool isRedeclaration() const { return IsRedeclaration; }
> +  bool isRedeclaration() const { return
> ObjCMethodDeclBits.IsRedeclaration; }
> +  void setIsRedeclaration(bool RD) { ObjCMethodDeclBits.IsRedeclaration =
> RD; }
>    void setAsRedeclaration(const ObjCMethodDecl *PrevMethod);
>
> +  /// True if redeclared in the same interface.
> +  bool hasRedeclaration() const { return
> ObjCMethodDeclBits.HasRedeclaration; }
> +  void setHasRedeclaration(bool HRD) const {
> +    ObjCMethodDeclBits.HasRedeclaration = HRD;
> +  }
> +
>    /// Returns the location where the declarator ends. It will be
>    /// the location of ';' for a method declaration and the location of '{'
>    /// for a method definition.
> @@ -449,18 +408,26 @@ public:
>    /// Determines the family of this method.
>    ObjCMethodFamily getMethodFamily() const;
>
> -  bool isInstanceMethod() const { return IsInstance; }
> -  void setInstanceMethod(bool isInst) { IsInstance = isInst; }
> -  bool isVariadic() const { return IsVariadic; }
> -  void setVariadic(bool isVar) { IsVariadic = isVar; }
> +  bool isInstanceMethod() const { return ObjCMethodDeclBits.IsInstance; }
> +  void setInstanceMethod(bool isInst) {
> +    ObjCMethodDeclBits.IsInstance = isInst;
> +  }
>
> -  bool isClassMethod() const { return !IsInstance; }
> +  bool isVariadic() const { return ObjCMethodDeclBits.IsVariadic; }
> +  void setVariadic(bool isVar) { ObjCMethodDeclBits.IsVariadic = isVar; }
>
> -  bool isPropertyAccessor() const { return IsPropertyAccessor; }
> -  void setPropertyAccessor(bool isAccessor) { IsPropertyAccessor =
> isAccessor; }
> +  bool isClassMethod() const { return !isInstanceMethod(); }
>
> -  bool isDefined() const { return IsDefined; }
> -  void setDefined(bool isDefined) { IsDefined = isDefined; }
> +  bool isPropertyAccessor() const {
> +    return ObjCMethodDeclBits.IsPropertyAccessor;
> +  }
> +
> +  void setPropertyAccessor(bool isAccessor) {
> +    ObjCMethodDeclBits.IsPropertyAccessor = isAccessor;
> +  }
> +
> +  bool isDefined() const { return ObjCMethodDeclBits.IsDefined; }
> +  void setDefined(bool isDefined) { ObjCMethodDeclBits.IsDefined =
> isDefined; }
>
>    /// Whether this method overrides any other in the class hierarchy.
>    ///
> @@ -469,8 +436,8 @@ public:
>    /// the same selector and is of the same kind (class or instance).
>    /// A method in an implementation is not considered as overriding the
> same
>    /// method in the interface or its categories.
> -  bool isOverriding() const { return IsOverriding; }
> -  void setOverriding(bool isOverriding) { IsOverriding = isOverriding; }
> +  bool isOverriding() const { return ObjCMethodDeclBits.IsOverriding; }
> +  void setOverriding(bool IsOver) { ObjCMethodDeclBits.IsOverriding =
> IsOver; }
>
>    /// Return overridden methods for the given \p Method.
>    ///
> @@ -484,8 +451,10 @@ public:
>                       SmallVectorImpl<const ObjCMethodDecl *> &Overridden)
> const;
>
>    /// True if the method was a definition but its body was skipped.
> -  bool hasSkippedBody() const { return HasSkippedBody; }
> -  void setHasSkippedBody(bool Skipped = true) { HasSkippedBody = Skipped;
> }
> +  bool hasSkippedBody() const { return ObjCMethodDeclBits.HasSkippedBody;
> }
> +  void setHasSkippedBody(bool Skipped = true) {
> +    ObjCMethodDeclBits.HasSkippedBody = Skipped;
> +  }
>
>    /// Returns the property associated with this method's selector.
>    ///
> @@ -496,11 +465,11 @@ public:
>
>    // Related to protocols declared in  \@protocol
>    void setDeclImplementation(ImplementationControl ic) {
> -    DeclImplementation = ic;
> +    ObjCMethodDeclBits.DeclImplementation = ic;
>    }
>
>    ImplementationControl getImplementationControl() const {
> -    return ImplementationControl(DeclImplementation);
> +    return ImplementationControl(ObjCMethodDeclBits.DeclImplementation);
>    }
>
>    bool isOptional() const {
> @@ -984,8 +953,6 @@ public:
>  /// ObjCProtocolDecl, and ObjCImplDecl.
>  ///
>  class ObjCContainerDecl : public NamedDecl, public DeclContext {
> -  SourceLocation AtStart;
> -
>    // These two locations in the range mark the end of the method
> container.
>    // The first points to the '@' token, and the second to the 'end' token.
>    SourceRange AtEnd;
> @@ -993,10 +960,8 @@ class ObjCContainerDecl : public NamedDe
>    void anchor() override;
>
>  public:
> -  ObjCContainerDecl(Kind DK, DeclContext *DC,
> -                    IdentifierInfo *Id, SourceLocation nameLoc,
> -                    SourceLocation atStartLoc)
> -      : NamedDecl(DK, DC, nameLoc, Id), DeclContext(DK),
> AtStart(atStartLoc) {}
> +  ObjCContainerDecl(Kind DK, DeclContext *DC, IdentifierInfo *Id,
> +                    SourceLocation nameLoc, SourceLocation atStartLoc);
>
>    // Iterator access to instance/class properties.
>    using prop_iterator = specific_decl_iterator<ObjCPropertyDecl>;
> @@ -1130,20 +1095,19 @@ public:
>    virtual void collectPropertiesToImplement(PropertyMap &PM,
>                                              PropertyDeclOrder &PO) const
> {}
>
> -  SourceLocation getAtStartLoc() const { return AtStart; }
> -  void setAtStartLoc(SourceLocation Loc) { AtStart = Loc; }
> +  SourceLocation getAtStartLoc() const { return
> ObjCContainerDeclBits.AtStart; }
>
> -  // Marks the end of the container.
> -  SourceRange getAtEndRange() const {
> -    return AtEnd;
> +  void setAtStartLoc(SourceLocation Loc) {
> +    ObjCContainerDeclBits.AtStart = Loc;
>    }
>
> -  void setAtEndRange(SourceRange atEnd) {
> -    AtEnd = atEnd;
> -  }
> +  // Marks the end of the container.
> +  SourceRange getAtEndRange() const { return AtEnd; }
> +
> +  void setAtEndRange(SourceRange atEnd) { AtEnd = atEnd; }
>
>    SourceRange getSourceRange() const override LLVM_READONLY {
> -    return SourceRange(AtStart, getAtEndRange().getEnd());
> +    return SourceRange(getAtStartLoc(), getAtEndRange().getEnd());
>    }
>
>    // Implement isa/cast/dyncast/etc.
>
> Modified: cfe/trunk/lib/AST/DeclObjC.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=338641&r1=338640&r2=338641&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/AST/DeclObjC.cpp (original)
> +++ cfe/trunk/lib/AST/DeclObjC.cpp Wed Aug  1 14:31:08 2018
> @@ -65,6 +65,13 @@ void ObjCProtocolList::set(ObjCProtocolD
>  // ObjCInterfaceDecl
>
>  //===----------------------------------------------------------------------===//
>
> +ObjCContainerDecl::ObjCContainerDecl(Kind DK, DeclContext *DC,
> +                                     IdentifierInfo *Id, SourceLocation
> nameLoc,
> +                                     SourceLocation atStartLoc)
> +    : NamedDecl(DK, DC, nameLoc, Id), DeclContext(DK) {
> +  setAtStartLoc(atStartLoc);
> +}
> +
>  void ObjCContainerDecl::anchor() {}
>
>  /// getIvarDecl - This method looks up an ivar in this ContextDecl.
> @@ -769,6 +776,44 @@ ObjCMethodDecl *ObjCInterfaceDecl::looku
>  // ObjCMethodDecl
>
>  //===----------------------------------------------------------------------===//
>
> +ObjCMethodDecl::ObjCMethodDecl(SourceLocation beginLoc, SourceLocation
> endLoc,
> +                               Selector SelInfo, QualType T,
> +                               TypeSourceInfo *ReturnTInfo,
> +                               DeclContext *contextDecl, bool isInstance,
> +                               bool isVariadic, bool isPropertyAccessor,
> +                               bool isImplicitlyDeclared, bool isDefined,
> +                               ImplementationControl impControl,
> +                               bool HasRelatedResultType)
> +    : NamedDecl(ObjCMethod, contextDecl, beginLoc, SelInfo),
> +      DeclContext(ObjCMethod), MethodDeclType(T),
> ReturnTInfo(ReturnTInfo),
> +      DeclEndLoc(endLoc) {
> +  // See the comment in ObjCMethodFamilyBitfields about
> +  // ObjCMethodFamilyBitWidth for why we check this.
> +  static_assert(
> +      static_cast<unsigned>(ObjCMethodDeclBits.ObjCMethodFamilyBitWidth)
> ==
> +          static_cast<unsigned>(ObjCMethodFamilyBitWidth),
> +      "ObjCMethodDeclBitfields::ObjCMethodFamilyBitWidth and "
> +      "ObjCMethodFamilyBitWidth do not match!");
> +
> +  // Initialized the bits stored in DeclContext.
> +  ObjCMethodDeclBits.Family =
> +      static_cast<ObjCMethodFamily>(InvalidObjCMethodFamily);
> +  setInstanceMethod(isInstance);
> +  setVariadic(isVariadic);
> +  setPropertyAccessor(isPropertyAccessor);
> +  setDefined(isDefined);
> +  setIsRedeclaration(false);
> +  setHasRedeclaration(false);
> +  setDeclImplementation(impControl);
> +  setObjCDeclQualifier(OBJC_TQ_None);
> +  setRelatedResultType(HasRelatedResultType);
> +  setSelLocsKind(SelLoc_StandardNoSpace);
> +  setOverriding(false);
> +  setHasSkippedBody(false);
> +
> +  setImplicit(isImplicitlyDeclared);
> +}
> +
>  ObjCMethodDecl *ObjCMethodDecl::Create(
>      ASTContext &C, SourceLocation beginLoc, SourceLocation endLoc,
>      Selector SelInfo, QualType T, TypeSourceInfo *ReturnTInfo,
> @@ -810,8 +855,8 @@ Stmt *ObjCMethodDecl::getBody() const {
>  void ObjCMethodDecl::setAsRedeclaration(const ObjCMethodDecl *PrevMethod)
> {
>    assert(PrevMethod);
>    getASTContext().setObjCMethodRedeclaration(PrevMethod, this);
> -  IsRedeclaration = true;
> -  PrevMethod->HasRedeclaration = true;
> +  setIsRedeclaration(true);
> +  PrevMethod->setHasRedeclaration(true);
>  }
>
>  void ObjCMethodDecl::setParamsAndSelLocs(ASTContext &C,
> @@ -846,9 +891,9 @@ void ObjCMethodDecl::setMethodParams(AST
>    if (isImplicit())
>      return setParamsAndSelLocs(C, Params, llvm::None);
>
> -  SelLocsKind = hasStandardSelectorLocs(getSelector(), SelLocs, Params,
> -                                        DeclEndLoc);
> -  if (SelLocsKind != SelLoc_NonStandard)
> +  setSelLocsKind(hasStandardSelectorLocs(getSelector(), SelLocs, Params,
> +                                        DeclEndLoc));
> +  if (getSelLocsKind() != SelLoc_NonStandard)
>      return setParamsAndSelLocs(C, Params, llvm::None);
>
>    setParamsAndSelLocs(C, Params, SelLocs);
> @@ -860,7 +905,7 @@ void ObjCMethodDecl::setMethodParams(AST
>  ObjCMethodDecl *ObjCMethodDecl::getNextRedeclarationImpl() {
>    ASTContext &Ctx = getASTContext();
>    ObjCMethodDecl *Redecl = nullptr;
> -  if (HasRedeclaration)
> +  if (hasRedeclaration())
>      Redecl =
> const_cast<ObjCMethodDecl*>(Ctx.getObjCMethodRedeclaration(this));
>    if (Redecl)
>      return Redecl;
> @@ -938,7 +983,7 @@ SourceLocation ObjCMethodDecl::getLocEnd
>  }
>
>  ObjCMethodFamily ObjCMethodDecl::getMethodFamily() const {
> -  auto family = static_cast<ObjCMethodFamily>(Family);
> +  auto family = static_cast<ObjCMethodFamily>(ObjCMethodDeclBits.Family);
>    if (family != static_cast<unsigned>(InvalidObjCMethodFamily))
>      return family;
>
> @@ -954,7 +999,7 @@ ObjCMethodFamily ObjCMethodDecl::getMeth
>      case ObjCMethodFamilyAttr::OMF_mutableCopy: family = OMF_mutableCopy;
> break;
>      case ObjCMethodFamilyAttr::OMF_new: family = OMF_new; break;
>      }
> -    Family = static_cast<unsigned>(family);
> +    ObjCMethodDeclBits.Family = family;
>      return family;
>    }
>
> @@ -1025,7 +1070,7 @@ ObjCMethodFamily ObjCMethodDecl::getMeth
>    }
>
>    // Cache the result.
> -  Family = static_cast<unsigned>(family);
> +  ObjCMethodDeclBits.Family = family;
>    return family;
>  }
>
>
> Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=338641&r1=338640&r2=338641&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Wed Aug  1 14:31:08 2018
> @@ -4351,7 +4351,7 @@ void Sema::CheckObjCMethodOverrides(ObjC
>
>      // Propagate down the 'related result type' bit from overridden
> methods.
>      if (RTC != Sema::RTC_Incompatible &&
> overridden->hasRelatedResultType())
> -      ObjCMethod->SetRelatedResultType();
> +      ObjCMethod->setRelatedResultType();
>
>      // Then merge the declarations.
>      mergeObjCMethodDecls(ObjCMethod, overridden);
> @@ -4746,7 +4746,7 @@ Decl *Sema::ActOnMethodDeclaration(
>
>      if (InferRelatedResultType &&
>          !ObjCMethod->getReturnType()->isObjCIndependentClassType())
> -      ObjCMethod->SetRelatedResultType();
> +      ObjCMethod->setRelatedResultType();
>    }
>
>    if (MethodDefinition &&
>
> Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=338641&r1=338640&r2=338641&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
> +++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Wed Aug  1 14:31:08 2018
> @@ -1007,18 +1007,18 @@ void ASTDeclReader::VisitObjCMethodDecl(
>    MD->setVariadic(Record.readInt());
>    MD->setPropertyAccessor(Record.readInt());
>    MD->setDefined(Record.readInt());
> -  MD->IsOverriding = Record.readInt();
> -  MD->HasSkippedBody = Record.readInt();
> +  MD->setOverriding(Record.readInt());
> +  MD->setHasSkippedBody(Record.readInt());
>
> -  MD->IsRedeclaration = Record.readInt();
> -  MD->HasRedeclaration = Record.readInt();
> -  if (MD->HasRedeclaration)
> +  MD->setIsRedeclaration(Record.readInt());
> +  MD->setHasRedeclaration(Record.readInt());
> +  if (MD->hasRedeclaration())
>      Reader.getContext().setObjCMethodRedeclaration(MD,
>                                         ReadDeclAs<ObjCMethodDecl>());
>
>
>  MD->setDeclImplementation((ObjCMethodDecl::ImplementationControl)Record.readInt());
>    MD->setObjCDeclQualifier((Decl::ObjCDeclQualifier)Record.readInt());
> -  MD->SetRelatedResultType(Record.readInt());
> +  MD->setRelatedResultType(Record.readInt());
>    MD->setReturnType(Record.readType());
>    MD->setReturnTypeSourceInfo(GetTypeSourceInfo());
>    MD->DeclEndLoc = ReadSourceLocation();
> @@ -1028,7 +1028,7 @@ void ASTDeclReader::VisitObjCMethodDecl(
>    for (unsigned I = 0; I != NumParams; ++I)
>      Params.push_back(ReadDeclAs<ParmVarDecl>());
>
> -  MD->SelLocsKind = Record.readInt();
> +  MD->setSelLocsKind((SelectorLocationsKind)Record.readInt());
>    unsigned NumStoredSelLocs = Record.readInt();
>    SmallVector<SourceLocation, 16> SelLocs;
>    SelLocs.reserve(NumStoredSelLocs);
>
> Modified: cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterDecl.cpp?rev=338641&r1=338640&r2=338641&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Serialization/ASTWriterDecl.cpp (original)
> +++ cfe/trunk/lib/Serialization/ASTWriterDecl.cpp Wed Aug  1 14:31:08 2018
> @@ -647,12 +647,12 @@ void ASTDeclWriter::VisitObjCMethodDecl(
>    Record.push_back(D->isVariadic());
>    Record.push_back(D->isPropertyAccessor());
>    Record.push_back(D->isDefined());
> -  Record.push_back(D->IsOverriding);
> -  Record.push_back(D->HasSkippedBody);
> +  Record.push_back(D->isOverriding());
> +  Record.push_back(D->hasSkippedBody());
>
> -  Record.push_back(D->IsRedeclaration);
> -  Record.push_back(D->HasRedeclaration);
> -  if (D->HasRedeclaration) {
> +  Record.push_back(D->isRedeclaration());
> +  Record.push_back(D->hasRedeclaration());
> +  if (D->hasRedeclaration()) {
>      assert(Context.getObjCMethodRedeclaration(D));
>      Record.AddDeclRef(Context.getObjCMethodRedeclaration(D));
>    }
> @@ -669,7 +669,7 @@ void ASTDeclWriter::VisitObjCMethodDecl(
>    for (const auto *P : D->parameters())
>      Record.AddDeclRef(P);
>
> -  Record.push_back(D->SelLocsKind);
> +  Record.push_back(D->getSelLocsKind());
>    unsigned NumStoredSelLocs = D->getNumStoredSelLocs();
>    SourceLocation *SelLocs = D->getStoredSelLocs();
>    Record.push_back(NumStoredSelLocs);
>
>
> _______________________________________________
> 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/20180801/e7a04a35/attachment-0001.html>


More information about the cfe-commits mailing list