[PATCH] D24507: Add attribute for return values that shouldn't be cast to bool
Daniel Marjamäki via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 20 06:33:08 PDT 2016
danielmarjamaki added a subscriber: danielmarjamaki.
================
Comment at: include/clang/Basic/AttrDocs.td:2055
@@ -2054,1 +2054,3 @@
}
+def WarnImpcastToBoolDocs : Documentation {
+ let Category = DocCatFunction;
----------------
I saw your email on cfe-dev. This sounds like a good idea to me.
================
Comment at: lib/StaticAnalyzer/Checkers/ReturnNonBoolChecker.cpp:49
@@ +48,3 @@
+ // needed.
+ if (!State->contains<NonBoolValues>(SR)) return;
+
----------------
It seems you need to run clang-format on this file also.
================
Comment at: test/ReturnNonBoolTest.c:7
@@ +6,3 @@
+
+#ifdef __clang__
+#define RETURNS_NON_BOOL __attribute__((warn_impcast_to_bool))
----------------
sorry but why do you have a #ifdef __clang__ isn't it always defined?
Repository:
rL LLVM
https://reviews.llvm.org/D24507
More information about the cfe-commits
mailing list