summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authormergify[bot]2022-05-29 22:07:56 +0000
committerGitHub2022-05-29 22:07:56 +0000
commit0c811b490f47f20f2e81c58706924e56611b6ba2 (patch)
tree04df977bccd83adb9458d6bf783369bb4e226d86 /core
parent3aed65709aedc22810926751db33fe9ba767a03b (diff)
Deprecate accessing the name of non-hardware Data (#2550) (#2552)
This includes (and is tested) for both the old .*Name APIs and .toTarget (cherry picked from commit 6e0d8d6b12e9d8f94c2cc43b92b2366ec70dfd50) Co-authored-by: Jack Koenig <koenig@sifive.com>
Diffstat (limited to 'core')
-rw-r--r--core/src/main/scala/chisel3/internal/Builder.scala13
1 files changed, 12 insertions, 1 deletions
diff --git a/core/src/main/scala/chisel3/internal/Builder.scala b/core/src/main/scala/chisel3/internal/Builder.scala
index 69455455..97c3bc49 100644
--- a/core/src/main/scala/chisel3/internal/Builder.scala
+++ b/core/src/main/scala/chisel3/internal/Builder.scala
@@ -240,7 +240,18 @@ private[chisel3] trait HasId extends InstanceId {
private def refName(c: Component): String = _ref match {
case Some(arg) => arg.fullName(c)
- case None => _computeName(None, None).get
+ case None =>
+ // This is super hacky but this is just for a short term deprecation
+ // These accesses occur after Chisel elaboration so we cannot use the normal
+ // Builder.deprecated mechanism, we have to create our own one off ErrorLog and print the
+ // warning right away.
+ val errors = new ErrorLog
+ val logger = new _root_.logger.Logger(this.getClass.getName)
+ val msg = "Accessing the .instanceName or .toTarget of non-hardware Data is deprecated. " +
+ "This will become an error in Chisel 3.6."
+ errors.deprecated(msg, None)
+ errors.checkpoint(logger)
+ _computeName(None, None).get
}
// Helper for reifying views if they map to a single Target