forked from OSchip/llvm-project
[arcmt] Remove '-arcmt-modify-in-memory', it turned out less useful than we hoped it would be.
llvm-svn: 133315
This commit is contained in:
parent
804e6d191b
commit
1240f4e53a
|
@ -41,12 +41,6 @@ bool applyTransformations(CompilerInvocation &origCI,
|
||||||
llvm::StringRef Filename, InputKind Kind,
|
llvm::StringRef Filename, InputKind Kind,
|
||||||
DiagnosticClient *DiagClient);
|
DiagnosticClient *DiagClient);
|
||||||
|
|
||||||
/// \brief Like applyTransformations but no source file is modified, compilation
|
|
||||||
/// happens using in-memory buffers.
|
|
||||||
bool applyTransformationsInMemory(CompilerInvocation &origCI,
|
|
||||||
llvm::StringRef Filename, InputKind Kind,
|
|
||||||
DiagnosticClient *DiagClient);
|
|
||||||
|
|
||||||
typedef void (*TransformFn)(MigrationPass &pass);
|
typedef void (*TransformFn)(MigrationPass &pass);
|
||||||
|
|
||||||
std::vector<TransformFn> getAllTransformations();
|
std::vector<TransformFn> getAllTransformations();
|
||||||
|
|
|
@ -32,14 +32,6 @@ public:
|
||||||
TransformationAction(FrontendAction *WrappedAction);
|
TransformationAction(FrontendAction *WrappedAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
class InMemoryTransformationAction : public WrapperFrontendAction {
|
|
||||||
protected:
|
|
||||||
virtual void ExecuteAction();
|
|
||||||
|
|
||||||
public:
|
|
||||||
InMemoryTransformationAction(FrontendAction *WrappedAction);
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -387,8 +387,6 @@ def arcmt_check : Flag<"-arcmt-check">,
|
||||||
HelpText<"Check for ARC migration issues that need manual handling">;
|
HelpText<"Check for ARC migration issues that need manual handling">;
|
||||||
def arcmt_modify : Flag<"-arcmt-modify">,
|
def arcmt_modify : Flag<"-arcmt-modify">,
|
||||||
HelpText<"Apply modifications to files to conform to ARC">;
|
HelpText<"Apply modifications to files to conform to ARC">;
|
||||||
def arcmt_modify_in_memory : Flag<"-arcmt-modify-in-memory">,
|
|
||||||
HelpText<"Apply ARC conforming modifications & compile using memory buffers">;
|
|
||||||
|
|
||||||
def import_module : Separate<"-import-module">,
|
def import_module : Separate<"-import-module">,
|
||||||
HelpText<"Import a module definition file">;
|
HelpText<"Import a module definition file">;
|
||||||
|
|
|
@ -116,8 +116,6 @@ def ccc_arrmt_check : Flag<"-ccc-arrmt-check">, CCCDriverOpt,
|
||||||
HelpText<"Check for ARC migration issues that need manual handling">;
|
HelpText<"Check for ARC migration issues that need manual handling">;
|
||||||
def ccc_arrmt_modify : Flag<"-ccc-arrmt-modify">, CCCDriverOpt,
|
def ccc_arrmt_modify : Flag<"-ccc-arrmt-modify">, CCCDriverOpt,
|
||||||
HelpText<"Apply modifications to files to conform to ARC">;
|
HelpText<"Apply modifications to files to conform to ARC">;
|
||||||
def ccc_arrmt_modify_in_memory : Flag<"-ccc-arrmt-modify-in-memory">,
|
|
||||||
HelpText<"Apply ARC conforming modifications & compile using memory buffers">;
|
|
||||||
|
|
||||||
// Make sure all other -ccc- options are rejected.
|
// Make sure all other -ccc- options are rejected.
|
||||||
def ccc_ : Joined<"-ccc-">, Group<ccc_Group>, Flags<[Unsupported]>;
|
def ccc_ : Joined<"-ccc-">, Group<ccc_Group>, Flags<[Unsupported]>;
|
||||||
|
|
|
@ -80,8 +80,7 @@ public:
|
||||||
enum {
|
enum {
|
||||||
ARCMT_None,
|
ARCMT_None,
|
||||||
ARCMT_Check,
|
ARCMT_Check,
|
||||||
ARCMT_Modify,
|
ARCMT_Modify
|
||||||
ARCMT_ModifyInMemory
|
|
||||||
} ARCMTAction;
|
} ARCMTAction;
|
||||||
|
|
||||||
/// The input files and their types.
|
/// The input files and their types.
|
||||||
|
|
|
@ -276,41 +276,6 @@ bool arcmt::applyTransformations(CompilerInvocation &origCI,
|
||||||
return migration.getRemapper().overwriteOriginal(*Diags);
|
return migration.getRemapper().overwriteOriginal(*Diags);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
// applyTransformationsInMemory.
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
bool arcmt::applyTransformationsInMemory(CompilerInvocation &origCI,
|
|
||||||
llvm::StringRef Filename, InputKind Kind,
|
|
||||||
DiagnosticClient *DiagClient) {
|
|
||||||
if (!origCI.getLangOpts().ObjC1)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Make sure checking is successful first.
|
|
||||||
CompilerInvocation CInvokForCheck(origCI);
|
|
||||||
if (arcmt::checkForManualIssues(CInvokForCheck, Filename, Kind, DiagClient))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
CompilerInvocation CInvok(origCI);
|
|
||||||
CInvok.getFrontendOpts().Inputs.clear();
|
|
||||||
CInvok.getFrontendOpts().Inputs.push_back(std::make_pair(Kind, Filename));
|
|
||||||
|
|
||||||
MigrationProcess migration(CInvok, DiagClient);
|
|
||||||
|
|
||||||
std::vector<TransformFn> transforms = arcmt::getAllTransformations();
|
|
||||||
assert(!transforms.empty());
|
|
||||||
|
|
||||||
for (unsigned i=0, e = transforms.size(); i != e; ++i) {
|
|
||||||
bool err = migration.applyTransform(transforms[i]);
|
|
||||||
if (err) return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
origCI.getLangOpts().ObjCAutoRefCount = true;
|
|
||||||
migration.getRemapper().transferMappingsAndClear(origCI);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// CollectTransformActions.
|
// CollectTransformActions.
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
|
@ -41,18 +41,3 @@ void TransformationAction::ExecuteAction() {
|
||||||
|
|
||||||
TransformationAction::TransformationAction(FrontendAction *WrappedAction)
|
TransformationAction::TransformationAction(FrontendAction *WrappedAction)
|
||||||
: WrapperFrontendAction(WrappedAction) {}
|
: WrapperFrontendAction(WrappedAction) {}
|
||||||
|
|
||||||
void InMemoryTransformationAction::ExecuteAction() {
|
|
||||||
CompilerInstance &CI = getCompilerInstance();
|
|
||||||
if (arcmt::applyTransformationsInMemory(CI.getInvocation(), getCurrentFile(),
|
|
||||||
getCurrentFileKind(),
|
|
||||||
CI.getDiagnostics().getClient()))
|
|
||||||
return;
|
|
||||||
|
|
||||||
WrapperFrontendAction::ExecuteAction();
|
|
||||||
}
|
|
||||||
|
|
||||||
InMemoryTransformationAction::InMemoryTransformationAction(
|
|
||||||
FrontendAction *WrappedAction)
|
|
||||||
: WrapperFrontendAction(WrappedAction) {}
|
|
||||||
|
|
||||||
|
|
|
@ -1391,8 +1391,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
||||||
|
|
||||||
if (!Args.hasArg(options::OPT_fno_objc_arc)) {
|
if (!Args.hasArg(options::OPT_fno_objc_arc)) {
|
||||||
if (const Arg *A = Args.getLastArg(options::OPT_ccc_arrmt_check,
|
if (const Arg *A = Args.getLastArg(options::OPT_ccc_arrmt_check,
|
||||||
options::OPT_ccc_arrmt_modify,
|
options::OPT_ccc_arrmt_modify)) {
|
||||||
options::OPT_ccc_arrmt_modify_in_memory)) {
|
|
||||||
switch (A->getOption().getID()) {
|
switch (A->getOption().getID()) {
|
||||||
default:
|
default:
|
||||||
llvm_unreachable("missed a case");
|
llvm_unreachable("missed a case");
|
||||||
|
@ -1402,9 +1401,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
||||||
case options::OPT_ccc_arrmt_modify:
|
case options::OPT_ccc_arrmt_modify:
|
||||||
CmdArgs.push_back("-arcmt-modify");
|
CmdArgs.push_back("-arcmt-modify");
|
||||||
break;
|
break;
|
||||||
case options::OPT_ccc_arrmt_modify_in_memory:
|
|
||||||
CmdArgs.push_back("-arcmt-modify-in-memory");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -424,9 +424,6 @@ static void FrontendOptsToArgs(const FrontendOptions &Opts,
|
||||||
case FrontendOptions::ARCMT_Modify:
|
case FrontendOptions::ARCMT_Modify:
|
||||||
Res.push_back("-arcmt-modify");
|
Res.push_back("-arcmt-modify");
|
||||||
break;
|
break;
|
||||||
case FrontendOptions::ARCMT_ModifyInMemory:
|
|
||||||
Res.push_back("-arcmt-modify-in-memory");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NeedLang = false;
|
bool NeedLang = false;
|
||||||
|
@ -1242,8 +1239,7 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
|
||||||
|
|
||||||
Opts.ARCMTAction = FrontendOptions::ARCMT_None;
|
Opts.ARCMTAction = FrontendOptions::ARCMT_None;
|
||||||
if (const Arg *A = Args.getLastArg(OPT_arcmt_check,
|
if (const Arg *A = Args.getLastArg(OPT_arcmt_check,
|
||||||
OPT_arcmt_modify,
|
OPT_arcmt_modify)) {
|
||||||
OPT_arcmt_modify_in_memory)) {
|
|
||||||
switch (A->getOption().getID()) {
|
switch (A->getOption().getID()) {
|
||||||
default:
|
default:
|
||||||
llvm_unreachable("missed a case");
|
llvm_unreachable("missed a case");
|
||||||
|
@ -1253,9 +1249,6 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
|
||||||
case OPT_arcmt_modify:
|
case OPT_arcmt_modify:
|
||||||
Opts.ARCMTAction = FrontendOptions::ARCMT_Modify;
|
Opts.ARCMTAction = FrontendOptions::ARCMT_Modify;
|
||||||
break;
|
break;
|
||||||
case OPT_arcmt_modify_in_memory:
|
|
||||||
Opts.ARCMTAction = FrontendOptions::ARCMT_ModifyInMemory;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,9 +100,6 @@ static FrontendAction *CreateFrontendAction(CompilerInstance &CI) {
|
||||||
case FrontendOptions::ARCMT_Modify:
|
case FrontendOptions::ARCMT_Modify:
|
||||||
Act = new arcmt::TransformationAction(Act);
|
Act = new arcmt::TransformationAction(Act);
|
||||||
break;
|
break;
|
||||||
case FrontendOptions::ARCMT_ModifyInMemory:
|
|
||||||
Act = new arcmt::InMemoryTransformationAction(Act);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there are any AST files to merge, create a frontend action
|
// If there are any AST files to merge, create a frontend action
|
||||||
|
|
Loading…
Reference in New Issue