Differential D130181 Diff 449048 clang-tools-extra/test/clang-tidy/checkers/readability/use-early-exits-braces.cpp
Changeset View
Changeset View
Standalone View
Standalone View
clang-tools-extra/test/clang-tidy/checkers/readability/use-early-exits-braces.cpp
- This file was added.
// RUN: %check_clang_tidy %s readability-use-early-exits,google-readability-braces-around-statements -format-style=llvm %t -- \ | |||||
// RUN: -config="{CheckOptions: {readability-use-early-exits.LineCountThreshold: 2, \ | |||||
// RUN: google-readability-braces-around-statements.ShortStatementLines: 0}}" | |||||
// RUN: %check_clang_tidy %s readability-use-early-exits,hicpp-braces-around-statements -format-style=llvm %t -- \ | |||||
// RUN: -config="{CheckOptions: {readability-use-early-exits.LineCountThreshold: 2}}" | |||||
void nomralFunc(int *A) { | |||||
// CHECK-MESSAGES: [[@LINE+1]]:3: warning: use early exit | |||||
if (A) { | |||||
*A = 10; | |||||
} | |||||
// CHECK-FIXES: if (!A) { | |||||
// CHECK-FIXES-NEXT: return; | |||||
// CHECK-FIXES-NEXT: } | |||||
// CHECK-FIXES-NEXT: *A = 10; | |||||
} |