r190901 - ObjectiveC migrator. infer NS_OPTIONS correctly in the
Fariborz Jahanian
fjahanian at apple.com
Tue Sep 17 16:32:51 PDT 2013
Author: fjahanian
Date: Tue Sep 17 18:32:51 2013
New Revision: 190901
URL: http://llvm.org/viewvc/llvm-project?rev=190901&view=rev
Log:
ObjectiveC migrator. infer NS_OPTIONS correctly in the
presense of parenthesized enumerator initializers.
Modified:
cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
cfe/trunk/test/ARCMT/objcmt-ns-macros.m
cfe/trunk/test/ARCMT/objcmt-ns-macros.m.result
Modified: cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ObjCMT.cpp?rev=190901&r1=190900&r2=190901&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/ObjCMT.cpp Tue Sep 17 18:32:51 2013
@@ -508,7 +508,7 @@ static bool UseNSOptionsMacro(Preprocess
PowerOfTwo = false;
continue;
}
- InitExpr = InitExpr->IgnoreImpCasts();
+ InitExpr = InitExpr->IgnoreParenCasts();
if (const BinaryOperator *BO = dyn_cast<BinaryOperator>(InitExpr))
if (BO->isShiftOp() || BO->isBitwiseOp())
return true;
Modified: cfe/trunk/test/ARCMT/objcmt-ns-macros.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-ns-macros.m?rev=190901&r1=190900&r2=190901&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-ns-macros.m (original)
+++ cfe/trunk/test/ARCMT/objcmt-ns-macros.m Tue Sep 17 18:32:51 2013
@@ -126,3 +126,23 @@ typedef enum {
D_NSTickMarkAbove = 1
} D_NSTickMarkPosition DEPRECATED;
+
+#define NS_ENUM_AVAILABLE(X,Y)
+
+enum {
+ NSFStrongMemory NS_ENUM_AVAILABLE(10_5, 6_0) = (0UL << 0),
+ NSFOpaqueMemory NS_ENUM_AVAILABLE(10_5, 6_0) = (2UL << 0),
+ NSFMallocMemory NS_ENUM_AVAILABLE(10_5, 6_0) = (3UL << 0),
+ NSFMachVirtualMemory NS_ENUM_AVAILABLE(10_5, 6_0) = (4UL << 0),
+ NSFWeakMemory NS_ENUM_AVAILABLE(10_8, 6_0) = (5UL << 0),
+
+ NSFObjectPersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (0UL << 8),
+ NSFOpaquePersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (1UL << 8),
+ NSFObjectPointerPersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (2UL << 8),
+ NSFCStringPersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (3UL << 8),
+ NSFStructPersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (4UL << 8),
+ NSFIntegerPersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (5UL << 8),
+ NSFCopyIn NS_ENUM_AVAILABLE(10_5, 6_0) = (1UL << 16),
+};
+
+typedef NSUInteger NSFOptions;
Modified: cfe/trunk/test/ARCMT/objcmt-ns-macros.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-ns-macros.m.result?rev=190901&r1=190900&r2=190901&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-ns-macros.m.result (original)
+++ cfe/trunk/test/ARCMT/objcmt-ns-macros.m.result Tue Sep 17 18:32:51 2013
@@ -126,3 +126,23 @@ typedef enum {
D_NSTickMarkAbove = 1
} D_NSTickMarkPosition DEPRECATED;
+
+#define NS_ENUM_AVAILABLE(X,Y)
+
+typedef NS_OPTIONS(NSUInteger, NSFOptions) {
+ NSFStrongMemory NS_ENUM_AVAILABLE(10_5, 6_0) = (0UL << 0),
+ NSFOpaqueMemory NS_ENUM_AVAILABLE(10_5, 6_0) = (2UL << 0),
+ NSFMallocMemory NS_ENUM_AVAILABLE(10_5, 6_0) = (3UL << 0),
+ NSFMachVirtualMemory NS_ENUM_AVAILABLE(10_5, 6_0) = (4UL << 0),
+ NSFWeakMemory NS_ENUM_AVAILABLE(10_8, 6_0) = (5UL << 0),
+
+ NSFObjectPersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (0UL << 8),
+ NSFOpaquePersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (1UL << 8),
+ NSFObjectPointerPersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (2UL << 8),
+ NSFCStringPersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (3UL << 8),
+ NSFStructPersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (4UL << 8),
+ NSFIntegerPersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (5UL << 8),
+ NSFCopyIn NS_ENUM_AVAILABLE(10_5, 6_0) = (1UL << 16),
+};
+
+
More information about the cfe-commits
mailing list