Skip to content

Adds -Xprint-phases #7508

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions compiler/src/dotty/tools/dotc/config/CompilerCommand.scala
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ object CompilerCommand {
}

def isStandard(s: Setting[?]): Boolean = !isAdvanced(s) && !isPrivate(s)
def isAdvanced(s: Setting[?]): Boolean = s.name startsWith "-X"
def isPrivate(s: Setting[?]) : Boolean = s.name startsWith "-Y"
def isAdvanced(s: Setting[?]): Boolean = s.name.startsWith("-X") && s.name != "-X"
def isPrivate(s: Setting[?]) : Boolean = s.name.startsWith("-Y") && s.name != "-Y"

/** Messages explaining usage and options */
def usageMessage = createUsageMsg("where possible standard", shouldExplain = false, isStandard)
Expand All @@ -112,7 +112,14 @@ object CompilerCommand {

def shouldStopWithInfo = {
import settings._
Set(help, Xhelp, Yhelp, showPlugins) exists (_.value)
Set(help, Xhelp, Yhelp, showPlugins, XshowPhases) exists (_.value)
}

def phasesMessage: String = {
(new Compiler()).phases.map {
case List(single) => single.phaseName
case more => more.map(_.phaseName).mkString("{", ", ", "}")
}.mkString("\n")
}

def infoMessage: String = {
Expand All @@ -121,6 +128,7 @@ object CompilerCommand {
else if (Xhelp.value) xusageMessage
else if (Yhelp.value) yusageMessage
else if (showPlugins.value) ctx.pluginDescriptions
else if (XshowPhases.value) phasesMessage
else ""
}

Expand Down
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/config/ScalaSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ class ScalaSettings extends Settings.SettingGroup {
val XprintTypes: Setting[Boolean] = BooleanSetting("-Xprint-types", "Print tree types (debugging option).")
val XprintDiff: Setting[Boolean] = BooleanSetting("-Xprint-diff", "Print changed parts of the tree since last print.")
val XprintDiffDel: Setting[Boolean] = BooleanSetting("-Xprint-diff-del", "Print changed parts of the tree since last print including deleted parts.")
val XprintInline: Setting[Boolean] = BooleanSetting("-Xprint-inline", "Show where inlined code comes from")
val XprintInline: Setting[Boolean] = BooleanSetting("-Xprint-inline", "Show where inlined code comes from")
val XprintSuspension: Setting[Boolean] = BooleanSetting("-Xprint-suspension", "Show when code is suspended until macros are compiled")
val Xprompt: Setting[Boolean] = BooleanSetting("-Xprompt", "Display a prompt after each error (debugging option).")
val XshowPhases: Setting[Boolean] = BooleanSetting("-Xshow-phases", "Print all compiler phases")
val XnoValueClasses: Setting[Boolean] = BooleanSetting("-Xno-value-classes", "Do not use value classes. Helps debugging.")
val XreplLineWidth: Setting[Int] = IntSetting("-Xrepl-line-width", "Maximal number of columns per line for REPL output", 390)
val XfatalWarnings: Setting[Boolean] = BooleanSetting("-Xfatal-warnings", "Fail the compilation if there are any warnings.")
Expand Down