[PATCH] D127434: [clang][dataflow] In `optional` model, match call return via hasType
Yitzhak Mandelbaum via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 9 12:28:28 PDT 2022
ymandel added a comment.
Is there a test you can add that would cover this change?
================
Comment at: clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp:170
+ // multiple overloads of `hasType` match.
+ ast_matchers::internal::Matcher<Type> typeMatcher = anyOf(
+ optionalOrAliasType(), referenceType(pointee(optionalOrAliasType())));
----------------
Since we're `using` the `ast_matchers` namespace, no need to qualify. Also, there's a type alias `TypeMatcher` that's not in the internal namespace which would be good here. That said, I'd use `QualType` and write it like this:
```
auto TypeMatcher = qualType(anyOf(...));
```
Or, I think even better in this case, just inline it:
```
callExpr(hasType(anyOf(...)))
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127434/new/
https://reviews.llvm.org/D127434
More information about the cfe-commits
mailing list