diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2019-01-20 14:02:54 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2019-01-20 14:02:54 +0000 | 
| commit | d5ea6fa648f8835a44adfb322b788e615d77cb71 (patch) | |
| tree | 570aa90958a58b9d6a71fa8594ee0ad8d2a18f2c /contrib/llvm/tools/clang/lib/AST/DeclObjC.cpp | |
| parent | d9484dd61cc151c4f34c31e07f693fefa66316b5 (diff) | |
| parent | 676fbe8105eeb6ff4bb2ed261cb212fcfdbe7b63 (diff) | |
Notes
Diffstat (limited to 'contrib/llvm/tools/clang/lib/AST/DeclObjC.cpp')
| -rw-r--r-- | contrib/llvm/tools/clang/lib/AST/DeclObjC.cpp | 68 | 
1 files changed, 57 insertions, 11 deletions
diff --git a/contrib/llvm/tools/clang/lib/AST/DeclObjC.cpp b/contrib/llvm/tools/clang/lib/AST/DeclObjC.cpp index 18ba3b13b365..1ed7fc71b025 100644 --- a/contrib/llvm/tools/clang/lib/AST/DeclObjC.cpp +++ b/contrib/llvm/tools/clang/lib/AST/DeclObjC.cpp @@ -65,6 +65,13 @@ void ObjCProtocolList::set(ObjCProtocolDecl* const* InList, unsigned Elts,  // 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. @@ -350,7 +357,7 @@ ObjCInterfaceDecl *ObjCInterfaceDecl::getSuperClass() const {  SourceLocation ObjCInterfaceDecl::getSuperClassLoc() const {    if (TypeSourceInfo *superTInfo = getSuperClassTInfo()) -    return superTInfo->getTypeLoc().getLocStart(); +    return superTInfo->getTypeLoc().getBeginLoc();    return SourceLocation();  } @@ -769,6 +776,37 @@ ObjCMethodDecl *ObjCInterfaceDecl::lookupPrivateMethod(  // 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) { + +  // 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, @@ -791,6 +829,14 @@ bool ObjCMethodDecl::isThisDeclarationADesignatedInitializer() const {        hasAttr<ObjCDesignatedInitializerAttr>();  } +bool ObjCMethodDecl::definedInNSObject(const ASTContext &Ctx) const { +  if (const auto *PD = dyn_cast<const ObjCProtocolDecl>(getDeclContext())) +    return PD->getIdentifier() == Ctx.getNSObjectName(); +  if (const auto *ID = dyn_cast<const ObjCInterfaceDecl>(getDeclContext())) +    return ID->getIdentifier() == Ctx.getNSObjectName(); +  return false; +} +  bool ObjCMethodDecl::isDesignatedInitializerForTheInterface(      const ObjCMethodDecl **InitMethod) const {    if (getMethodFamily() != OMF_init) @@ -810,8 +856,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 +892,9 @@ void ObjCMethodDecl::setMethodParams(ASTContext &C,    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 +906,7 @@ void ObjCMethodDecl::setMethodParams(ASTContext &C,  ObjCMethodDecl *ObjCMethodDecl::getNextRedeclarationImpl() {    ASTContext &Ctx = getASTContext();    ObjCMethodDecl *Redecl = nullptr; -  if (HasRedeclaration) +  if (hasRedeclaration())      Redecl = const_cast<ObjCMethodDecl*>(Ctx.getObjCMethodRedeclaration(this));    if (Redecl)      return Redecl; @@ -933,12 +979,12 @@ ObjCMethodDecl *ObjCMethodDecl::getCanonicalDecl() {  SourceLocation ObjCMethodDecl::getEndLoc() const {    if (Stmt *Body = getBody()) -    return Body->getLocEnd(); +    return Body->getEndLoc();    return DeclEndLoc;  }  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 +1000,7 @@ ObjCMethodFamily ObjCMethodDecl::getMethodFamily() const {      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 +1071,7 @@ ObjCMethodFamily ObjCMethodDecl::getMethodFamily() const {    }    // Cache the result. -  Family = static_cast<unsigned>(family); +  ObjCMethodDeclBits.Family = family;    return family;  }  | 
