summaryrefslogtreecommitdiffstats
path: root/tools/clang/rewrite_to_chrome_style/tests/functions-original.cc
blob: c416d38a65c46929b59af66a3481c9448ffb46f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

namespace blink {

// Tests that the prototype for a function is updated.
int testFunctionThatTakesTwoInts(int x, int y);
// Overload to test using declarations that introduce multiple shadow
// declarations.
int testFunctionThatTakesTwoInts(int x, int y, int z);

// Test that the actual function definition is also updated.
int testFunctionThatTakesTwoInts(int x, int y) {
  if (x == 0)
    return y;
  // Calls to the function also need to be updated.
  return testFunctionThatTakesTwoInts(x - 1, y + 1);
}

// This is named like the begin() method which isn't renamed, but
// here it's not a method so it should be.
void begin() {}
// Same for trace() and friends.
void trace() {}
void lock() {}

// Note: F is already Google style and should not change.
void F() {
  // Test referencing a function without calling it.
  int (*functionPointer)(int, int) = &testFunctionThatTakesTwoInts;
}

}  // namespace blink

using blink::testFunctionThatTakesTwoInts;

void G() {
  testFunctionThatTakesTwoInts(1, 2);
}