forked from OSchip/llvm-project
[objcmt] Accept char arrays for rewriting to @() syntax.
Part of rdar://11438360 llvm-svn: 156880
This commit is contained in:
parent
0d69a3a4b3
commit
8154147942
|
@ -824,8 +824,12 @@ static bool doRewriteToUTF8StringBoxedExpressionHelper(
|
|||
if (Arg->isTypeDependent())
|
||||
return false;
|
||||
|
||||
ASTContext &Ctx = NS.getASTContext();
|
||||
|
||||
const Expr *OrigArg = Arg->IgnoreImpCasts();
|
||||
QualType OrigTy = OrigArg->getType();
|
||||
if (OrigTy->isArrayType())
|
||||
OrigTy = Ctx.getArrayDecayedType(OrigTy);
|
||||
|
||||
if (const StringLiteral *
|
||||
StrE = dyn_cast<StringLiteral>(OrigArg->IgnoreParens())) {
|
||||
|
@ -834,8 +838,6 @@ static bool doRewriteToUTF8StringBoxedExpressionHelper(
|
|||
return true;
|
||||
}
|
||||
|
||||
ASTContext &Ctx = NS.getASTContext();
|
||||
|
||||
if (const PointerType *PT = OrigTy->getAs<PointerType>()) {
|
||||
QualType PointeeType = PT->getPointeeType();
|
||||
if (Ctx.hasSameUnqualifiedType(PointeeType, Ctx.CharTy)) {
|
||||
|
|
|
@ -95,4 +95,7 @@ void boxString() {
|
|||
NSStringEncoding encode;
|
||||
s = [NSString stringWithCString:cstr1 encoding:encode];
|
||||
s = [NSString stringWithCString:cstr1];
|
||||
|
||||
static const char strarr[] = "coolbox";
|
||||
s = [NSString stringWithUTF8String:strarr];
|
||||
}
|
||||
|
|
|
@ -95,4 +95,7 @@ void boxString() {
|
|||
NSStringEncoding encode;
|
||||
s = [NSString stringWithCString:cstr1 encoding:encode];
|
||||
s = @(cstr1);
|
||||
|
||||
static const char strarr[] = "coolbox";
|
||||
s = @(strarr);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue