[PATCH] [clang-tidy] Assert related checkers

Alexander Kornienko alexfh at google.com
Thu Feb 26 01:25:08 PST 2015


================
Comment at: clang-tidy/misc/StaticAssertCheck.cpp:72
@@ +71,3 @@
+
+  if (MacroName != "assert" || !Condition->isEvaluatable(*ASTCtx))
+    return;
----------------
xazax.hun wrote:
> alexfh wrote:
> > I wonder if it's intentional that the other check has an option for assert macro names and this one doesn't. 
> I think the fixit might not be valid for a custom assert. Once custom assert macros are supported either those should not be rewritten or it should be configurable whether to rewrite custom macros or not. Or we can just rely on that the users won't run this checker with custom asserts configured and apply fixits mode. What do you think?
Makes sense, the fixits may be incorrect for custom asserts. One possible example is:

  CHECK(some_boolean_expression) << "Error message: " << some_parameter;
  
Another couple of possible solutions:
  * configure a separate list of macros that the check should not issue fixits for;
  * try to detect automatically whether we can handle the specific construct (e.g. if it's in the form of `macro(expression);`).

In any case it looks like it's better to do this in a separate patch.

http://reviews.llvm.org/D7375

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list