diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2015-05-27 18:47:56 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2015-05-27 18:47:56 +0000 | 
| commit | 5e20cdd81c44a443562a09007668ffdf76c455af (patch) | |
| tree | dbbd4047878da71c1a706e26ce05b4e7791b14cc /lib/Frontend/Rewrite/RewriteModernObjC.cpp | |
| parent | d5f23b0b7528b5c3caed1ba14f897cc4aaa9e3c3 (diff) | |
Notes
Diffstat (limited to 'lib/Frontend/Rewrite/RewriteModernObjC.cpp')
| -rw-r--r-- | lib/Frontend/Rewrite/RewriteModernObjC.cpp | 85 | 
1 files changed, 38 insertions, 47 deletions
| diff --git a/lib/Frontend/Rewrite/RewriteModernObjC.cpp b/lib/Frontend/Rewrite/RewriteModernObjC.cpp index 47f8189f2313d..e13cdb3a3e55e 100644 --- a/lib/Frontend/Rewrite/RewriteModernObjC.cpp +++ b/lib/Frontend/Rewrite/RewriteModernObjC.cpp @@ -243,8 +243,8 @@ namespace {      RewriteModernObjC(std::string inFile, raw_ostream *OS,                  DiagnosticsEngine &D, const LangOptions &LOpts,                  bool silenceMacroWarn, bool LineInfo); -     -    ~RewriteModernObjC() {} + +    ~RewriteModernObjC() override {}      void HandleTranslationUnit(ASTContext &C) override; @@ -889,9 +889,9 @@ RewriteModernObjC::getIvarAccessString(ObjCIvarDecl *D) {                                          IvarT, nullptr,                                          /*BitWidth=*/nullptr, /*Mutable=*/true,                                          ICIS_NoInit); -      MemberExpr *ME = new (Context) MemberExpr(PE, true, FD, SourceLocation(), -                                                FD->getType(), VK_LValue, -                                                OK_Ordinary); +      MemberExpr *ME = new (Context) +          MemberExpr(PE, true, SourceLocation(), FD, SourceLocation(), +                     FD->getType(), VK_LValue, OK_Ordinary);        IvarT = Context->getDecltypeType(ME, ME->getType());      }    } @@ -2689,7 +2689,7 @@ Stmt *RewriteModernObjC::RewriteObjCBoxedExpr(ObjCBoxedExpr *Exp) {    MsgExprs.push_back(subExpr);    SmallVector<QualType, 4> ArgTypes; -  ArgTypes.push_back(Context->getObjCIdType()); +  ArgTypes.push_back(Context->getObjCClassType());    ArgTypes.push_back(Context->getObjCSelType());    for (const auto PI : BoxingMethod->parameters())      ArgTypes.push_back(PI->getType()); @@ -2767,11 +2767,9 @@ Stmt *RewriteModernObjC::RewriteObjCArrayLiteralExpr(ObjCArrayLiteral *Exp) {                                      Context->getPointerType(Context->VoidPtrTy),                                      nullptr, /*BitWidth=*/nullptr,                                      /*Mutable=*/true, ICIS_NoInit); -  MemberExpr *ArrayLiteralME =  -    new (Context) MemberExpr(NSArrayCallExpr, false, ARRFD,  -                             SourceLocation(), -                             ARRFD->getType(), VK_LValue, -                             OK_Ordinary); +  MemberExpr *ArrayLiteralME = new (Context) +      MemberExpr(NSArrayCallExpr, false, SourceLocation(), ARRFD, +                 SourceLocation(), ARRFD->getType(), VK_LValue, OK_Ordinary);    QualType ConstIdT = Context->getObjCIdType().withConst();    CStyleCastExpr * ArrayLiteralObjects =       NoTypeInfoCStyleCastExpr(Context,  @@ -2818,7 +2816,7 @@ Stmt *RewriteModernObjC::RewriteObjCArrayLiteralExpr(ObjCArrayLiteral *Exp) {    SmallVector<QualType, 4> ArgTypes; -  ArgTypes.push_back(Context->getObjCIdType()); +  ArgTypes.push_back(Context->getObjCClassType());    ArgTypes.push_back(Context->getObjCSelType());    for (const auto *PI : ArrayMethod->params())      ArgTypes.push_back(PI->getType()); @@ -2904,11 +2902,9 @@ Stmt *RewriteModernObjC::RewriteObjCDictionaryLiteralExpr(ObjCDictionaryLiteral                                         Context->getPointerType(Context->VoidPtrTy),                                         nullptr, /*BitWidth=*/nullptr,                                         /*Mutable=*/true, ICIS_NoInit); -  MemberExpr *DictLiteralValueME =  -    new (Context) MemberExpr(NSValueCallExpr, false, ARRFD,  -                             SourceLocation(), -                             ARRFD->getType(), VK_LValue, -                             OK_Ordinary); +  MemberExpr *DictLiteralValueME = new (Context) +      MemberExpr(NSValueCallExpr, false, SourceLocation(), ARRFD, +                 SourceLocation(), ARRFD->getType(), VK_LValue, OK_Ordinary);    QualType ConstIdT = Context->getObjCIdType().withConst();    CStyleCastExpr * DictValueObjects =       NoTypeInfoCStyleCastExpr(Context,  @@ -2919,13 +2915,11 @@ Stmt *RewriteModernObjC::RewriteObjCDictionaryLiteralExpr(ObjCDictionaryLiteral    Expr *NSKeyCallExpr =       new (Context) CallExpr(*Context, NSDictDRE, KeyExprs,                             NSDictFType, VK_LValue, SourceLocation()); -   -  MemberExpr *DictLiteralKeyME =  -    new (Context) MemberExpr(NSKeyCallExpr, false, ARRFD,  -                             SourceLocation(), -                             ARRFD->getType(), VK_LValue, -                             OK_Ordinary); -   + +  MemberExpr *DictLiteralKeyME = new (Context) +      MemberExpr(NSKeyCallExpr, false, SourceLocation(), ARRFD, +                 SourceLocation(), ARRFD->getType(), VK_LValue, OK_Ordinary); +    CStyleCastExpr * DictKeyObjects =       NoTypeInfoCStyleCastExpr(Context,                                Context->getPointerType(ConstIdT), @@ -2975,7 +2969,7 @@ Stmt *RewriteModernObjC::RewriteObjCDictionaryLiteralExpr(ObjCDictionaryLiteral    SmallVector<QualType, 8> ArgTypes; -  ArgTypes.push_back(Context->getObjCIdType()); +  ArgTypes.push_back(Context->getObjCClassType());    ArgTypes.push_back(Context->getObjCSelType());    for (const auto *PI : DictMethod->params()) {      QualType T = PI->getType(); @@ -3234,9 +3228,9 @@ Expr *RewriteModernObjC::SynthMsgSendStretCallExpr(FunctionDecl *MsgSendStretFla                                      returnType, nullptr,                                      /*BitWidth=*/nullptr,                                      /*Mutable=*/true, ICIS_NoInit); -  MemberExpr *ME = new (Context) MemberExpr(STCE, false, FieldD, SourceLocation(), -                                            FieldD->getType(), VK_LValue, -                                            OK_Ordinary); +  MemberExpr *ME = new (Context) +      MemberExpr(STCE, false, SourceLocation(), FieldD, SourceLocation(), +                 FieldD->getType(), VK_LValue, OK_Ordinary);    return ME;  } @@ -4732,11 +4726,10 @@ Stmt *RewriteModernObjC::SynthesizeBlockCall(CallExpr *Exp, const Expr *BlockExp                                      Context->VoidPtrTy, nullptr,                                      /*BitWidth=*/nullptr, /*Mutable=*/true,                                      ICIS_NoInit); -  MemberExpr *ME = new (Context) MemberExpr(PE, true, FD, SourceLocation(), -                                            FD->getType(), VK_LValue, -                                            OK_Ordinary); +  MemberExpr *ME = +      new (Context) MemberExpr(PE, true, SourceLocation(), FD, SourceLocation(), +                               FD->getType(), VK_LValue, OK_Ordinary); -      CastExpr *FunkCast = NoTypeInfoCStyleCastExpr(Context, PtrToFuncCastType,                                                  CK_BitCast, ME);    PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(), FunkCast); @@ -4781,10 +4774,9 @@ Stmt *RewriteModernObjC::RewriteBlockDeclRefExpr(DeclRefExpr *DeclRefExp) {                                      Context->VoidPtrTy, nullptr,                                      /*BitWidth=*/nullptr, /*Mutable=*/true,                                      ICIS_NoInit); -  MemberExpr *ME = new (Context) MemberExpr(DeclRefExp, isArrow, -                                            FD, SourceLocation(), -                                            FD->getType(), VK_LValue, -                                            OK_Ordinary); +  MemberExpr *ME = new (Context) +      MemberExpr(DeclRefExp, isArrow, SourceLocation(), FD, SourceLocation(), +                 FD->getType(), VK_LValue, OK_Ordinary);    StringRef Name = VD->getName();    FD = FieldDecl::Create(*Context, nullptr, SourceLocation(), SourceLocation(), @@ -4792,11 +4784,10 @@ Stmt *RewriteModernObjC::RewriteBlockDeclRefExpr(DeclRefExpr *DeclRefExp) {                           Context->VoidPtrTy, nullptr,                           /*BitWidth=*/nullptr, /*Mutable=*/true,                           ICIS_NoInit); -  ME = new (Context) MemberExpr(ME, true, FD, SourceLocation(), -                                DeclRefExp->getType(), VK_LValue, OK_Ordinary); -   -   -   +  ME = +      new (Context) MemberExpr(ME, true, SourceLocation(), FD, SourceLocation(), +                               DeclRefExp->getType(), VK_LValue, OK_Ordinary); +    // Need parens to enforce precedence.    ParenExpr *PE = new (Context) ParenExpr(DeclRefExp->getExprLoc(),                                             DeclRefExp->getExprLoc(),  @@ -7694,9 +7685,9 @@ Stmt *RewriteModernObjC::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV) {                                              IvarT, nullptr,                                              /*BitWidth=*/nullptr,                                              /*Mutable=*/true, ICIS_NoInit); -          MemberExpr *ME = new (Context) MemberExpr(PE, true, FD, SourceLocation(), -                                                    FD->getType(), VK_LValue, -                                                    OK_Ordinary); +          MemberExpr *ME = new (Context) +              MemberExpr(PE, true, SourceLocation(), FD, SourceLocation(), +                         FD->getType(), VK_LValue, OK_Ordinary);            IvarT = Context->getDecltypeType(ME, ME->getType());          }        } @@ -7723,9 +7714,9 @@ Stmt *RewriteModernObjC::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV) {                                            D->getType(), nullptr,                                            /*BitWidth=*/D->getBitWidth(),                                            /*Mutable=*/true, ICIS_NoInit); -        MemberExpr *ME = new (Context) MemberExpr(PE, /*isArrow*/false, FD, SourceLocation(), -                                                  FD->getType(), VK_LValue, -                                                  OK_Ordinary); +        MemberExpr *ME = new (Context) +            MemberExpr(PE, /*isArrow*/ false, SourceLocation(), FD, +                       SourceLocation(), FD->getType(), VK_LValue, OK_Ordinary);          Replacement = ME;        } | 
