r192305 - ObjectiveC migrator. Introduce a new print policy for
Fariborz Jahanian
fjahanian at apple.com
Wed Oct 9 10:37:28 PDT 2013
Author: fjahanian
Date: Wed Oct 9 12:37:28 2013
New Revision: 192305
URL: http://llvm.org/viewvc/llvm-project?rev=192305&view=rev
Log:
ObjectiveC migrator. Introduce a new print policy for
suppression of strong lifetime qualifiers when
inferring property. // rdar://15082812
Modified:
cfe/trunk/include/clang/AST/PrettyPrinter.h
cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
cfe/trunk/lib/AST/TypePrinter.cpp
cfe/trunk/test/ARCMT/objcmt-property.m.result
Modified: cfe/trunk/include/clang/AST/PrettyPrinter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/PrettyPrinter.h?rev=192305&r1=192304&r2=192305&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/PrettyPrinter.h (original)
+++ cfe/trunk/include/clang/AST/PrettyPrinter.h Wed Oct 9 12:37:28 2013
@@ -39,8 +39,8 @@ struct PrintingPolicy {
SuppressTagKeyword(false), SuppressTag(false), SuppressScope(false),
SuppressUnwrittenScope(false), SuppressInitializers(false),
ConstantArraySizeAsWritten(false), AnonymousTagLocations(true),
- SuppressStrongLifetime(false), Bool(LO.Bool),
- TerseOutput(false), PolishForDeclaration(false),
+ SuppressStrongLifetime(false), SuppressLifetimeQualifiers(false),
+ Bool(LO.Bool), TerseOutput(false), PolishForDeclaration(false),
MSWChar(LO.MicrosoftExt && !LO.WChar) { }
/// \brief What language we're printing.
@@ -132,6 +132,10 @@ struct PrintingPolicy {
/// ARC.
unsigned SuppressStrongLifetime : 1;
+ /// \brief When true, suppress printing of lifetime qualifier in
+ /// ARC.
+ unsigned SuppressLifetimeQualifiers : 1;
+
/// \brief Whether we can use 'bool' rather than '_Bool', even if the language
/// doesn't actually have 'bool' (because, e.g., it is defined as a macro).
unsigned Bool : 1;
Modified: cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ObjCMT.cpp?rev=192305&r1=192304&r2=192305&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/ObjCMT.cpp Wed Oct 9 12:37:28 2013
@@ -324,6 +324,7 @@ static bool rewriteToObjCProperty(const
PropertyString += " ";
PrintingPolicy SubPolicy(Context.getPrintingPolicy());
SubPolicy.SuppressStrongLifetime = true;
+ SubPolicy.SuppressLifetimeQualifiers = true;
std::string TypeString = RT.getAsString(SubPolicy);
if (LengthOfPrefix > 0) {
// property name must strip off "is" and lower case the first character
Modified: cfe/trunk/lib/AST/TypePrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TypePrinter.cpp?rev=192305&r1=192304&r2=192305&view=diff
==============================================================================
--- cfe/trunk/lib/AST/TypePrinter.cpp (original)
+++ cfe/trunk/lib/AST/TypePrinter.cpp Wed Oct 9 12:37:28 2013
@@ -36,7 +36,8 @@ namespace {
public:
explicit IncludeStrongLifetimeRAII(PrintingPolicy &Policy)
: Policy(Policy), Old(Policy.SuppressStrongLifetime) {
- Policy.SuppressStrongLifetime = false;
+ if (!Policy.SuppressLifetimeQualifiers)
+ Policy.SuppressStrongLifetime = false;
}
~IncludeStrongLifetimeRAII() {
Modified: cfe/trunk/test/ARCMT/objcmt-property.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-property.m.result?rev=192305&r1=192304&r2=192305&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-property.m.result (original)
+++ cfe/trunk/test/ARCMT/objcmt-property.m.result Wed Oct 9 12:37:28 2013
@@ -223,7 +223,7 @@ DEPRECATED
@property (nonatomic, readonly) id (^expressionBlock)(id, NSArray *, NSMutableDictionary *);
@property (nonatomic, copy) id (^MyBlock)(id, NSArray *, NSMutableDictionary *);
- at property (nonatomic, readonly) id (*expressionFuncptr)(__strong id, NSArray *__strong, NSMutableDictionary *__strong);
- at property (nonatomic) id (*MyFuncptr)(__strong id, NSArray *__strong, NSMutableDictionary *__strong);
+ at property (nonatomic, readonly) id (*expressionFuncptr)(id, NSArray *, NSMutableDictionary *);
+ at property (nonatomic) id (*MyFuncptr)(id, NSArray *, NSMutableDictionary *);
@end
More information about the cfe-commits
mailing list