Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
OCLint if matcher
#include "oclint/AbstractASTMatcherRule.h"
#include "oclint/RuleSet.h"
using namespace std;
using namespace clang;
using namespace clang::ast_matchers;
using namespace oclint;
class AllIfStatementsRule : public AbstractASTMatcherRule
virtual const string name() const override
return "all if statements";
virtual int priority() const override
return 3;
virtual void callback(const MatchFinder::MatchResult &result) override
const IfStmt *ifStmt = result.Nodes.getNodeAs<IfStmt>("ifStmt");
if (ifStmt) {
addViolation(ifStmt->getCond(), this, "if statement found");
virtual void setUpMatcher() override
static RuleSet rules(new AllIfStatementsRule());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.