MaskRay added inline comments.

================
Comment at: 
clang-tools-extra/test/clang-tidy/checkers/portability-std-allocator-const.cpp:76
+void temp() {
+  std::vector<const T> v;
+  // CHECK-MESSAGES: [[#@LINE-1]]:8: warning: container
----------------
sammccall wrote:
> This case will always be an error, but isn't diagnosed until you see an 
> instantiation.
> 
> If it's important to catch these standalone e.g. when analyzing headers, you 
> could adapt the matcher like:
> 
> ```
> hasUnqualifiedDesugaredType(anyOf(
>   recordDecl(...), // current case
>   templateSpecializationType( // when dependent, TST is canonical
>     templateArgumentCountIs(1), // std::vector<const dependent>
>     hasTemplateArgument(0, refersToType(qualType(isConstQualified())))
>   )
> ))
> ```
Thanks for Sam's offline help! Incorporated this to the matcher.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123655

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

Reply via email to