aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/firrtl/proto/ToProto.scala
diff options
context:
space:
mode:
authorKevin Laeufer2020-07-15 12:21:26 -0700
committerGitHub2020-07-15 19:21:26 +0000
commit24be0ac3121e8f5d7b4bf8d6247e305ed0f0a656 (patch)
tree9acbdf85c86985921a84fa329838062a78e71588 /src/main/scala/firrtl/proto/ToProto.scala
parent005a3d1644742029e744a64c2d9c452969bc64ff (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/proto/ToProto.scala')
-rw-r--r--src/main/scala/firrtl/proto/ToProto.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main/scala/firrtl/proto/ToProto.scala b/src/main/scala/firrtl/proto/ToProto.scala
index 6cc6d11f..47fb3cec 100644
--- a/src/main/scala/firrtl/proto/ToProto.scala
+++ b/src/main/scala/firrtl/proto/ToProto.scala
@@ -135,8 +135,8 @@ object ToProto {
info match {
case ir.NoInfo =>
ib.setNone(Firrtl.SourceInfo.None.newBuilder)
- case ir.FileInfo(ir.StringLit(text)) =>
- ib.setText(text)
+ case f : ir.FileInfo =>
+ ib.setText(f.unescaped)
// TODO properly implement MultiInfo
case ir.MultiInfo(infos) =>
val x = if (infos.nonEmpty) infos.head else ir.NoInfo