diff options
| author | Kevin Laeufer | 2020-07-15 12:21:26 -0700 |
|---|---|---|
| committer | GitHub | 2020-07-15 19:21:26 +0000 |
| commit | 24be0ac3121e8f5d7b4bf8d6247e305ed0f0a656 (patch) | |
| tree | 9acbdf85c86985921a84fa329838062a78e71588 /src/main/scala/firrtl/Visitor.scala | |
| parent | 005a3d1644742029e744a64c2d9c452969bc64ff (diff) | |
ir: store FileInfo string in escaped format (#1690)
This should speed up the common case
as the compiler never operates on the
unescaped string.
The new escape function also fixes a bug
where ']' was not escaped even though it
is the delimiting character for FileInfo.
In order to maintain backwards
compatibility for the ProtoBuf format,
this patch adds escape/unescape calls
when going from/to protobuf format.
For better performance we should consider
changing the protobuf format.
Diffstat (limited to 'src/main/scala/firrtl/Visitor.scala')
| -rw-r--r-- | src/main/scala/firrtl/Visitor.scala | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main/scala/firrtl/Visitor.scala b/src/main/scala/firrtl/Visitor.scala index 76b5c2cf..8bdab21b 100644 --- a/src/main/scala/firrtl/Visitor.scala +++ b/src/main/scala/firrtl/Visitor.scala @@ -69,15 +69,15 @@ class Visitor(infoMode: InfoMode) extends AbstractParseTreeVisitor[FirrtlNode] w infoMode match { case UseInfo => if (useInfo.length == 0) NoInfo - else ir.FileInfo(ir.StringLit.unescape(useInfo)) + else ir.FileInfo.fromEscaped(useInfo) case AppendInfo(filename) if (useInfo.length == 0) => - ir.FileInfo(ir.StringLit.unescape(genInfo(filename))) + ir.FileInfo.fromEscaped(genInfo(filename)) case AppendInfo(filename) => - val useFileInfo = ir.FileInfo(ir.StringLit.unescape(useInfo)) - val newFileInfo = ir.FileInfo(ir.StringLit.unescape(genInfo(filename))) + val useFileInfo = ir.FileInfo.fromEscaped(useInfo) + val newFileInfo = ir.FileInfo.fromEscaped(genInfo(filename)) ir.MultiInfo(useFileInfo, newFileInfo) case GenInfo(filename) => - ir.FileInfo(ir.StringLit.unescape(genInfo(filename))) + ir.FileInfo.fromEscaped(genInfo(filename)) case IgnoreInfo => NoInfo } } |
