[PATCH] D62441: [analyzer] Introduce a convenient CallDescriptionMap class.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 24 19:59:03 PDT 2019


NoQ created this revision.
NoQ added reviewers: dcoughlin, xazax.hun, a_sidorin, rnkovacs, mikhail.ramalho, Szelethus, baloghadamsoftware, Charusso.
Herald added subscribers: cfe-commits, dkrupp, donat.nagy, a.sidorin, szepet, mgorny.
Herald added a project: clang.

> "When choosing a container, remember vector is best;
>  Leave a comment to explain if you choose from the rest!"
> 
> -Tony Van Eerd, Postmodern C++ <https://www.youtube.com/watch?v=QTLn3goa3A8>.

`CallDescriptionMap` would encapsulate the procedure of figuring out if any of the supported `CallDescription`s apply to a given `CallEvent`. Without such facility i constantly worry about somebody bashing me on reviews for using slow string switches and stuff. However when a `CallDescription` isn't a simple string, a linear lookup is almost unavoidable. So even though for now i only implement a linear lookup, i guess with a single interface we can later afford a string-map optimization specifically for simple `CallDescription`s.

I also add a few unittests for `CallDescription` with the help of this class.


Repository:
  rC Clang

https://reviews.llvm.org/D62441

Files:
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
  clang/unittests/StaticAnalyzer/CMakeLists.txt
  clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp
  clang/unittests/StaticAnalyzer/Reusables.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62441.201381.patch
Type: text/x-patch
Size: 10185 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190525/510f8724/attachment.bin>


More information about the cfe-commits mailing list