Fix const-ness of inspector constructor.
This was changed originally, but we no longer need the module to be
non-const for the Inspector. Set it back to const to fix the Chrome
roll.
Change-Id: I68166a7a687249cab5c344167386144554b7d175
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37221
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
diff --git a/src/inspector/inspector.cc b/src/inspector/inspector.cc
index 7957c85..1564d37 100644
--- a/src/inspector/inspector.cc
+++ b/src/inspector/inspector.cc
@@ -46,9 +46,9 @@
Inspector::Inspector(ast::Module& module, Namer* namer)
: module_(module), namer_(namer), namer_is_owned_(false) {}
-Inspector::Inspector(ast::Module& module)
+Inspector::Inspector(const ast::Module& module)
: module_(module),
- namer_(new MangleNamer(&module)),
+ namer_(new MangleNamer(&module_)),
namer_is_owned_(true) {}
Inspector::~Inspector() {
diff --git a/src/inspector/inspector.h b/src/inspector/inspector.h
index 4a17b8d..9ec0f00 100644
--- a/src/inspector/inspector.h
+++ b/src/inspector/inspector.h
@@ -77,7 +77,7 @@
Inspector(ast::Module& module, Namer* namer);
/// Constructor
/// @param module Shader module to extract information from.
- explicit Inspector(ast::Module& module);
+ explicit Inspector(const ast::Module& module);
~Inspector();
/// @returns error messages from the Inspector
diff --git a/src/namer.cc b/src/namer.cc
index d5f304d..9215b39 100644
--- a/src/namer.cc
+++ b/src/namer.cc
@@ -22,7 +22,7 @@
namespace tint {
-Namer::Namer(ast::Module* mod) : module_(mod) {}
+Namer::Namer(const ast::Module* mod) : module_(mod) {}
Namer::~Namer() = default;
@@ -46,7 +46,7 @@
return name;
}
-MangleNamer::MangleNamer(ast::Module* mod) : Namer(mod) {}
+MangleNamer::MangleNamer(const ast::Module* mod) : Namer(mod) {}
MangleNamer::~MangleNamer() = default;
@@ -54,7 +54,7 @@
return sym.to_str();
}
-UnsafeNamer::UnsafeNamer(ast::Module* mod) : Namer(mod) {}
+UnsafeNamer::UnsafeNamer(const ast::Module* mod) : Namer(mod) {}
UnsafeNamer::~UnsafeNamer() = default;
diff --git a/src/namer.h b/src/namer.h
index 7745cf0..e2b671a 100644
--- a/src/namer.h
+++ b/src/namer.h
@@ -28,7 +28,7 @@
public:
/// Constructor
/// @param mod the module this namer works with
- explicit Namer(ast::Module* mod);
+ explicit Namer(const ast::Module* mod);
/// Destructor
virtual ~Namer();
@@ -52,7 +52,7 @@
bool IsUsed(const std::string& name);
/// The module storing the symbol table
- ast::Module* module_ = nullptr;
+ const ast::Module* module_ = nullptr;
private:
// The list of names taken by the remapper
@@ -64,7 +64,7 @@
public:
/// Constructor
/// @param mod the module to retrieve names from
- explicit MangleNamer(ast::Module* mod);
+ explicit MangleNamer(const ast::Module* mod);
/// Destructor
~MangleNamer() override;
@@ -81,7 +81,7 @@
public:
/// Constructor
/// @param mod the module to retrieve names from
- explicit UnsafeNamer(ast::Module* mod);
+ explicit UnsafeNamer(const ast::Module* mod);
/// Destructor
~UnsafeNamer() override;
diff --git a/src/writer/test_namer.cc b/src/writer/test_namer.cc
index 0ab1a7d..1c13148 100644
--- a/src/writer/test_namer.cc
+++ b/src/writer/test_namer.cc
@@ -17,7 +17,7 @@
namespace tint {
namespace writer {
-TestNamer::TestNamer(ast::Module* mod) : Namer(mod) {}
+TestNamer::TestNamer(const ast::Module* mod) : Namer(mod) {}
TestNamer::~TestNamer() = default;
diff --git a/src/writer/test_namer.h b/src/writer/test_namer.h
index 44a7e68..da08c2c 100644
--- a/src/writer/test_namer.h
+++ b/src/writer/test_namer.h
@@ -27,7 +27,7 @@
public:
/// Constructor
/// @param mod the module to retrieve names from
- explicit TestNamer(ast::Module* mod);
+ explicit TestNamer(const ast::Module* mod);
/// Destructor
~TestNamer() override;