xref: /llvm-project/clang/test/CodeCompletion/preferred-type.cpp (revision cf9b25e0adc42546e4dc5ff51ee8674d45bac26b)

test(bool x)1 void test(bool x) {
2   if (x) {}
3   // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):7 %s | FileCheck %s
4   // CHECK: PREFERRED-TYPE: _Bool
5 
6   while (x) {}
7   // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):10 %s | FileCheck %s
8 
9   for (; x;) {}
10   // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):10 %s | FileCheck %s
11 
12   // FIXME(ibiryukov): the condition in do-while is parsed as expression, so we
13   // fail to detect it should be converted to bool.
14   // do {} while (x);
15 }
16