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

Side by Side Diff: tools/clang/rewrite_to_chrome_style/tests/variables-original.cc

Issue 1839573002: rewrite_to_chrome_style: making globals great again. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 4 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 namespace blink { 5 namespace blink {
6 6
7 // Global variables 7 // Global variables
8 int frameCount = 0; 8 int frameCount = 0;
9 // Make sure that underscore-insertion doesn't get too confused by acronyms. 9 // Make sure that underscore-insertion doesn't get too confused by acronyms.
10 static int variableMentioningHTTPAndHTTPS = 1; 10 static int variableMentioningHTTPAndHTTPS = 1;
11 // g_ prefix, but doesn't follow Google style.
12 int g_withBlinkNaming;
11 // Already Google style, should not change. 13 // Already Google style, should not change.
12 int already_google_style_; 14 int g_already_google_style_;
13 15
14 // Function parameters 16 // Function parameters
15 int function(int interestingNumber) { 17 int function(int interestingNumber) {
16 // Local variables. 18 // Local variables.
17 int aLocalVariable = 1; 19 int aLocalVariable = 1;
18 // Static locals. 20 // Static locals.
19 static int aStaticLocalVariable = 2; 21 static int aStaticLocalVariable = 2;
20 // Make sure references to variables are also rewritten. 22 // Make sure references to variables are also rewritten.
21 return frameCount + 23 return frameCount +
22 variableMentioningHTTPAndHTTPS * interestingNumber / aLocalVariable % 24 variableMentioningHTTPAndHTTPS * interestingNumber / aLocalVariable %
23 aStaticLocalVariable; 25 aStaticLocalVariable;
24 } 26 }
25 27
26 } // namespace blink 28 } // namespace blink
27 29
28 using blink::frameCount; 30 using blink::frameCount;
29 31
30 int F() { 32 int F() {
31 // Make sure variables qualified with a namespace name are still rewritten 33 // Make sure variables qualified with a namespace name are still rewritten
32 // correctly. 34 // correctly.
33 return frameCount + blink::frameCount; 35 return frameCount + blink::frameCount;
34 } 36 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698