Bug 1814798 - pt 1. Add bool to enable/disable PHC at runtime r=glandium
[gecko.git] / build / clang-plugin / AssertAssignmentChecker.cpp
blob467de28d6328a86eaf35179b73209cca1c518255
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "AssertAssignmentChecker.h"
6 #include "CustomMatchers.h"
8 void AssertAssignmentChecker::registerMatchers(MatchFinder *AstMatcher) {
9 AstMatcher->addMatcher(
10 callExpr(isAssertAssignmentTestFunc()).bind("funcCall"), this);
13 void AssertAssignmentChecker::check(const MatchFinder::MatchResult &Result) {
14 const CallExpr *FuncCall = Result.Nodes.getNodeAs<CallExpr>("funcCall");
16 if (FuncCall && hasSideEffectAssignment(FuncCall)) {
17 diag(FuncCall->getBeginLoc(), "Forbidden assignment in assert expression",
18 DiagnosticIDs::Error);