]> granicus.if.org Git - clang/commitdiff
More cleanup/refactoring of the rewrite.
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 23 Dec 2009 21:52:32 +0000 (21:52 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 23 Dec 2009 21:52:32 +0000 (21:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92062 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/RewriteObjC.cpp

index 4e8679c58852fd1a70f7334ad89d63662e7fd117..3ef3a0611931bdabece1bdd1bdd4bf39b63bb4db 100644 (file)
@@ -4581,16 +4581,14 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp) {
       InitExprs.push_back(Exp);
     }
   }
-  if (ImportedBlockDecls.size()) { // generate "1<<25" to indicate we have helper functions.
+  if (ImportedBlockDecls.size()) {
+    // generate BLOCK_HAS_COPY_DISPOSE(have helper funcs) | BLOCK_HAS_DESCRIPTOR
+    int flag = (BLOCK_HAS_COPY_DISPOSE | BLOCK_HAS_DESCRIPTOR);
     unsigned IntSize = 
       static_cast<unsigned>(Context->getTypeSize(Context->IntTy));
-    BinaryOperator *Exp = new (Context) BinaryOperator(
-                              new (Context) IntegerLiteral(llvm::APInt(IntSize, 1), 
-                                                 Context->IntTy,SourceLocation()), 
-                              new (Context) IntegerLiteral(llvm::APInt(IntSize, 25), 
-                                                 Context->IntTy, SourceLocation()), 
-                              BinaryOperator::Shl, Context->IntTy, SourceLocation());
-    InitExprs.push_back(Exp);
+    Expr *FlagExp = new (Context) IntegerLiteral(llvm::APInt(IntSize, flag), 
+                                             Context->IntTy, SourceLocation());
+    InitExprs.push_back(FlagExp);
   }
   NewRep = new (Context) CallExpr(*Context, DRE, &InitExprs[0], InitExprs.size(),
                                   FType, SourceLocation());