Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeCompletion / skip-auto-funcs.cpp
blobc0fa0f556daefe2d452d1472d513a743d159a99e
1 // We run clang in completion mode to force skipping of function bodies and
2 // check if the function bodies were skipped by observing the warnings that
3 // clang produces.
4 // RUN: not %clang_cc1 -std=c++14 -fsyntax-only -code-completion-at=%s:60:1 %s -o - 2>&1 | FileCheck %s
5 template <class T>
6 auto not_skipped() {
7 int x;
8 if (x = 10) {}
9 // Check that this function is not skipped.
10 // CHECK: 8:9: warning: using the result of an assignment as a condition without parentheses
11 return 1;
14 template <class T>
15 auto lambda_not_skipped = []() {
16 int x;
17 if (x = 10) {}
18 // Check that this function is not skipped.
19 // CHECK: 17:9: warning: using the result of an assignment as a condition without parentheses
20 return 1;
23 template <class T>
24 auto skipped() -> T {
25 int x;
26 if (x = 10) {}
27 // Check that this function is skipped.
28 // CHECK-NOT: 26:9: warning: using the result of an assignment as a condition without parentheses
29 return 1;
32 auto lambda_skipped = []() -> int {
33 int x;
34 if (x = 10) {}
35 // This could potentially be skipped, but it isn't at the moment.
36 // CHECK: 34:9: warning: using the result of an assignment as a condition without parentheses
37 return 1;
40 template <class T>
41 decltype(auto)** not_skipped_ptr() {
42 int x;
43 if (x = 10) {}
44 // Check that this function is not skipped.
45 // CHECK: 43:9: warning: using the result of an assignment as a condition without parentheses
46 return T();
49 template <class T>
50 decltype(auto) not_skipped_decltypeauto() {
51 int x;
52 if (x = 10) {}
53 // Check that this function is not skipped.
54 // CHECK: 52:9: warning: using the result of an assignment as a condition without parentheses
55 return 1;
58 int test() {
59 int complete_in_this_function;
60 // CHECK: COMPLETION: complete_in_this_function