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

Henry Wong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 17 05:38:44 PDT 2018


MTC added a comment.

In https://reviews.llvm.org/D48027#1201248, @xazax.hun wrote:

> Generally looks good, I only wonder if this works well with inline namespaces. Could you test? Probably it will.


Thank you for reminding me! Yea, this can handle inline namespaces.

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?


https://reviews.llvm.org/D48027





More information about the cfe-commits mailing list