tools/gn: mark first TestTarget parameter as const
Style guide mandates that parameters passed by reference must be labeled
'const'. That, or they should be const T*.
https://google.github.io/styleguide/cppguide.html#Reference_Arguments
This is also to please cpplint complain on it:
./tools/gn/test_with_scope.h:104: Is this a non-const reference? If so,
make const or use a pointer: TestWithScope& setup [runtime/references] [2]
BUG=None
TEST=gn_unittests
R=scottmg@chromium.org
Review URL: https://codereview.chromium.org/1453843003
Cr-Original-Commit-Position: refs/heads/master@{#360251}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 45e4d2956883c02a20e0269ae74b24923a34cbc5
diff --git a/tools/gn/scheduler.h b/tools/gn/scheduler.h
index 5d0502f..45225ce 100644
--- a/tools/gn/scheduler.h
+++ b/tools/gn/scheduler.h
@@ -121,4 +121,3 @@
extern Scheduler* g_scheduler;
#endif // TOOLS_GN_SCHEDULER_H_
-
diff --git a/tools/gn/test_with_scope.cc b/tools/gn/test_with_scope.cc
index 4793f39..896b579 100644
--- a/tools/gn/test_with_scope.cc
+++ b/tools/gn/test_with_scope.cc
@@ -156,7 +156,7 @@
TestParseInput::~TestParseInput() {
}
-TestTarget::TestTarget(TestWithScope& setup,
+TestTarget::TestTarget(const TestWithScope& setup,
const std::string& label_string,
Target::OutputType type)
: Target(setup.settings(), setup.ParseLabel(label_string)) {
diff --git a/tools/gn/test_with_scope.h b/tools/gn/test_with_scope.h
index 445fe77..75b0899 100644
--- a/tools/gn/test_with_scope.h
+++ b/tools/gn/test_with_scope.h
@@ -5,6 +5,7 @@
#ifndef TOOLS_GN_TEST_WITH_SCOPE_H_
#define TOOLS_GN_TEST_WITH_SCOPE_H_
+#include <string>
#include <vector>
#include "base/macros.h"
@@ -29,7 +30,9 @@
BuildSettings* build_settings() { return &build_settings_; }
Settings* settings() { return &settings_; }
+ const Settings* settings() const { return &settings_; }
Toolchain* toolchain() { return &toolchain_; }
+ const Toolchain* toolchain() const { return &toolchain_; }
Scope* scope() { return &scope_; }
// This buffer accumulates output from any print() commands executed in the
@@ -101,7 +104,7 @@
// default to public visibility.
class TestTarget : public Target {
public:
- TestTarget(TestWithScope& setup,
+ TestTarget(const TestWithScope& setup,
const std::string& label_string,
Target::OutputType type);
~TestTarget() override;