[cfe-commits] r64570 - in /cfe/trunk/lib/CodeGen: CGBlocks.cpp CGExprConstant.cpp CGExprScalar.cpp CodeGenFunction.h CodeGenModule.h

Anders Carlsson andersca at me.com
Sat Feb 14 14:23:16 PST 2009


14 feb 2009 kl. 14.16 skrev Mike Stump:

> Author: mrs
> Date: Sat Feb 14 16:16:35 2009
> New Revision: 64570
>
> URL: http://llvm.org/viewvc/llvm-project?rev=64570&view=rev
> Log:
> Generate the helper function for blocks.  Now basic codegen is
> starting to work for blocks.
>

Cool!
>
> -llvm::Constant *CodeGenModule::GetAddrOfGlobalBlock(const BlockExpr  
> *BE) {
> +llvm::Constant *
> +CodeGenModule::GetAddrOfGlobalBlock(const BlockExpr *BE,  
> std::string n) {

Can't this be a const char* or at least a const string reference?
>

> +    if (const NamedDecl *ND = dyn_cast<NamedDecl>(CGF->CurFuncDecl))
> +      Name = ND->getNameAsString().c_str();
> +    return CGM.GetAddrOfGlobalBlock(E, Name);

If it was const char* you could use getNameAsCString() which wouldn't  
create a string copy.

Anders




More information about the cfe-commits mailing list