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>
This commit is contained in:
dan sinclair 2021-01-11 20:01:12 +00:00 committed by Commit Bot service account
parent e86fd505e4
commit c3c70f848a
6 changed files with 12 additions and 12 deletions

View File

@ -46,9 +46,9 @@ namespace inspector {
Inspector::Inspector(ast::Module& module, Namer* namer) Inspector::Inspector(ast::Module& module, Namer* namer)
: module_(module), namer_(namer), namer_is_owned_(false) {} : module_(module), namer_(namer), namer_is_owned_(false) {}
Inspector::Inspector(ast::Module& module) Inspector::Inspector(const ast::Module& module)
: module_(module), : module_(module),
namer_(new MangleNamer(&module)), namer_(new MangleNamer(&module_)),
namer_is_owned_(true) {} namer_is_owned_(true) {}
Inspector::~Inspector() { Inspector::~Inspector() {

View File

@ -77,7 +77,7 @@ class Inspector {
Inspector(ast::Module& module, Namer* namer); Inspector(ast::Module& module, Namer* namer);
/// Constructor /// Constructor
/// @param module Shader module to extract information from. /// @param module Shader module to extract information from.
explicit Inspector(ast::Module& module); explicit Inspector(const ast::Module& module);
~Inspector(); ~Inspector();
/// @returns error messages from the Inspector /// @returns error messages from the Inspector

View File

@ -22,7 +22,7 @@
namespace tint { namespace tint {
Namer::Namer(ast::Module* mod) : module_(mod) {} Namer::Namer(const ast::Module* mod) : module_(mod) {}
Namer::~Namer() = default; Namer::~Namer() = default;
@ -46,7 +46,7 @@ std::string Namer::GenerateName(const std::string& prefix) {
return name; return name;
} }
MangleNamer::MangleNamer(ast::Module* mod) : Namer(mod) {} MangleNamer::MangleNamer(const ast::Module* mod) : Namer(mod) {}
MangleNamer::~MangleNamer() = default; MangleNamer::~MangleNamer() = default;
@ -54,7 +54,7 @@ std::string MangleNamer::NameFor(const Symbol& sym) {
return sym.to_str(); return sym.to_str();
} }
UnsafeNamer::UnsafeNamer(ast::Module* mod) : Namer(mod) {} UnsafeNamer::UnsafeNamer(const ast::Module* mod) : Namer(mod) {}
UnsafeNamer::~UnsafeNamer() = default; UnsafeNamer::~UnsafeNamer() = default;

View File

@ -28,7 +28,7 @@ class Namer {
public: public:
/// Constructor /// Constructor
/// @param mod the module this namer works with /// @param mod the module this namer works with
explicit Namer(ast::Module* mod); explicit Namer(const ast::Module* mod);
/// Destructor /// Destructor
virtual ~Namer(); virtual ~Namer();
@ -52,7 +52,7 @@ class Namer {
bool IsUsed(const std::string& name); bool IsUsed(const std::string& name);
/// The module storing the symbol table /// The module storing the symbol table
ast::Module* module_ = nullptr; const ast::Module* module_ = nullptr;
private: private:
// The list of names taken by the remapper // The list of names taken by the remapper
@ -64,7 +64,7 @@ class MangleNamer : public Namer {
public: public:
/// Constructor /// Constructor
/// @param mod the module to retrieve names from /// @param mod the module to retrieve names from
explicit MangleNamer(ast::Module* mod); explicit MangleNamer(const ast::Module* mod);
/// Destructor /// Destructor
~MangleNamer() override; ~MangleNamer() override;
@ -81,7 +81,7 @@ class UnsafeNamer : public Namer {
public: public:
/// Constructor /// Constructor
/// @param mod the module to retrieve names from /// @param mod the module to retrieve names from
explicit UnsafeNamer(ast::Module* mod); explicit UnsafeNamer(const ast::Module* mod);
/// Destructor /// Destructor
~UnsafeNamer() override; ~UnsafeNamer() override;

View File

@ -17,7 +17,7 @@
namespace tint { namespace tint {
namespace writer { namespace writer {
TestNamer::TestNamer(ast::Module* mod) : Namer(mod) {} TestNamer::TestNamer(const ast::Module* mod) : Namer(mod) {}
TestNamer::~TestNamer() = default; TestNamer::~TestNamer() = default;

View File

@ -27,7 +27,7 @@ class TestNamer : public Namer {
public: public:
/// Constructor /// Constructor
/// @param mod the module to retrieve names from /// @param mod the module to retrieve names from
explicit TestNamer(ast::Module* mod); explicit TestNamer(const ast::Module* mod);
/// Destructor /// Destructor
~TestNamer() override; ~TestNamer() override;