зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1479232 - Only use one matcher for varDecl and parmVarDecl r=andi
ParmVarDecl being a subclass of VarDecl, using two matchers then caused ScopeChecker::check to be called twice for ParmVarDecl nodes, once for each match. But the code in ScopeCheck::check is written with the assumption that it's called only once for such nodes. Somehow, this didn't cause problems with clang up to version 6, but makes the plugin spuriously warn about already_AddRefed not being used as temporaries when used as argument in function declarations, with clang 7. Differential Revision: https://phabricator.services.mozilla.com/D6360 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
94188a7073
Коммит
0848e2d157
|
@ -11,7 +11,6 @@ void ScopeChecker::registerMatchers(MatchFinder *AstMatcher) {
|
|||
AstMatcher->addMatcher(materializeTemporaryExpr().bind("node"), this);
|
||||
AstMatcher->addMatcher(
|
||||
callExpr(callee(functionDecl(heapAllocator()))).bind("node"), this);
|
||||
AstMatcher->addMatcher(parmVarDecl().bind("parm_vardecl"), this);
|
||||
}
|
||||
|
||||
// These enum variants determine whether an allocation has occured in the code.
|
||||
|
@ -37,7 +36,7 @@ void ScopeChecker::check(const MatchFinder::MatchResult &Result) {
|
|||
QualType T;
|
||||
|
||||
if (const ParmVarDecl *D =
|
||||
Result.Nodes.getNodeAs<ParmVarDecl>("parm_vardecl")) {
|
||||
Result.Nodes.getNodeAs<ParmVarDecl>("node")) {
|
||||
if (D->hasUnparsedDefaultArg() || D->hasUninstantiatedDefaultArg()) {
|
||||
return;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче