Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Unified Diff: tools/clang/rewrite_to_chrome_style/tests/methods-expected.cc

Issue 1557243002: Update rewrite_to_chrome_style tool to also rename methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Group more logically Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/clang/rewrite_to_chrome_style/tests/methods-expected.cc
diff --git a/tools/clang/rewrite_to_chrome_style/tests/methods-expected.cc b/tools/clang/rewrite_to_chrome_style/tests/methods-expected.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e37223f940993e6589ae27df9710c2784a8bd39f
--- /dev/null
+++ b/tools/clang/rewrite_to_chrome_style/tests/methods-expected.cc
@@ -0,0 +1,49 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+namespace blink {
+
+class Task {
+ public:
+ // Already style-compliant methods shouldn't change.
+ void OutputDebugString() {}
+
+ // Tests that the declarations for methods are updated.
+ void DoTheWork();
+ virtual void ReallyDoTheWork() = 0;
+
+ // Note: this is purposely copyable and assignable, to make sure the Clang
+ // tool doesn't try to emit replacements for things that aren't explicitly
+ // written.
+ // TODO(dcheng): Add an explicit test for something like operator+.
+};
+
+// Test that the actual method definition is also updated.
+void Task::DoTheWork() {
+ ReallyDoTheWork();
+}
+
+} // namespace blink
+
+namespace Moo {
+
+// Test that overrides from outside the Blink namespace are also updated.
+class BovineTask : public blink::Task {
+ public:
+ void ReallyDoTheWork() override;
+};
+
+void BovineTask::ReallyDoTheWork() {
+ DoTheWork();
+ // Calls via an overridden method should also be updated.
+ ReallyDoTheWork();
+}
+
+// Finally, test that method pointers are also updated.
+void F() {
+ void (blink::Task::*p1)() = &BovineTask::DoTheWork;
+ void (blink::Task::*p2)() = &blink::Task::ReallyDoTheWork;
+}
+
+} // namespace Moo

Powered by Google App Engine
This is Rietveld 408576698