Bug 1485588 - Part 2: Suppress warnings in a gtest file. r=andi

Depends on D81785

Differential Revision: https://phabricator.services.mozilla.com/D83681
This commit is contained in:
Jason Orendorff 2020-07-16 10:45:29 +00:00
Родитель e1d0ea24ed
Коммит 6faba34abd
2 изменённых файлов: 15 добавлений и 5 удалений

Просмотреть файл

@ -142,6 +142,18 @@ AST_MATCHER(CallExpr, isInWhitelistForFopenUsage) {
return llvm::sys::path::rbegin(FileName)->equals(Whitelist);
}
// This matcher will match any node in "gtest-port.h". This file is third-party
// code (and thus exempt from our rules prohibiting <ctypes.h>), but it's
// linked into $OBJDIR, so inThirdPartyPath() misclassifies it.
AST_MATCHER(Stmt, isAllowedToUseLocaleSpecificFunctions) {
static const char AllowedFile[] = "gtest-port.h";
SourceLocation Loc = Node.getBeginLoc();
StringRef FileName =
getFilename(Finder->getASTContext().getSourceManager(), Loc);
return llvm::sys::path::rbegin(FileName)->equals(AllowedFile);
}
/// 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) {

Просмотреть файл

@ -57,11 +57,9 @@ void NoLocaleSpecificChecker::registerMatchers(MatchFinder *AstMatcher) {
hasConstCharPtrParam(1),
hasIntegerParam(2)),
hasNameAndIntegerParam("tolower"),
hasNameAndIntegerParam("toupper")
)
)))
)
).bind("id"),
hasNameAndIntegerParam("toupper"))))),
unless(isAllowedToUseLocaleSpecificFunctions())))
.bind("id"),
this);
}