Page MenuHomePhabricator

[analyzer] CallDescriptionMap: Support CXXOperatorCallExpr
Needs ReviewPublic

Authored by Charusso on Jun 3 2020, 12:55 AM.

Details

Reviewers
NoQ
Summary

-

Diff Detail

Event Timeline

Charusso created this revision.Jun 3 2020, 12:55 AM
NoQ added inline comments.Jul 2 2020, 8:15 AM
clang/lib/StaticAnalyzer/Core/CallEvent.cpp
379

We still need to check the qualified name in this case. Eg., { "std", "unique_ptr", OO_Deref } and { "std", "shared_ptr", OO_Deref } may require different handling.

NoQ added inline comments.Jul 2 2020, 8:21 AM
clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
1236–1240

Given the other comment, i suggest introducing the following overload: (ArrayRef<const char *> QualifiedName, OverloadedOperatorKind OOKind, Optional<unsigned> RequiredArgs = None, Optional<size_t> RequiredParams = None). Such overload is nice to read because the entire section that describes the name of the function stays together.

Let's not touch the overload with Flags for now because currently none of the flags apply to operators. We get there when we get there.

Mind that Signature in StdLibraryFunctionsChecker aims to achieve precise function call matching as well, and at the moment its a bit ahead. Some discussions can be found in D77410, D81745 and https://bugs.llvm.org/show_bug.cgi?id=46253.

NoQ added a comment.Jul 2 2020, 5:34 PM

Mind that Signature in StdLibraryFunctionsChecker aims to achieve precise function call matching as well, and at the moment its a bit ahead. Some discussions can be found in D77410, D81745 and https://bugs.llvm.org/show_bug.cgi?id=46253.

As of now that one is entirely about signatures; this patch is mostly about function names. We should absolutely merge the signature work from StdLibraryFunctionsChecker into CallDescriptionMap and then convert StdLibraryFunctionsChecker to use CallDescriptionMap. But it shouldn't block this patch from landing in any way.