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 3 // found in the LICENSE file. 4 5 namespace blink { 6 7 namespace { 8 9 // Naive renaming will break the build, by leaving return type the same name as 10 // the function name - to avoid this "Get" prefix needs to be prepended as 11 // suggested in https://crbug.com/582312#c17. 12 class Foo582312 {}; 13 using Bar = Foo582312; 14 static Bar* bar() { 15 return nullptr; 16 } 17 18 } // namespace 19 20 // Tests that the prototype for a function is updated. 21 int testFunctionThatTakesTwoInts(int x, int y); 22 // Overload to test using declarations that introduce multiple shadow 23 // declarations. 24 int testFunctionThatTakesTwoInts(int x, int y, int z); 25 26 // Test that the actual function definition is also updated. 27 int testFunctionThatTakesTwoInts(int x, int y) { 28 if (x == 0) 29 return y; 30 // Calls to the function also need to be updated. 31 return testFunctionThatTakesTwoInts(x - 1, y + 1); 32 } 33 34 // This is named like the begin() method which isn't renamed, but 35 // here it's not a method so it should be. 36 void begin() {} 37 // Same for trace() and friends. 38 void trace() {} 39 void lock() {} 40 41 class SwapType {}; 42 43 // swap() functions are not renamed. 44 void swap(SwapType& a, SwapType& b) {} 45 46 // Note: F is already Google style and should not change. 47 void F() { 48 // Test referencing a function without calling it. 49 int (*functionPointer)(int, int) = &testFunctionThatTakesTwoInts; 50 } 51 52 void bug640688(int); // Declaration within blink namespace. 53 54 } // namespace blink 55 56 // Definition outside of blink namespace. 57 void blink::bug640688(int myParam) { 58 char myVariable = 'c'; 59 } 60 61 using blink::testFunctionThatTakesTwoInts; 62 63 void G() { 64 testFunctionThatTakesTwoInts(1, 2); 65 66 blink::SwapType a, b; 67 swap(a, b); 68 } 69