зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1769494 - Exclude xpc from JSHandleRootedTypedefChecker r=andi
XPC also follows SpiderMonkey rule so it should be excluded for now. This will reduce a good amount of warnings. Differential Revision: https://phabricator.services.mozilla.com/D146497
This commit is contained in:
Родитель
96366c8a08
Коммит
2a6bc5e42d
|
@ -60,6 +60,17 @@ AST_POLYMORPHIC_MATCHER(isFirstParty,
|
|||
!ASTIsInSystemHeader(Finder->getASTContext(), Node);
|
||||
}
|
||||
|
||||
AST_MATCHER(DeclaratorDecl, isNotSpiderMonkey) {
|
||||
// Detect SpiderMonkey path. Not as strict as isFirstParty, but this is
|
||||
// expected to disappear soon by getting a common style guide between DOM and
|
||||
// SpiderMonkey.
|
||||
std::string Path = Node.getBeginLoc().printToString(
|
||||
Finder->getASTContext().getSourceManager());
|
||||
return Path.find("js") == std::string::npos &&
|
||||
Path.find("xpc") == std::string::npos &&
|
||||
Path.find("XPC") == std::string::npos;
|
||||
}
|
||||
|
||||
/// This matcher will match temporary expressions.
|
||||
/// We need this matcher for compatibility with clang 3.* (clang 4 and above
|
||||
/// insert a MaterializeTemporaryExpr everywhere).
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
|
||||
void JSHandleRootedTypedefChecker::registerMatchers(MatchFinder *AstMatcher) {
|
||||
AstMatcher->addMatcher(
|
||||
declaratorDecl(isUsingJSHandleRootedTypedef()).bind("declaratorDecl"),
|
||||
declaratorDecl(isUsingJSHandleRootedTypedef(), isNotSpiderMonkey())
|
||||
.bind("declaratorDecl"),
|
||||
this);
|
||||
}
|
||||
|
||||
|
@ -29,15 +30,6 @@ void JSHandleRootedTypedefChecker::check(
|
|||
const DeclaratorDecl *Declarator =
|
||||
Result.Nodes.getNodeAs<DeclaratorDecl>("declaratorDecl");
|
||||
|
||||
// Detect SpiderMonkey path. Admittedly hacky but works
|
||||
bool IsSpiderMonkey = Declarator->getBeginLoc()
|
||||
.printToString(Result.Context->getSourceManager())
|
||||
.find("js") != std::string::npos;
|
||||
if (IsSpiderMonkey) {
|
||||
// Using typedefs within SpiderMonkey is okay.
|
||||
return;
|
||||
}
|
||||
|
||||
std::string Replacement = getReplacement(Declarator->getType().getAsString());
|
||||
diag(Declarator->getBeginLoc(), Warning, DiagnosticIDs::Warning)
|
||||
<< FixItHint::CreateReplacement(
|
||||
|
|
Загрузка…
Ссылка в новой задаче