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

Side by Side Diff: tools/clang/rewrite_to_chrome_style/tests/template-expected.cc

Issue 2256913002: Handling of DependentScopeDeclRefExpr and CXXDependentScopeMemberExpr nodes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blink-style-new-clang
Patch Set: Rebasing... Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <type_traits>
6
5 namespace not_blink { 7 namespace not_blink {
6 8
7 void function(int x) {} 9 void function(int x) {}
8 10
9 class Class { 11 class Class {
10 public: 12 public:
11 void method() {} 13 void method() {}
12 template <typename T> 14 template <typename T>
13 void methodTemplate(T) {} 15 void methodTemplate(T) {}
14 template <typename T> 16 template <typename T>
15 static void staticMethodTemplate(T) {} 17 static void staticMethodTemplate(T) {}
16 }; 18 };
17 19
18 template <typename T> 20 template <typename T>
19 void functionTemplate(T x) {} 21 void functionTemplate(T x) {}
20 22
23 template <typename T = Class>
24 void functionTemplate2() {
25 T::staticMethodTemplate(123);
26 }
27
28 template <typename T = Class>
29 class TemplatedClass {
30 public:
31 void anotherMethod() { T::staticMethodTemplate(123); }
32 };
33
21 } // not_blink 34 } // not_blink
22 35
23 namespace blink { 36 namespace blink {
24 37
25 template <typename T, int number> 38 template <typename T, int number>
26 void F() { 39 void F() {
27 // We don't assert on this, and we don't end up considering it a const for 40 // We don't assert on this, and we don't end up considering it a const for
28 // now. 41 // now.
29 const int maybe_a_const = sizeof(T); 42 const int maybe_a_const = sizeof(T);
30 const int is_a_const = number; 43 const int is_a_const = number;
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 186
174 template <typename T> 187 template <typename T>
175 void Class<T>::F(int data_size){}; 188 void Class<T>::F(int data_size){};
176 189
177 void Foo() { 190 void Foo() {
178 Class<char>().F(123); 191 Class<char>().F(123);
179 }; 192 };
180 193
181 } // namespace test_unnamed_arg 194 } // namespace test_unnamed_arg
182 195
196 namespace test_new_array_bug {
197
198 class PartitionAllocator {
199 public:
200 static void Method() {}
201 };
202
203 template <typename Allocator = PartitionAllocator>
204 class Vector {
205 public:
206 // https://crbug.com/582315: |Allocator::method| is a
207 // CXXDependentScopeMemberExpr.
208 void AnotherMethod() {
209 if (std::is_class<Allocator>::value) // Shouldn't rename |value|
210 Allocator::Method(); // Should rename |method| -> |Method|.
211 }
212 };
213
214 template <typename Allocator = PartitionAllocator>
215 void Test() {
216 // https://crbug.com/582315: |Allocator::method| is a
217 // DependentScopeDeclRefExpr.
218 if (std::is_class<Allocator>::value) // Shouldn't rename |value|.
219 Allocator::Method(); // Should rename |method|.
220 }
221
222 } // namespace test_new_array_bug
223
183 } // namespace blink 224 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698