mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1615245
- checker fopen-usage
should ignore some gtest
include files. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D62997 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
90c44816ea
commit
47700a0dea
@ -126,11 +126,22 @@ AST_MATCHER(QualType, isFloat) { return Node->isRealFloatingType(); }
|
||||
/// This matcher will match locations in system headers. This is adopted from
|
||||
/// isExpansionInSystemHeader in newer clangs, but modified in order to work
|
||||
/// with old clangs that we use on infra.
|
||||
AST_POLYMORPHIC_MATCHER(isInSystemHeader, \
|
||||
AST_POLYMORPHIC_MATCHER(isInSystemHeader,
|
||||
AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt)) {
|
||||
return ASTIsInSystemHeader(Finder->getASTContext(), Node);
|
||||
}
|
||||
|
||||
/// This matcher will match a file "gtest-port.h". The file contains
|
||||
/// known fopen usages that are OK.
|
||||
AST_MATCHER(CallExpr, isInWhitelistForFopenUsage) {
|
||||
static const char Whitelist[] = "gtest-port.h";
|
||||
SourceLocation Loc = Node.getBeginLoc();
|
||||
StringRef FileName =
|
||||
getFilename(Finder->getASTContext().getSourceManager(), Loc);
|
||||
|
||||
return llvm::sys::path::rbegin(FileName)->equals(Whitelist);
|
||||
}
|
||||
|
||||
/// This matcher will match a list of files. These files contain
|
||||
/// known NaN-testing expressions which we would like to whitelist.
|
||||
AST_MATCHER(BinaryOperator, isInWhitelistForNaNExpr) {
|
||||
|
@ -50,7 +50,8 @@ void FopenUsageChecker::registerMatchers(MatchFinder *AstMatcher) {
|
||||
hasIntegerParam(1), hasIntegerParam(2),
|
||||
hasParamOfType(3, "LPSECURITY_ATTRIBUTES"),
|
||||
hasIntegerParam(4), hasIntegerParam(5),
|
||||
hasParamOfType(6, "HANDLE"))))))))
|
||||
hasParamOfType(6, "HANDLE")))))),
|
||||
unless(isInWhitelistForFopenUsage())))
|
||||
.bind("funcCall"),
|
||||
this);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user