[Printer] Update printSIL to make sure LLDB doesn't break.

For more context, see:
1. https://github.com/apple/swift/pull/29239 - original PR which introduced
   the change, including an LLDB-side change.
2. The immediately preceding commit, which reverted this change.
3. https://github.com/apple/swift/pull/29350 which revealed some breakage
   caused by the changes in PR 29239 (unrelated to printing).
This commit is contained in:
Varun Gandhi
2020-01-22 07:41:20 -08:00
parent ae358842dc
commit f6643af650
6 changed files with 43 additions and 23 deletions

View File

@@ -166,10 +166,10 @@ private:
/// Functions, which are dead (and not in the functions list anymore),
/// but kept alive for debug info generation.
FunctionListType zombieFunctions;
/// Stores the names of zombie functions.
llvm::BumpPtrAllocator zombieFunctionNames;
/// Lookup table for SIL vtables from class decls.
llvm::DenseMap<const ClassDecl *, SILVTable *> VTableMap;
@@ -211,7 +211,7 @@ private:
// The map of SILCoverageMaps in the module.
CoverageMapCollectionType coverageMaps;
// The list of SILProperties in the module.
PropertyListType properties;
@@ -502,7 +502,7 @@ public:
PropertyListType &getPropertyList() { return properties; }
const PropertyListType &getPropertyList() const { return properties; }
/// Look for a global variable by name.
///
/// \return null if this module has no such global variable
@@ -630,7 +630,7 @@ public:
/// Pretty-print the module.
void dump(bool Verbose = false) const;
/// Pretty-print the module to a file.
/// Useful for dumping the module when running in a debugger.
/// Warning: no error handling is done. Fails with an assert if the file
@@ -643,11 +643,14 @@ public:
/// \param M If present, the types and declarations from this module will be
/// printed. The module would usually contain the types and Decls that
/// the SIL module depends on.
/// \param Opts The SIL options, used to determine printing verbosity and
/// and sorting.
/// \param PrintASTDecls If set to true print AST decls.
void print(raw_ostream &OS, bool Verbose = false,
ModuleDecl *M = nullptr, bool ShouldSort = false,
void print(raw_ostream& OS,
ModuleDecl *M = nullptr,
const SILOptions &Opts = SILOptions(),
bool PrintASTDecls = true) const {
SILPrintContext PrintCtx(OS, Verbose, ShouldSort);
SILPrintContext PrintCtx(OS, Opts);
print(PrintCtx, M, PrintASTDecls);
}