================
Comment at: clang-tidy/readability/SimplifyBooleanExprCheck.cpp:130-145
@@ -121,2 +129,18 @@
+
+bool isFollowedBy(const CompoundStmt *Compound, const Stmt *Before,
+ const Stmt *After) {
+ if (Compound->size() < 2) {
+ return false;
+ }
+
+ CompoundStmt::const_body_iterator BeforeIt = Compound->body_begin();
+ CompoundStmt::const_body_iterator AfterIt = Compound->body_begin();
+ for (++AfterIt; AfterIt != Compound->body_end(); ++BeforeIt, ++AfterIt) {
+ if (*BeforeIt == Before && *AfterIt == After) {
+ return true;
+ }
+ }
+
+ return false;
}
----------------
I think this would make a good matcher, but I am unsure how to best express it
using the matcher infrastructure. I could find no way in the existing matcher
lexicon to say "match compound statements where this statement follows that
statement"
http://reviews.llvm.org/D9810
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits