From 7275da0f2ee24336fe83cb7cfe2ba22f9cefc117 Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Wed, 28 Feb 2018 07:15:55 +0000 Subject: [ObjC] Allow declaring __strong pointer fields in structs in Objective-C ARC mode. Declaring __strong pointer fields in structs was not allowed in Objective-C ARC until now because that would make the struct non-trivial to default-initialize, copy/move, and destroy, which is not something C was designed to do. This patch lifts that restriction. Special functions for non-trivial C structs are synthesized that are needed to default-initialize, copy/move, and destroy the structs and manage the ownership of the objects the __strong pointer fields point to. Non-trivial structs passed to functions are destructed in the callee function. rdar://problem/33599681 Differential Revision: https://reviews.llvm.org/D41228 llvm-svn: 326307 --- clang/lib/Lex/PPMacroExpansion.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'clang/lib/Lex') diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp index 41633f90c34..7f524c5591c 100644 --- a/clang/lib/Lex/PPMacroExpansion.cpp +++ b/clang/lib/Lex/PPMacroExpansion.cpp @@ -1151,6 +1151,7 @@ static bool HasFeature(const Preprocessor &PP, StringRef Feature) { // Objective-C features .Case("objc_arr", LangOpts.ObjCAutoRefCount) // FIXME: REMOVE? .Case("objc_arc", LangOpts.ObjCAutoRefCount) + .Case("objc_arc_fields", true) .Case("objc_arc_weak", LangOpts.ObjCWeak) .Case("objc_default_synthesize_properties", LangOpts.ObjC2) .Case("objc_fixed_enum", LangOpts.ObjC2) -- cgit v1.2.3