aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2012-01-26 00:08:04 +0000
committerFariborz Jahanian <fjahanian@apple.com>2012-01-26 00:08:04 +0000
commit26f0e4e7ab534fb42485c930f20a424ecc8c9830 (patch)
tree74866a9384ed5e4353c35b15e18b5ccc3cb8abaa
parentbac341346f3c8e713a8f165120fd54b500ee3189 (diff)
arc migrator: Added an option to the migrator
unused yet. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149001 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Driver/CC1Options.td3
-rw-r--r--include/clang/Frontend/MigratorOptions.h2
-rw-r--r--lib/ARCMigrate/ARCMT.cpp2
-rw-r--r--lib/ARCMigrate/Internals.h2
4 files changed, 9 insertions, 0 deletions
diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td
index 86457d9e78..1125ddd603 100644
--- a/include/clang/Driver/CC1Options.td
+++ b/include/clang/Driver/CC1Options.td
@@ -106,6 +106,9 @@ def analyzer_checker_help : Flag<"-analyzer-checker-help">,
def migrator_no_nsalloc_error : Flag<"-no-ns-alloc-error">,
HelpText<"Do not error on use of NSAllocateCollectable/NSReallocateCollectable">;
+def migrator_no_finalize_removal : Flag<"-no-finalize-removal">,
+ HelpText<"Do not remove finalize method in gc mode">;
+
//===----------------------------------------------------------------------===//
// CodeGen Options
//===----------------------------------------------------------------------===//
diff --git a/include/clang/Frontend/MigratorOptions.h b/include/clang/Frontend/MigratorOptions.h
index 23263d7aa0..f9554e4a61 100644
--- a/include/clang/Frontend/MigratorOptions.h
+++ b/include/clang/Frontend/MigratorOptions.h
@@ -20,8 +20,10 @@ namespace clang {
class MigratorOptions {
public:
unsigned NoNSAllocReallocError : 1;
+ unsigned NoFinalizeRemoval : 1;
MigratorOptions() {
NoNSAllocReallocError = 0;
+ NoFinalizeRemoval = 0;
}
};
diff --git a/lib/ARCMigrate/ARCMT.cpp b/lib/ARCMigrate/ARCMT.cpp
index 09752f0d61..cd4835ef39 100644
--- a/lib/ARCMigrate/ARCMT.cpp
+++ b/lib/ARCMigrate/ARCMT.cpp
@@ -230,6 +230,7 @@ bool arcmt::checkForManualIssues(CompilerInvocation &origCI,
LangOptions::GCMode OrigGCMode = origCI.getLangOpts()->getGC();
bool NoNSAllocReallocError = origCI.getMigratorOpts().NoNSAllocReallocError;
+ bool NoFinalizeRemoval = origCI.getMigratorOpts().NoFinalizeRemoval;
std::vector<TransformFn> transforms = arcmt::getAllTransformations(OrigGCMode);
assert(!transforms.empty());
@@ -294,6 +295,7 @@ bool arcmt::checkForManualIssues(CompilerInvocation &origCI,
TransformActions testAct(*Diags, capturedDiags, Ctx, Unit->getPreprocessor());
MigrationPass pass(Ctx, OrigGCMode, Unit->getSema(), testAct, ARCMTMacroLocs);
pass.setNSAllocReallocError(NoNSAllocReallocError);
+ pass.setNoFinalizeRemoval(NoFinalizeRemoval);
for (unsigned i=0, e = transforms.size(); i != e; ++i)
transforms[i](pass);
diff --git a/lib/ARCMigrate/Internals.h b/lib/ARCMigrate/Internals.h
index 78bf341fe6..59177c483e 100644
--- a/lib/ARCMigrate/Internals.h
+++ b/lib/ARCMigrate/Internals.h
@@ -155,6 +155,8 @@ public:
bool isGCMigration() const { return OrigGCMode != LangOptions::NonGC; }
bool noNSAllocReallocError() const { return MigOptions.NoNSAllocReallocError; }
void setNSAllocReallocError(bool val) { MigOptions.NoNSAllocReallocError = val; }
+ bool noFinalizeRemoval() const { return MigOptions.NoFinalizeRemoval; }
+ void setNoFinalizeRemoval(bool val) {MigOptions.NoFinalizeRemoval = val; }
};
static inline StringRef getARCMTMacroName() {