[PATCH] D24507: Add attribute for return values that shouldn't be cast to bool
Anton Urusov via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 20 07:14:16 PDT 2016
urusant added inline comments.
================
Comment at: lib/StaticAnalyzer/Checkers/ReturnNonBoolChecker.cpp:50
@@ +49,3 @@
+ if (!State->contains<NonBoolValues>(SR)) return;
+
+ ExplodedNode *N = C.generateErrorNode(C.getState());
----------------
I have just noticed that I didn't specify the style option when I ran it the first time. Now it should be fine.
================
Comment at: test/ReturnNonBoolTest.c:7
@@ +6,3 @@
+
+#ifdef __clang__
+#define RETURNS_NON_BOOL __attribute__((warn_impcast_to_bool))
----------------
danielmarjamaki wrote:
> sorry but why do you have a #ifdef __clang__ isn't it always defined?
If I were to add the attribute to a function in some real codebase, I would probably want to save different compilers compatibility. However, it might not be necessary for the testcases.
Repository:
rL LLVM
https://reviews.llvm.org/D24507
More information about the cfe-commits
mailing list