samestep added a comment.

A test would definitely be good, but I'm not sure how to add one to 
`UncheckedOptionalAccessModelTest.cpp`, since the issue disappears when we 
replace `std::unique_ptr` with our custom simple `smart_ptr`. Any ideas?



================
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())));
----------------
ymandel wrote:
> 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(...)))
> ```
I initially tried inlining it like you suggested, but got a compile error about 
multiple matching overloads. Adding `qualType` fixed that though, thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127434/new/

https://reviews.llvm.org/D127434

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to