[Printer] Conditionally print Clang types in emitted SIL.

Hopefully, this helps us debug Clang type mismatches better.
This commit is contained in:
Varun Gandhi
2020-01-15 16:15:44 -08:00
parent 5f45820755
commit a27c5f0a16
15 changed files with 86 additions and 37 deletions

View File

@@ -13,6 +13,7 @@
#ifndef SWIFT_SIL_PRINTCONTEXT_H
#define SWIFT_SIL_PRINTCONTEXT_H
#include "swift/AST/SILOptions.h"
#include "swift/SIL/SILDebugScope.h"
#include "swift/SIL/SILValue.h"
#include "llvm/ADT/DenseMap.h"
@@ -65,6 +66,9 @@ protected:
/// Print debug locations and scopes.
bool DebugInfo;
/// See \ref FrontendOptions.PrintFullConvention.
bool PrintFullConvention;
public:
/// Constructor with default values for options.
///
@@ -72,6 +76,11 @@ public:
SILPrintContext(llvm::raw_ostream &OS, bool Verbose = false,
bool SortedSIL = false);
/// Constructor based on SILOptions.
///
/// DebugInfo will be set according to the -sil-print-debuginfo option.
SILPrintContext(llvm::raw_ostream &OS, const SILOptions &Opts);
SILPrintContext(llvm::raw_ostream &OS, bool Verbose,
bool SortedSIL, bool DebugInfo);
@@ -94,6 +103,9 @@ public:
/// Returns true if debug locations and scopes should be printed.
bool printDebugInfo() const { return DebugInfo; }
/// Returns true if the entire @convention(c, cType: ..) should be printed.
bool printFullConvention() const { return PrintFullConvention; }
SILPrintContext::ID getID(const SILBasicBlock *Block);
SILPrintContext::ID getID(const SILNode *node);