[driver] Remove the 'swift-fixit' symlink and introduce '-emit-fixits-path' frontend option that

writes compiler fixits as source edits.

Driver option '-fixit-code' adds '-emit-fixits-path' for all the frontend invocations.

Swift SVN r27208
This commit is contained in:
Argyrios Kyrtzidis
2015-04-10 17:33:29 +00:00
parent 4e6efcb617
commit 8b250d6d35
22 changed files with 176 additions and 258 deletions

View File

@@ -46,6 +46,8 @@ ERROR(error_no_frontend_args, frontend, none,
ERROR(error_no_such_file_or_directory,frontend,none,
"no such file or directory: '%0'", (StringRef))
ERROR(cannot_open_file,frontend,none,
"cannot open file '%0' (%1)", (StringRef, StringRef))
ERROR(cannot_open_serialized_file,frontend,none,
"cannot open file '%0' for diagnostics emission (%1)", (StringRef, StringRef))
ERROR(error_open_input_file,frontend,none,

View File

@@ -68,9 +68,6 @@ public:
/// Invoke swift-update with the compiler frontend options.
UpdateCode,
/// Invoke swift-fixit with the compiler frontend options.
FixCode,
};
/// The mode in which the driver should invoke the frontend.
@@ -99,6 +96,9 @@ public:
/// Whether the compiler picked the current module name, rather than the user.
bool ModuleNameIsFallback = false;
// Whether the driver should generate compiler fixits as source edits.
bool ShouldGenerateFixitEdits = false;
/// The number of threads for multi-threaded compilation.
unsigned numThreads = 0;
@@ -121,7 +121,6 @@ public:
enum class DriverKind {
Interactive, // swift
Batch, // swiftc
FixCode, // swift-fixit
AutolinkExtract, // swift-autolink-extract
};

View File

@@ -112,6 +112,9 @@ public:
/// The path to which we should output a Swift reference dependencies file.
std::string ReferenceDependenciesFilePath;
/// The path to which we should output a fixits as source edits.
std::string FixitsOutputPath;
/// Arguments which should be passed in immediate mode.
std::vector<std::string> ImmediateArgv;

View File

@@ -49,6 +49,10 @@ def serialize_diagnostics_path
: Separate<["-"], "serialize-diagnostics-path">, MetaVarName<"<path>">,
HelpText<"Output serialized diagnostics to <path>">;
def emit_fixits_path
: Separate<["-"], "emit-fixits-path">, MetaVarName<"<path>">,
HelpText<"Output compiler fixits as source edits to <path>">;
def verify : Flag<["-"], "verify">,
HelpText<"Verify diagnostics against expected-{error|warning|note} "
"annotations">;

View File

@@ -84,7 +84,7 @@ def driver_use_frontend_path : Separate<["-"], "driver-use-frontend-path">,
HelpText<"Use the given executable to perform compilations">;
def driver_mode : Joined<["--"], "driver-mode=">, Flags<[HelpHidden]>,
HelpText<"Set the driver mode to either 'swift' or 'swiftc' or 'swift-fixit'">;
HelpText<"Set the driver mode to either 'swift' or 'swiftc'">;
def help : Flag<["-", "--"], "help">,
Flags<[FrontendOption, AutolinkExtractOption]>,
@@ -336,8 +336,8 @@ def update_code : Flag<["-"], "update-code">,
Flags<[HelpHidden, NoInteractiveOption, DoesNotAffectIncrementalBuild]>;
def fixit_code : Flag<["-"], "fixit-code">,
HelpText<"Get compiler fixits as code edits">, ModeOpt,
Flags<[HelpHidden, NoInteractiveOption, DoesNotAffectIncrementalBuild]>;
HelpText<"Get compiler fixits as code edits">,
Flags<[NoInteractiveOption, DoesNotAffectIncrementalBuild]>;
// No Output Modes
def parse : Flag<["-"], "parse">,