mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Macros] Add frontend flag to dump macro expansions for diagnostics.
Add frontend flag `-emit-macro-expansion-files diagnostics` to emit any macro expansion buffers referenced by diagnostics into files in a temporary directory. This makes debugging type-checking failures in macro expansions far easier, because you can see them after the compiler process has exited.
This commit is contained in:
@@ -1476,6 +1476,15 @@ static bool ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,
|
||||
}
|
||||
}
|
||||
|
||||
for (const Arg *arg: Args.filtered(OPT_emit_macro_expansion_files)) {
|
||||
StringRef contents = arg->getValue();
|
||||
bool negated = contents.startswith("no-");
|
||||
if (negated)
|
||||
contents = contents.drop_front(3);
|
||||
if (contents == "diagnostics")
|
||||
Opts.EmitMacroExpansionFiles = !negated;
|
||||
}
|
||||
|
||||
Opts.FixitCodeForAllDiagnostics |= Args.hasArg(OPT_fixit_all);
|
||||
Opts.SuppressWarnings |= Args.hasArg(OPT_suppress_warnings);
|
||||
Opts.SuppressRemarks |= Args.hasArg(OPT_suppress_remarks);
|
||||
|
||||
Reference in New Issue
Block a user