Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Unified Diff: tools/boilerplate.py

Issue 2727903004: Update boilerplate.py to add ARC header guards to iOS ObjCpp files. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/boilerplate.py
diff --git a/tools/boilerplate.py b/tools/boilerplate.py
index ada43a0863cf28ece323682c203ffdd6a26a9c98..8d6343853d374453e9115091195f7d96871846c3 100755
--- a/tools/boilerplate.py
+++ b/tools/boilerplate.py
@@ -60,12 +60,28 @@ def _RemoveTestSuffix(filename):
return base[:-l]
return base
+
+def _IsIOSFile(filename):
+ if os.path.splitext(os.path.basename(filename))[0].endswith('_ios'):
+ return True
+ if 'ios' in filename.split(os.path.sep):
+ return True
+ return False
+
+
def _CppImplementation(filename):
return '\n#include "' + _RemoveTestSuffix(filename) + '.h"\n'
def _ObjCppImplementation(filename):
- return '\n#import "' + _RemoveTestSuffix(filename) + '.h"\n'
+ implementation = '\n#import "' + _RemoveTestSuffix(filename) + '.h"\n'
+ if not _IsIOSFile(filename):
+ return implementation
+ implementation += '\n'
+ implementation += '#if !defined(__has_feature) || !__has_feature(objc_arc)\n'
+ implementation += '#error "This file requires ARC support."\n'
+ implementation += '#endif\n'
+ return implementation
def _CreateFile(filename):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698