diff options
| author | Chris Lattner <sabre@nondot.org> | 2009-02-18 06:40:38 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2009-02-18 06:40:38 +0000 |
| commit | f83b5afb7b482c779dc04b1fe3a92ceb6cfa54e9 (patch) | |
| tree | 200bd873a2ffd50e225f201cd7e7a234c30a8082 /clang/Driver | |
| parent | b2809a0a1b07fa1ca9dbdab0bba5171adc7db476 (diff) | |
| download | bcm5719-llvm-f83b5afb7b482c779dc04b1fe3a92ceb6cfa54e9.tar.gz bcm5719-llvm-f83b5afb7b482c779dc04b1fe3a92ceb6cfa54e9.zip | |
privatize all of the string literal memory allocation/creation
stuff behind a private static function.
llvm-svn: 64898
Diffstat (limited to 'clang/Driver')
| -rw-r--r-- | clang/Driver/RewriteObjC.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/clang/Driver/RewriteObjC.cpp b/clang/Driver/RewriteObjC.cpp index 878a94c1f1a..c6b9b43a9ef 100644 --- a/clang/Driver/RewriteObjC.cpp +++ b/clang/Driver/RewriteObjC.cpp @@ -1734,9 +1734,9 @@ Stmt *RewriteObjC::RewriteAtEncode(ObjCEncodeExpr *Exp) { QualType StrType = Context->getPointerType(Context->CharTy); std::string StrEncoding; Context->getObjCEncodingForType(Exp->getEncodedType(), StrEncoding); - Expr *Replacement = new (Context) StringLiteral(*Context,StrEncoding.c_str(), - StrEncoding.length(), false, StrType, - SourceLocation()); + Expr *Replacement = StringLiteral::Create(*Context,StrEncoding.c_str(), + StrEncoding.length(), false,StrType, + SourceLocation()); ReplaceStmt(Exp, Replacement); // Replace this subexpr in the parent. @@ -1751,7 +1751,7 @@ Stmt *RewriteObjC::RewriteAtSelector(ObjCSelectorExpr *Exp) { // Create a call to sel_registerName("selName"). llvm::SmallVector<Expr*, 8> SelExprs; QualType argType = Context->getPointerType(Context->CharTy); - SelExprs.push_back(new (Context) StringLiteral((*Context), + SelExprs.push_back(StringLiteral::Create(*Context, Exp->getSelector().getAsString().c_str(), Exp->getSelector().getAsString().size(), false, argType, SourceLocation())); @@ -2289,7 +2289,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp) { SourceLocation())); llvm::SmallVector<Expr*, 8> ClsExprs; QualType argType = Context->getPointerType(Context->CharTy); - ClsExprs.push_back(new (Context) StringLiteral(*Context, + ClsExprs.push_back(StringLiteral::Create(*Context, SuperDecl->getIdentifier()->getName(), SuperDecl->getIdentifier()->getLength(), false, argType, SourceLocation())); @@ -2341,10 +2341,11 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp) { } else { llvm::SmallVector<Expr*, 8> ClsExprs; QualType argType = Context->getPointerType(Context->CharTy); - ClsExprs.push_back(new (Context) StringLiteral(*Context, - clsName->getName(), - clsName->getLength(), - false, argType, SourceLocation())); + ClsExprs.push_back(StringLiteral::Create(*Context, + clsName->getName(), + clsName->getLength(), + false, argType, + SourceLocation())); CallExpr *Cls = SynthesizeCallToFunctionDecl(GetClassFunctionDecl, &ClsExprs[0], ClsExprs.size()); @@ -2371,7 +2372,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp) { llvm::SmallVector<Expr*, 8> ClsExprs; QualType argType = Context->getPointerType(Context->CharTy); - ClsExprs.push_back(new (Context) StringLiteral(*Context, + ClsExprs.push_back(StringLiteral::Create(*Context, SuperDecl->getIdentifier()->getName(), SuperDecl->getIdentifier()->getLength(), false, argType, SourceLocation())); @@ -2429,7 +2430,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp) { // Create a call to sel_registerName("selName"), it will be the 2nd argument. llvm::SmallVector<Expr*, 8> SelExprs; QualType argType = Context->getPointerType(Context->CharTy); - SelExprs.push_back(new (Context) StringLiteral(*Context, + SelExprs.push_back(StringLiteral::Create(*Context, Exp->getSelector().getAsString().c_str(), Exp->getSelector().getAsString().size(), false, argType, SourceLocation())); @@ -2596,8 +2597,7 @@ Stmt *RewriteObjC::RewriteObjCProtocolExpr(ObjCProtocolExpr *Exp) { // Create a call to objc_getProtocol("ProtocolName"). llvm::SmallVector<Expr*, 8> ProtoExprs; QualType argType = Context->getPointerType(Context->CharTy); - ProtoExprs.push_back(new (Context) - StringLiteral(*Context, + ProtoExprs.push_back(StringLiteral::Create(*Context, Exp->getProtocol()->getNameAsCString(), strlen(Exp->getProtocol()->getNameAsCString()), false, argType, SourceLocation())); |

