diff options
Diffstat (limited to 'clang/lib/Frontend')
| -rw-r--r-- | clang/lib/Frontend/RewriteBlocks.cpp | 14 | ||||
| -rw-r--r-- | clang/lib/Frontend/RewriteObjC.cpp | 32 | 
2 files changed, 23 insertions, 23 deletions
diff --git a/clang/lib/Frontend/RewriteBlocks.cpp b/clang/lib/Frontend/RewriteBlocks.cpp index bc855fa8791..a7b5e3d6868 100644 --- a/clang/lib/Frontend/RewriteBlocks.cpp +++ b/clang/lib/Frontend/RewriteBlocks.cpp @@ -130,7 +130,7 @@ public:          OCT == Context->getCanonicalType(Context->getObjCClassType()))        return true; -    if (const PointerType *PT = OCT->getAsPointerType()) { +    if (const PointerType *PT = OCT->getAs<PointerType>()) {        if (isa<ObjCInterfaceType>(PT->getPointeeType()) ||             PT->getPointeeType()->isObjCQualifiedIdType())          return true; @@ -684,13 +684,13 @@ std::string RewriteBlocks::SynthesizeBlockCall(CallExpr *Exp) {    if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Exp->getCallee())) {      closureName = DRE->getDecl()->getNameAsCString(); -    CPT = DRE->getType()->getAsBlockPointerType(); +    CPT = DRE->getType()->getAs<BlockPointerType>();    } else if (BlockDeclRefExpr *CDRE = dyn_cast<BlockDeclRefExpr>(Exp->getCallee())) {      closureName = CDRE->getDecl()->getNameAsCString(); -    CPT = CDRE->getType()->getAsBlockPointerType(); +    CPT = CDRE->getType()->getAs<BlockPointerType>();    } else if (MemberExpr *MExpr = dyn_cast<MemberExpr>(Exp->getCallee())) {      closureName = MExpr->getMemberDecl()->getNameAsCString(); -    CPT = MExpr->getType()->getAsBlockPointerType(); +    CPT = MExpr->getType()->getAs<BlockPointerType>();    } else {      assert(1 && "RewriteBlockClass: Bad type");    } @@ -813,11 +813,11 @@ void RewriteBlocks::RewriteBlockPointerFunctionArgs(FunctionDecl *FD) {  bool RewriteBlocks::PointerTypeTakesAnyBlockArguments(QualType QT) {    const FunctionProtoType *FTP; -  const PointerType *PT = QT->getAsPointerType(); +  const PointerType *PT = QT->getAs<PointerType>();    if (PT) {      FTP = PT->getPointeeType()->getAsFunctionProtoType();    } else { -    const BlockPointerType *BPT = QT->getAsBlockPointerType(); +    const BlockPointerType *BPT = QT->getAs<BlockPointerType>();      assert(BPT && "BlockPointerTypeTakeAnyBlockArguments(): not a block pointer type");      FTP = BPT->getPointeeType()->getAsFunctionProtoType();    } @@ -1068,7 +1068,7 @@ void RewriteBlocks::RewriteFunctionProtoType(QualType funcType, NamedDecl *D) {  }  void RewriteBlocks::CheckFunctionPointerDecl(QualType funcType, NamedDecl *ND) { -  const PointerType *PT = funcType->getAsPointerType(); +  const PointerType *PT = funcType->getAs<PointerType>();    if (PT && PointerTypeTakesAnyBlockArguments(funcType))      RewriteFunctionProtoType(PT->getPointeeType(), ND);  } diff --git a/clang/lib/Frontend/RewriteObjC.cpp b/clang/lib/Frontend/RewriteObjC.cpp index 1bc7451a17c..de45e1a2bea 100644 --- a/clang/lib/Frontend/RewriteObjC.cpp +++ b/clang/lib/Frontend/RewriteObjC.cpp @@ -354,7 +354,7 @@ namespace {            OCT == Context->getCanonicalType(Context->getObjCClassType()))          return true; -      if (const PointerType *PT = OCT->getAsPointerType()) { +      if (const PointerType *PT = OCT->getAs<PointerType>()) {          if (isa<ObjCInterfaceType>(PT->getPointeeType()) ||               PT->getPointeeType()->isObjCQualifiedIdType())            return true; @@ -394,7 +394,7 @@ void RewriteObjC::RewriteBlocksInFunctionProtoType(QualType funcType,  }  void RewriteObjC::CheckFunctionPointerDecl(QualType funcType, NamedDecl *ND) { -  const PointerType *PT = funcType->getAsPointerType(); +  const PointerType *PT = funcType->getAs<PointerType>();    if (PT && PointerTypeTakesAnyBlockArguments(funcType))      RewriteBlocksInFunctionProtoType(PT->getPointeeType(), ND);  } @@ -864,9 +864,9 @@ void RewriteObjC::RewriteObjCMethodDecl(ObjCMethodDecl *OMD,      // syntax (where a decaration models use).      QualType retType = OMD->getResultType();      QualType PointeeTy; -    if (const PointerType* PT = retType->getAsPointerType()) +    if (const PointerType* PT = retType->getAs<PointerType>())        PointeeTy = PT->getPointeeType(); -    else if (const BlockPointerType *BPT = retType->getAsBlockPointerType()) +    else if (const BlockPointerType *BPT = retType->getAs<BlockPointerType>())        PointeeTy = BPT->getPointeeType();      if ((FPRetType = PointeeTy->getAsFunctionType())) {        ResultStr += FPRetType->getResultType().getAsString(); @@ -939,7 +939,7 @@ void RewriteObjC::RewriteObjCMethodDecl(ObjCMethodDecl *OMD,        std::string Name = PDecl->getNameAsString();        if (isTopLevelBlockPointerType(PDecl->getType())) {          // Make sure we convert "t (^)(...)" to "t (*)(...)". -        const BlockPointerType *BPT = PDecl->getType()->getAsBlockPointerType(); +        const BlockPointerType *BPT = PDecl->getType()->getAs<BlockPointerType>();          Context->getPointerType(BPT->getPointeeType()).getAsStringInternal(Name,                                                          Context->PrintingPolicy);        } else @@ -1138,7 +1138,7 @@ Stmt *RewriteObjC::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV,                                            SourceLocation OrigStart) {    ObjCIvarDecl *D = IV->getDecl();    if (CurMethodDef) { -    if (const PointerType *pType = IV->getBase()->getType()->getAsPointerType()) { +    if (const PointerType *pType = IV->getBase()->getType()->getAs<PointerType>()) {        ObjCInterfaceType *iFaceDecl =          dyn_cast<ObjCInterfaceType>(pType->getPointeeType());        // lookup which class implements the instance variable. @@ -1184,7 +1184,7 @@ Stmt *RewriteObjC::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV,      // Explicit ivar refs need to have a cast inserted.      // FIXME: consider sharing some of this code with the code above. -    if (const PointerType *pType = IV->getBase()->getType()->getAsPointerType()) { +    if (const PointerType *pType = IV->getBase()->getType()->getAs<PointerType>()) {        ObjCInterfaceType *iFaceDecl = dyn_cast<ObjCInterfaceType>(pType->getPointeeType());        // lookup which class implements the instance variable.        ObjCInterfaceDecl *clsDeclared = 0; @@ -1608,7 +1608,7 @@ Stmt *RewriteObjC::RewriteObjCTryStmt(ObjCAtTryStmt *S) {          buf += "1) { ";          ReplaceText(startLoc, lParenLoc-startBuf+1, buf.c_str(), buf.size());          sawIdTypedCatch = true; -      } else if (const PointerType *pType = t->getAsPointerType()) {  +      } else if (const PointerType *pType = t->getAs<PointerType>()) {           ObjCInterfaceType *cls; // Should be a pointer to a class.          cls = dyn_cast<ObjCInterfaceType>(pType->getPointeeType().getTypePtr()); @@ -1824,7 +1824,7 @@ bool RewriteObjC::needToScanForQualifiers(QualType T) {    if (T->isObjCQualifiedIdType())      return true; -  if (const PointerType *pType = T->getAsPointerType()) { +  if (const PointerType *pType = T->getAs<PointerType>()) {      Type *pointeeType = pType->getPointeeType().getTypePtr();      if (isa<ObjCQualifiedInterfaceType>(pointeeType))        return true; // we have "Class <Protocol> *". @@ -2485,7 +2485,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp) {                       : (*PI)->getType();        // Make sure we convert "t (^)(...)" to "t (*)(...)".        if (isTopLevelBlockPointerType(t)) { -        const BlockPointerType *BPT = t->getAsBlockPointerType(); +        const BlockPointerType *BPT = t->getAs<BlockPointerType>();          t = Context->getPointerType(BPT->getPointeeType());        }        ArgTypes.push_back(t); @@ -3890,13 +3890,13 @@ Stmt *RewriteObjC::SynthesizeBlockCall(CallExpr *Exp) {    if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Exp->getCallee())) {      closureName = DRE->getDecl()->getNameAsCString(); -    CPT = DRE->getType()->getAsBlockPointerType(); +    CPT = DRE->getType()->getAs<BlockPointerType>();    } else if (BlockDeclRefExpr *CDRE = dyn_cast<BlockDeclRefExpr>(Exp->getCallee())) {      closureName = CDRE->getDecl()->getNameAsCString(); -    CPT = CDRE->getType()->getAsBlockPointerType(); +    CPT = CDRE->getType()->getAs<BlockPointerType>();    } else if (MemberExpr *MExpr = dyn_cast<MemberExpr>(Exp->getCallee())) {      closureName = MExpr->getMemberDecl()->getNameAsCString(); -    CPT = MExpr->getType()->getAsBlockPointerType(); +    CPT = MExpr->getType()->getAs<BlockPointerType>();    } else {      assert(1 && "RewriteBlockClass: Bad type");    } @@ -3922,7 +3922,7 @@ Stmt *RewriteObjC::SynthesizeBlockCall(CallExpr *Exp) {        QualType t = *I;        // Make sure we convert "t (^)(...)" to "t (*)(...)".        if (isTopLevelBlockPointerType(t)) { -        const BlockPointerType *BPT = t->getAsBlockPointerType(); +        const BlockPointerType *BPT = t->getAs<BlockPointerType>();          t = Context->getPointerType(BPT->getPointeeType());        }        ArgTypes.push_back(t); @@ -4063,11 +4063,11 @@ void RewriteObjC::RewriteBlockPointerFunctionArgs(FunctionDecl *FD) {  bool RewriteObjC::PointerTypeTakesAnyBlockArguments(QualType QT) {    const FunctionProtoType *FTP; -  const PointerType *PT = QT->getAsPointerType(); +  const PointerType *PT = QT->getAs<PointerType>();    if (PT) {      FTP = PT->getPointeeType()->getAsFunctionProtoType();    } else { -    const BlockPointerType *BPT = QT->getAsBlockPointerType(); +    const BlockPointerType *BPT = QT->getAs<BlockPointerType>();      assert(BPT && "BlockPointerTypeTakeAnyBlockArguments(): not a block pointer type");      FTP = BPT->getPointeeType()->getAsFunctionProtoType();    }  | 

