[PATCH] D48027: [analyzer] Improve `CallDescription` to handle c++ method.

Reka Kovacs via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 21 08:59:00 PDT 2018


rnkovacs accepted this revision.
rnkovacs added a comment.

In https://reviews.llvm.org/D48027#1203944, @MTC wrote:

> However this approach has limit. Given the code below, we cannot distinguish whether the `basic_string` is user-defined struct or namespace. That's means when the user provide {"std", "basic_string", "append"}, we can only know the qualified name of the call sequentially contains `std`, `basic_string`, `append`. We don't know if these names come from `RecordDecl` or `NamespaceDecl`.
>
>   namespace  std {
>     namespace basic_string {
>       struct A {
>         void append() {}
>       };
>     }
>   }
>  
>   void foo() {
>     std::basic_string::A a;
>     a.append(); // Match
>   }
>
>
> @rnkovacs What do you think? Can this approach meet `InnerPointerChecker`'s needs?


I guess it is highly unlikely for someone to write namespaces like that, and if they do, I think they deserve to have them treated as a `std::string`.
Thanks, Henry, this is great!


https://reviews.llvm.org/D48027





More information about the cfe-commits mailing list