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

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

Issue 1753563003: rewrite_to_chrome_style: Improve naming of iterator and type traits. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clang-structs: test Created 4 years, 10 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-original.cc
diff --git a/tools/clang/rewrite_to_chrome_style/tests/methods-original.cc b/tools/clang/rewrite_to_chrome_style/tests/methods-original.cc
index b2d9381d24abcf6eb6b3ab1bd462f225bce9da47..fbbf9c1717c7acdb40110388065a2ccf5005532a 100644
--- a/tools/clang/rewrite_to_chrome_style/tests/methods-original.cc
+++ b/tools/clang/rewrite_to_chrome_style/tests/methods-original.cc
@@ -4,6 +4,9 @@
namespace blink {
+class MyIterator {};
+using my_iterator = char*;
+
class Task {
public:
// Already style-compliant methods shouldn't change.
@@ -32,10 +35,10 @@ class Task {
// These are special functions that we don't rename so that range-based
// for loops and STL things work.
- void begin() {}
- void end() {}
- void rbegin() {}
- void rend() {}
+ MyIterator begin() {}
+ my_iterator end() {}
+ my_iterator rbegin() {}
+ MyIterator rend() {}
// The trace() method is used by Oilpan, we shouldn't rename it.
void trace() {}
// These are used by std::unique_lock and std::lock_guard.
@@ -46,12 +49,20 @@ class Task {
class Other {
// Static begin/end/trace don't count, and should be renamed.
- static void begin() {}
- static void end() {}
+ static MyIterator begin() {}
+ static my_iterator end() {}
static void trace() {}
static void lock() {}
};
+class NonIterators {
+ // begin()/end() and friends are renamed if they don't return an iterator.
+ void begin() {}
+ int end() { return 0; }
+ void rbegin() {}
+ int rend() { return 0; }
+};
+
// Test that the actual method definition is also updated.
void Task::doTheWork() {
reallyDoTheWork();
@@ -84,3 +95,28 @@ void F() {
void (blink::Task::*p3)() = &blink::Task::reallyDoTheWork;
void (BovineTask::*p4)() = &BovineTask::reallyDoTheWork;
}
+
+namespace blink {
+
+struct StructInBlink {
+ // Structs in blink should rename their methods to capitals.
+ bool function() { return true; }
+};
+
+} // namespace blink
+
+namespace WTF {
+
+struct StructInWTF {
+ // Structs in WTF should rename their methods to capitals.
+ bool function() { return true; }
+};
+
+} // namespace WTF
+
+void F2() {
+ blink::StructInBlink b;
+ b.function();
+ WTF::StructInWTF w;
+ w.function();
+}

Powered by Google App Engine
This is Rietveld 408576698