| 1 |
// RUN: %clang_cc1 -x c++-header -emit-pch %s -o %t |
| 2 |
// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s |
| 3 |
|
| 4 |
// expected-no-diagnostics |
| 5 |
|
| 6 |
#ifndef HEADER_INCLUDED |
| 7 |
#define HEADER_INCLUDED |
| 8 |
|
| 9 |
static inline void foo(int &x, int y) { |
| 10 |
// Capturing x and y |
| 11 |
#pragma clang __debug captured |
| 12 |
{ |
| 13 |
x += y; |
| 14 |
} |
| 15 |
} |
| 16 |
|
| 17 |
struct C { |
| 18 |
int val; |
| 19 |
|
| 20 |
explicit C(int v) : val(v) { } |
| 21 |
|
| 22 |
void bar(int &x) { |
| 23 |
// Capturing x and this |
| 24 |
#pragma clang __debug captured |
| 25 |
{ |
| 26 |
x += val; |
| 27 |
} |
| 28 |
} |
| 29 |
}; |
| 30 |
|
| 31 |
#else |
| 32 |
|
| 33 |
void test_foo(int &x) { |
| 34 |
foo(x, 10); |
| 35 |
} |
| 36 |
|
| 37 |
void test_bar(int &x) { |
| 38 |
C Obj(10); |
| 39 |
Obj.bar(x); |
| 40 |
} |
| 41 |
|
| 42 |
#endif |