diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-05-29 20:38:28 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-05-29 20:38:28 +0000 |
commit | d249e1d1f1498b81314459ceda19d6ff25c278ad (patch) | |
tree | 64980c7c4974845750bbfefa695204a8feff0861 /lib/Frontend/RewriteObjC.cpp | |
parent | e540858b289b23653bcb23646f135729203635cb (diff) |
Create a new PrintingPolicy class, which we pass down through the AST
printing logic to help customize the output. For now, we use this
rather than a special flag to suppress the "struct" when printing
"struct X" and to print the Boolean type as "bool" in C++ but "_Bool"
in C.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72590 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/RewriteObjC.cpp')
-rw-r--r-- | lib/Frontend/RewriteObjC.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/Frontend/RewriteObjC.cpp b/lib/Frontend/RewriteObjC.cpp index 79ae08cee5..55f0b405a9 100644 --- a/lib/Frontend/RewriteObjC.cpp +++ b/lib/Frontend/RewriteObjC.cpp @@ -944,9 +944,10 @@ void RewriteObjC::RewriteObjCMethodDecl(ObjCMethodDecl *OMD, if (isTopLevelBlockPointerType(PDecl->getType())) { // Make sure we convert "t (^)(...)" to "t (*)(...)". const BlockPointerType *BPT = PDecl->getType()->getAsBlockPointerType(); - Context->getPointerType(BPT->getPointeeType()).getAsStringInternal(Name); + Context->getPointerType(BPT->getPointeeType()).getAsStringInternal(Name, + Context->PrintingPolicy); } else - PDecl->getType().getAsStringInternal(Name); + PDecl->getType().getAsStringInternal(Name, Context->PrintingPolicy); ResultStr += Name; } } @@ -3600,7 +3601,7 @@ std::string RewriteObjC::SynthesizeBlockFunc(BlockExpr *CE, int i, E = BD->param_end(); AI != E; ++AI) { if (AI != BD->param_begin()) S += ", "; ParamStr = (*AI)->getNameAsString(); - (*AI)->getType().getAsStringInternal(ParamStr); + (*AI)->getType().getAsStringInternal(ParamStr, Context->PrintingPolicy); S += ParamStr; } if (FT->isVariadic()) { @@ -3617,7 +3618,8 @@ std::string RewriteObjC::SynthesizeBlockFunc(BlockExpr *CE, int i, E = BlockByRefDecls.end(); I != E; ++I) { S += " "; std::string Name = (*I)->getNameAsString(); - Context->getPointerType((*I)->getType()).getAsStringInternal(Name); + Context->getPointerType((*I)->getType()).getAsStringInternal(Name, + Context->PrintingPolicy); S += Name + " = __cself->" + (*I)->getNameAsString() + "; // bound by ref\n"; } // Next, emit a declaration for all "by copy" declarations. @@ -3638,7 +3640,7 @@ std::string RewriteObjC::SynthesizeBlockFunc(BlockExpr *CE, int i, if (isTopLevelBlockPointerType((*I)->getType())) S += "struct __block_impl *"; else - (*I)->getType().getAsStringInternal(Name); + (*I)->getType().getAsStringInternal(Name, Context->PrintingPolicy); S += Name + " = __cself->" + (*I)->getNameAsString() + "; // bound by copy\n"; } std::string RewrittenStr = RewrittenBlockExprs[CE]; @@ -3719,8 +3721,8 @@ std::string RewriteObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag, S += "struct __block_impl *"; Constructor += ", void *" + ArgName; } else { - (*I)->getType().getAsStringInternal(FieldName); - (*I)->getType().getAsStringInternal(ArgName); + (*I)->getType().getAsStringInternal(FieldName, Context->PrintingPolicy); + (*I)->getType().getAsStringInternal(ArgName, Context->PrintingPolicy); Constructor += ", " + ArgName; } S += FieldName + ";\n"; @@ -3745,8 +3747,10 @@ std::string RewriteObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag, S += "struct __block_impl *"; Constructor += ", void *" + ArgName; } else { - Context->getPointerType((*I)->getType()).getAsStringInternal(FieldName); - Context->getPointerType((*I)->getType()).getAsStringInternal(ArgName); + Context->getPointerType((*I)->getType()).getAsStringInternal(FieldName, + Context->PrintingPolicy); + Context->getPointerType((*I)->getType()).getAsStringInternal(ArgName, + Context->PrintingPolicy); Constructor += ", " + ArgName; } S += FieldName + "; // by ref\n"; |