[PATCH] Improved checking for repeated macro argument with side effects when macro contains ?:

Alexander Kornienko alexfh at google.com
Tue Jun 23 08:23:10 PDT 2015


> Question: Is it a good idea to use std::stack or would some other container be better in clang-tidy?


You can try to use `std::stack<unsigned, SmallVector<unsigned, 8>>` to avoid heap allocation in most cases.


================
Comment at: clang-tidy/misc/MacroRepeatedSideEffectsCheck.cpp:120
@@ -99,3 +119,3 @@
 
     // If a builtin is found within the macro definition, skip next
     // parenthesis.
----------------
I guess, the main use case is __builtin_constant_p which doesn't evaluate its argument? Maybe specifically check for it? Or at least this needs some more explanation.

http://reviews.llvm.org/D10653

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






More information about the cfe-commits mailing list