[llvm-branch-commits] [cfe-branch] r81945 - /cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp
Steve Naroff
snaroff at apple.com
Tue Sep 15 16:11:14 PDT 2009
Author: snaroff
Date: Tue Sep 15 18:11:13 2009
New Revision: 81945
URL: http://llvm.org/viewvc/llvm-project?rev=81945&view=rev
Log:
Add flag to indicate we have helpers.
Modified:
cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp
Modified: cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp?rev=81945&r1=81944&r2=81945&view=diff
==============================================================================
--- cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp (original)
+++ cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp Tue Sep 15 18:11:13 2009
@@ -109,7 +109,7 @@
llvm::SmallPtrSet<ValueDecl *, 8> ImportedBlockDecls;
llvm::DenseMap<BlockExpr *, std::string> RewrittenBlockExprs;
-
+
// This maps a property to it's assignment statement.
llvm::DenseMap<ObjCPropertyRefExpr *, BinaryOperator *> PropSetters;
// This maps a property to it's synthesied message expression.
@@ -3867,8 +3867,7 @@
if (ImportedBlockDecls.size()) {
std::string HF = SynthesizeBlockHelperFuncs(Blocks[i], i, FunName, ImplTag);
InsertText(FunLocStart, HF.c_str(), HF.size());
- }
-
+ }
std::string BD = SynthesizeBlockDescriptor(DescTag, ImplTag, i, FunName,
ImportedBlockDecls.size() > 0);
InsertText(FunLocStart, BD.c_str(), BD.size());
@@ -4312,6 +4311,17 @@
InitExprs.push_back(Exp);
}
}
+ if (ImportedBlockDecls.size()) { // generate "1<<25" to indicate we have helper functions.
+ unsigned IntSize =
+ static_cast<unsigned>(Context->getTypeSize(Context->IntTy));
+ BinaryOperator *Exp = new BinaryOperator(
+ new IntegerLiteral(llvm::APInt(IntSize, 1),
+ Context->IntTy,SourceLocation()),
+ new IntegerLiteral(llvm::APInt(IntSize, 25),
+ Context->IntTy, SourceLocation()),
+ BinaryOperator::Shl, Context->IntTy, SourceLocation());
+ InitExprs.push_back(Exp);
+ }
NewRep = new CallExpr(DRE, &InitExprs[0], InitExprs.size(),
FType, SourceLocation());
NewRep = new UnaryOperator(NewRep, UnaryOperator::AddrOf,
More information about the llvm-branch-commits
mailing list