summaryrefslogtreecommitdiffstats
path: root/test/clang-tidy/alternative-fixes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/clang-tidy/alternative-fixes.cpp')
-rw-r--r--test/clang-tidy/alternative-fixes.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/clang-tidy/alternative-fixes.cpp b/test/clang-tidy/alternative-fixes.cpp
new file mode 100644
index 00000000..d5cee68d
--- /dev/null
+++ b/test/clang-tidy/alternative-fixes.cpp
@@ -0,0 +1,9 @@
+// RUN: %check_clang_tidy %s "llvm-namespace-comment,clang-diagnostic-*" %t
+void foo(int a) {
+ if (a = 1) {
+ // CHECK-NOTES: [[@LINE-1]]:9: warning: using the result of an assignment as a condition without parentheses [clang-diagnostic-parentheses]
+ // CHECK-NOTES: [[@LINE-2]]:9: note: place parentheses around the assignment to silence this warning
+ // CHECK-NOTES: [[@LINE-3]]:9: note: use '==' to turn this assignment into an equality comparison
+ // CHECK-FIXES: if ((a = 1)) {
+ }
+}