[cfe-commits] r120617 - in /cfe/trunk: include/clang/AST/ASTContext.h lib/AST/ASTContext.cpp lib/Sema/SemaDecl.cpp
Douglas Gregor
dgregor at apple.com
Mon Dec 6 08:50:38 PST 2010
On Dec 1, 2010, at 2:29 PM, Fariborz Jahanian wrote:
> Author: fjahanian
> Date: Wed Dec 1 16:29:46 2010
> New Revision: 120617
>
> URL: http://llvm.org/viewvc/llvm-project?rev=120617&view=rev
> Log:
> Sema/AST work for capturing copy init expression
> to be used in copy helper synthesis of __block
> variables. wip.
>
> Modified:
> cfe/trunk/include/clang/AST/ASTContext.h
> cfe/trunk/lib/AST/ASTContext.cpp
> cfe/trunk/lib/Sema/SemaDecl.cpp
>
> Modified: cfe/trunk/include/clang/AST/ASTContext.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=120617&r1=120616&r2=120617&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/AST/ASTContext.h (original)
> +++ cfe/trunk/include/clang/AST/ASTContext.h Wed Dec 1 16:29:46 2010
> @@ -129,6 +129,9 @@
> /// \brief Mapping from ObjCContainers to their ObjCImplementations.
> llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*> ObjCImpls;
>
> + /// \brief Mapping from __block VarDecls to their copy initialization expr.
> + llvm::DenseMap<VarDecl*, Expr*> BlockVarCopyInits;
> +
> /// \brief Representation of a "canonical" template template parameter that
> /// is used in canonical template names.
> class CanonicalTemplateTemplateParm : public llvm::FoldingSetNode {
> @@ -1358,6 +1361,12 @@
> /// \brief Set the implementation of ObjCCategoryDecl.
> void setObjCImplementation(ObjCCategoryDecl *CatD,
> ObjCCategoryImplDecl *ImplD);
> +
> + /// \brief Set the copy inialization expression of a block var decl.
> + void setBlockVarCopyInits(VarDecl*VD, Expr* Init);
> + /// \brief Get the copy initialization expression of VarDecl,or NULL if
> + /// none exists.
> + Expr *getBlockVarCopyInits(VarDecl*VD);
>
> /// \brief Allocate an uninitialized TypeSourceInfo.
> ///
>
> Modified: cfe/trunk/lib/AST/ASTContext.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=120617&r1=120616&r2=120617&view=diff
> ==============================================================================
> --- cfe/trunk/lib/AST/ASTContext.cpp (original)
> +++ cfe/trunk/lib/AST/ASTContext.cpp Wed Dec 1 16:29:46 2010
> @@ -1008,6 +1008,20 @@
> ObjCImpls[CatD] = ImplD;
> }
>
> +/// \brief Get the copy initialization expression of VarDecl,or NULL if
> +/// none exists.
> +Expr *ASTContext::getBlockVarCopyInits(VarDecl*VD) {
> + llvm::DenseMap<VarDecl*, Expr*>::iterator
> + I = BlockVarCopyInits.find(VD);
> + return (I != BlockVarCopyInits.end()) ? cast<Expr>(I->second) : 0;
> +}
> +
> +/// \brief Set the copy inialization expression of a block var decl.
> +void ASTContext::setBlockVarCopyInits(VarDecl*VD, Expr* Init) {
> + assert(VD && Init && "Passed null params");
> + BlockVarCopyInits[VD] = Init;
> +}
For these routines, how about assert()'d hasAttr<BlockAttr>()?
- Doug
More information about the cfe-commits
mailing list