mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-10 17:36:07 +00:00

fallback syntax used when we fail to find a '.clang-format' file. Adjust variable names appropriately. Update the editor integration pieces that specify a '-style' option to specify it as '-style=file'. I left the functionality in place because even if the preferred method is to use '.clang-format' files, this way if someone needs to clobber the style in their editor we show how to do so in these examples. Also check in a '.clang-format' file for Clang to ensure that separate checkouts and builds of Clang from LLVM can still get the nice formatting. =] This unfortunately required nuking the test for the absence of a '.clang-format' file as now the directory happening to be under your clang source tree will cause there to always be a file. ;] llvm-svn: 189741
21 lines
1.1 KiB
C++
21 lines
1.1 KiB
C++
// RUN: grep -Ev "// *[A-Z0-9]+:" %s > %t.cpp
|
|
// RUN: clang-format -style="{BasedOnStyle: Google, IndentWidth: 8}" %t.cpp | FileCheck -strict-whitespace -check-prefix=CHECK1 %s
|
|
// RUN: clang-format -style="{BasedOnStyle: LLVM, IndentWidth: 7}" %t.cpp | FileCheck -strict-whitespace -check-prefix=CHECK2 %s
|
|
// RUN: clang-format -style="{BasedOnStyle: invalid, IndentWidth: 7}" %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK3 %s
|
|
// RUN: clang-format -style="{lsjd}" %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK4 %s
|
|
// RUN: [ ! -e %T/.clang-format ] || rm %T/.clang-format
|
|
// RUN: printf "BasedOnStyle: google\nIndentWidth: 5\n" > %T/.clang-format
|
|
// RUN: clang-format -style=file %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK5 %s
|
|
void f() {
|
|
// CHECK1: {{^ int\* i;$}}
|
|
// CHECK2: {{^ int \*i;$}}
|
|
// CHECK3: Unknown value for BasedOnStyle: invalid
|
|
// CHECK3: Error parsing -style: Invalid argument, using LLVM style
|
|
// CHECK3: {{^ int \*i;$}}
|
|
// CHECK4: Error parsing -style: Invalid argument, using LLVM style
|
|
// CHECK4: {{^ int \*i;$}}
|
|
// CHECK5: {{^ int\* i;$}}
|
|
int*i;
|
|
int j;
|
|
}
|