-
Notifications
You must be signed in to change notification settings - Fork 645
Add option to suppress emission of source locators #5053
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
Conversation
seldridge
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Some nits. Take them or leave them.
| if (!suppressSourceInfo) { | ||
| info match { | ||
| case _: NoSourceInfo => () | ||
| case sl: SourceLine => | ||
| b ++= " @["; b ++= fir.FileInfo.fromUnescaped(sl.serialize).escaped; b ++= "]" | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: consider early return to avoid indentation.
| val argsWithFlag: Array[String] = argsWithoutFlag ++ Array("--no-source-info") | ||
|
|
||
| // First, generate CHIRRTL without the flag to verify source info is present | ||
| (new ChiselStage) | ||
| .execute( | ||
| argsWithoutFlag, | ||
| Seq(ChiselGeneratorAnnotation(() => new ChiselStageSpec.Foo)) | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be cleaner using the non-execute formulation and not writing to disk:
ChiselStage.emitCHIRRTL(new ChiselStageSpec.Foo).fileCheck()("CHECK: @[")Similarly, the second test is then just:
ChiselStage.emitCHIRRTL(new ChiselStageSpec.Foo, Array("--no-source-info")).fileCheck()("CHECK-NOT: @[")| override def mimaBinaryIssueFilters = super.mimaBinaryIssueFilters() ++ Seq( | ||
| // chisel3.internal.firrtl.ir is package private | ||
| ProblemFilter.exclude[DirectMissingMethodProblem]("chisel3.internal.firrtl.ir*"), | ||
| ProblemFilter.exclude[MissingTypesProblem]("chisel3.internal.firrtl.ir*") | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! I was running into this elsewhere...
Contributor Checklist
docs/src?Type of Improvement
Desired Merge Strategy
Release Notes
Users can now pass
--no-source-infoto suppress emission of source locators in emitted.fir.Reviewer Checklist (only modified by reviewer)
3.6.x,5.x, or6.xdepending on impact, API modification or big change:7.0)?Enable auto-merge (squash)and clean up the commit message.Create a merge commit.