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

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

Issue 1644803002: rewrite_to_chrome_style: Don't put a trailing _ on static consts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Simple global constants. 7 // Simple global constants.
8 const char kHelloWorldConstant[] = "Hello world!"; 8 const char kHelloWorldConstant[] = "Hello world!";
9 // Make sure a one-character constant doesn't get mangled. 9 // Make sure a one-character constant doesn't get mangled.
10 const float kE = 2.718281828; 10 const float kE = 2.718281828;
11 // Some constants start with a capital letter already. 11 // Some constants start with a capital letter already.
12 const int kSpeedOfLightInMetresPerSecond = 299792458; 12 const int kSpeedOfLightInMetresPerSecond = 299792458;
13 13
14 // Already Chrome style, so shouldn't change. 14 // Already Chrome style, so shouldn't change.
15 const float kPi = 3.141592654; 15 const float kPi = 3.141592654;
16 16
17 class C { 17 class C {
18 public: 18 public:
19 // Static class constants. 19 // Static class constants.
20 static const int kUsefulConstant_ = 8; 20 static const int kUsefulConstant = 8;
21 // Note: s_ prefix should not be retained. 21 // Note: s_ prefix should not be retained.
22 static const int kStaticConstant_ = 9; 22 static const int kStaticConstant = 9;
23 // Note: m_ prefix should not be retained even though the proper prefix is s_. 23 // Note: m_ prefix should not be retained even though the proper prefix is s_.
24 static const int kSuperNumber_ = 42; 24 static const int kSuperNumber = 42;
25 25
26 // Not a constant even though it has static storage duration. 26 // Not a constant even though it has static storage duration.
27 static const char* current_event_; 27 static const char* current_event_;
28 28
29 static int Function(); 29 static int Function();
30 30
31 static void FunctionWithConstant() { 31 static void FunctionWithConstant() {
32 const int kFunctionConstant = 4; 32 const int kFunctionConstant = 4;
33 const int kFunctionConstantFromExpression = 4 + 6; 33 const int kFunctionConstantFromExpression = 4 + 6;
34 const int kFunctionConstantFromOtherConsts = 34 const int kFunctionConstantFromOtherConsts =
35 kFunctionConstant + kFunctionConstantFromExpression; 35 kFunctionConstant + kFunctionConstantFromExpression;
36 const int kShouldBeRenamedToAConst = 9 - 2; 36 const int kShouldBeRenamedToAConst = 9 - 2;
37 const int kShouldAlsoBeRenamedToAConst = 37 const int kShouldAlsoBeRenamedToAConst =
38 kFunctionConstant + kFunctionConstantFromOtherConsts; 38 kFunctionConstant + kFunctionConstantFromOtherConsts;
39 const int not_compile_time_const = kFunctionConstant + Function(); 39 const int not_compile_time_const = kFunctionConstant + Function();
40 } 40 }
41 }; 41 };
42 42
43 void F() { 43 void F() {
44 // Constant in function body. 44 // Constant in function body.
45 static const char kStaticString[] = "abc"; 45 static const char kStaticString[] = "abc";
46 // Constant-style naming, since it's initialized with a literal. 46 // Constant-style naming, since it's initialized with a literal.
47 const char* const kNonStaticStringConstant = "def"; 47 const char* const kNonStaticStringConstant = "def";
48 // Not constant-style naming, since it's not initialized with a literal. 48 // Not constant-style naming, since it's not initialized with a literal.
49 const char* const non_static_string_unconstant = kNonStaticStringConstant; 49 const char* const non_static_string_unconstant = kNonStaticStringConstant;
50 } 50 }
51 51
52 } // namespace blink 52 } // namespace blink
OLDNEW
« no previous file with comments | « tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698