mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Printer] Conditionally print Clang types in emitted SIL.
Hopefully, this helps us debug Clang type mismatches better.
This commit is contained in:
@@ -101,10 +101,10 @@ static llvm::cl::opt<std::string> Triple("target",
|
||||
llvm::cl::desc("target triple"));
|
||||
|
||||
static llvm::cl::opt<bool>
|
||||
EnableSILSortOutput("emit-sorted-sil", llvm::cl::Hidden,
|
||||
llvm::cl::init(false),
|
||||
llvm::cl::desc("Sort Functions, VTables, Globals, "
|
||||
"WitnessTables by name to ease diffing."));
|
||||
EmitSortedSIL("emit-sorted-sil", llvm::cl::Hidden,
|
||||
llvm::cl::init(false),
|
||||
llvm::cl::desc("Sort Functions, VTables, Globals, "
|
||||
"WitnessTables by name to ease diffing."));
|
||||
|
||||
static llvm::cl::opt<bool>
|
||||
DisableASTDump("sil-disable-ast-dump", llvm::cl::Hidden,
|
||||
@@ -250,6 +250,10 @@ int main(int argc, char **argv) {
|
||||
Invocation.getLangOptions().EnableAccessControl = false;
|
||||
Invocation.getLangOptions().EnableObjCAttrRequiresFoundation = false;
|
||||
|
||||
SILOptions &Opts = Invocation.getSILOptions();
|
||||
Opts.EmitVerboseSIL = EmitVerboseSIL;
|
||||
Opts.EmitSortedSIL = EmitSortedSIL;
|
||||
|
||||
serialization::ExtendedValidationInfo extendedInfo;
|
||||
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> FileBufOrErr =
|
||||
Invocation.setUpInputForSILTool(InputFilename, ModuleName,
|
||||
@@ -356,8 +360,8 @@ int main(int argc, char **argv) {
|
||||
OutputFilename.size() ? StringRef(OutputFilename) : "-";
|
||||
|
||||
if (OutputFile == "-") {
|
||||
CI.getSILModule()->print(llvm::outs(), EmitVerboseSIL, CI.getMainModule(),
|
||||
EnableSILSortOutput, !DisableASTDump);
|
||||
CI.getSILModule()->print(llvm::outs(), CI.getMainModule(),
|
||||
Invocation.getSILOptions(), !DisableASTDump);
|
||||
} else {
|
||||
std::error_code EC;
|
||||
llvm::raw_fd_ostream OS(OutputFile, EC, llvm::sys::fs::F_None);
|
||||
@@ -366,8 +370,8 @@ int main(int argc, char **argv) {
|
||||
<< '\n';
|
||||
return 1;
|
||||
}
|
||||
CI.getSILModule()->print(OS, EmitVerboseSIL, CI.getMainModule(),
|
||||
EnableSILSortOutput, !DisableASTDump);
|
||||
CI.getSILModule()->print(OS, CI.getMainModule(),
|
||||
Invocation.getSILOptions(), !DisableASTDump);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user