[cfe-commits] r97280 - /cfe/trunk/lib/Frontend/RewriteObjC.cpp
Fariborz Jahanian
fjahanian at apple.com
Fri Feb 26 14:36:30 PST 2010
Author: fjahanian
Date: Fri Feb 26 16:36:30 2010
New Revision: 97280
URL: http://llvm.org/viewvc/llvm-project?rev=97280&view=rev
Log:
Minor cleanup of the rewriter.
Modified:
cfe/trunk/lib/Frontend/RewriteObjC.cpp
Modified: cfe/trunk/lib/Frontend/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/RewriteObjC.cpp?rev=97280&r1=97279&r2=97280&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Frontend/RewriteObjC.cpp Fri Feb 26 16:36:30 2010
@@ -4955,28 +4955,32 @@
// Add inner imported variables now used in current block.
int countOfInnerDecls = 0;
- for (unsigned i = 0; i < InnerBlockDeclRefs.size(); i++) {
- BlockDeclRefExpr *Exp = InnerBlockDeclRefs[i];
- ValueDecl *VD = Exp->getDecl();
- if (!Exp->isByRef() && !BlockByCopyDeclsPtrSet.count(VD)) {
+ if (!InnerBlockDeclRefs.empty()) {
+ for (unsigned i = 0; i < InnerBlockDeclRefs.size(); i++) {
+ BlockDeclRefExpr *Exp = InnerBlockDeclRefs[i];
+ ValueDecl *VD = Exp->getDecl();
+ if (!Exp->isByRef() && !BlockByCopyDeclsPtrSet.count(VD)) {
// We need to save the copied-in variables in nested
// blocks because it is needed at the end for some of the API generations.
// See SynthesizeBlockLiterals routine.
- InnerDeclRefs.push_back(Exp); countOfInnerDecls++;
- BlockDeclRefs.push_back(Exp);
- BlockByCopyDeclsPtrSet.insert(VD);
- BlockByCopyDecls.push_back(VD);
- if (Exp->getType()->isObjCObjectPointerType() ||
- Exp->getType()->isBlockPointerType())
- ImportedBlockDecls.insert(VD);
- }
- if (Exp->isByRef() && !BlockByRefDeclsPtrSet.count(VD)) {
- InnerDeclRefs.push_back(Exp); countOfInnerDecls++;
- BlockDeclRefs.push_back(Exp);
- BlockByRefDeclsPtrSet.insert(VD);
- BlockByRefDecls.push_back(VD);
- ImportedBlockDecls.insert(VD);
+ InnerDeclRefs.push_back(Exp); countOfInnerDecls++;
+ BlockDeclRefs.push_back(Exp);
+ BlockByCopyDeclsPtrSet.insert(VD);
+ BlockByCopyDecls.push_back(VD);
+ }
+ if (Exp->isByRef() && !BlockByRefDeclsPtrSet.count(VD)) {
+ InnerDeclRefs.push_back(Exp); countOfInnerDecls++;
+ BlockDeclRefs.push_back(Exp);
+ BlockByRefDeclsPtrSet.insert(VD);
+ BlockByRefDecls.push_back(VD);
+ }
}
+ // Find any imported blocks...they will need special attention.
+ for (unsigned i = 0; i < InnerBlockDeclRefs.size(); i++)
+ if (InnerBlockDeclRefs[i]->isByRef() ||
+ InnerBlockDeclRefs[i]->getType()->isObjCObjectPointerType() ||
+ InnerBlockDeclRefs[i]->getType()->isBlockPointerType())
+ ImportedBlockDecls.insert(InnerBlockDeclRefs[i]->getDecl());
}
InnerDeclRefsCount.push_back(countOfInnerDecls);
More information about the cfe-commits
mailing list