arc migrator: Added an option to the migrator
unused yet. llvm-svn: 149001
This commit is contained in:
parent
154aabc0c4
commit
0c859d67ef
|
@ -106,6 +106,9 @@ def analyzer_checker_help : Flag<"-analyzer-checker-help">,
|
||||||
def migrator_no_nsalloc_error : Flag<"-no-ns-alloc-error">,
|
def migrator_no_nsalloc_error : Flag<"-no-ns-alloc-error">,
|
||||||
HelpText<"Do not error on use of NSAllocateCollectable/NSReallocateCollectable">;
|
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
|
// CodeGen Options
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
|
@ -20,8 +20,10 @@ namespace clang {
|
||||||
class MigratorOptions {
|
class MigratorOptions {
|
||||||
public:
|
public:
|
||||||
unsigned NoNSAllocReallocError : 1;
|
unsigned NoNSAllocReallocError : 1;
|
||||||
|
unsigned NoFinalizeRemoval : 1;
|
||||||
MigratorOptions() {
|
MigratorOptions() {
|
||||||
NoNSAllocReallocError = 0;
|
NoNSAllocReallocError = 0;
|
||||||
|
NoFinalizeRemoval = 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -230,6 +230,7 @@ bool arcmt::checkForManualIssues(CompilerInvocation &origCI,
|
||||||
|
|
||||||
LangOptions::GCMode OrigGCMode = origCI.getLangOpts()->getGC();
|
LangOptions::GCMode OrigGCMode = origCI.getLangOpts()->getGC();
|
||||||
bool NoNSAllocReallocError = origCI.getMigratorOpts().NoNSAllocReallocError;
|
bool NoNSAllocReallocError = origCI.getMigratorOpts().NoNSAllocReallocError;
|
||||||
|
bool NoFinalizeRemoval = origCI.getMigratorOpts().NoFinalizeRemoval;
|
||||||
|
|
||||||
std::vector<TransformFn> transforms = arcmt::getAllTransformations(OrigGCMode);
|
std::vector<TransformFn> transforms = arcmt::getAllTransformations(OrigGCMode);
|
||||||
assert(!transforms.empty());
|
assert(!transforms.empty());
|
||||||
|
@ -294,6 +295,7 @@ bool arcmt::checkForManualIssues(CompilerInvocation &origCI,
|
||||||
TransformActions testAct(*Diags, capturedDiags, Ctx, Unit->getPreprocessor());
|
TransformActions testAct(*Diags, capturedDiags, Ctx, Unit->getPreprocessor());
|
||||||
MigrationPass pass(Ctx, OrigGCMode, Unit->getSema(), testAct, ARCMTMacroLocs);
|
MigrationPass pass(Ctx, OrigGCMode, Unit->getSema(), testAct, ARCMTMacroLocs);
|
||||||
pass.setNSAllocReallocError(NoNSAllocReallocError);
|
pass.setNSAllocReallocError(NoNSAllocReallocError);
|
||||||
|
pass.setNoFinalizeRemoval(NoFinalizeRemoval);
|
||||||
|
|
||||||
for (unsigned i=0, e = transforms.size(); i != e; ++i)
|
for (unsigned i=0, e = transforms.size(); i != e; ++i)
|
||||||
transforms[i](pass);
|
transforms[i](pass);
|
||||||
|
|
|
@ -155,6 +155,8 @@ public:
|
||||||
bool isGCMigration() const { return OrigGCMode != LangOptions::NonGC; }
|
bool isGCMigration() const { return OrigGCMode != LangOptions::NonGC; }
|
||||||
bool noNSAllocReallocError() const { return MigOptions.NoNSAllocReallocError; }
|
bool noNSAllocReallocError() const { return MigOptions.NoNSAllocReallocError; }
|
||||||
void setNSAllocReallocError(bool val) { MigOptions.NoNSAllocReallocError = val; }
|
void setNSAllocReallocError(bool val) { MigOptions.NoNSAllocReallocError = val; }
|
||||||
|
bool noFinalizeRemoval() const { return MigOptions.NoFinalizeRemoval; }
|
||||||
|
void setNoFinalizeRemoval(bool val) {MigOptions.NoFinalizeRemoval = val; }
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline StringRef getARCMTMacroName() {
|
static inline StringRef getARCMTMacroName() {
|
||||||
|
|
Loading…
Reference in New Issue