[all-commits] [llvm/llvm-project] 62e747: [analyzer] StdLibraryFunctionsChecker: Associate s...
Gabor Marton via All-commits
all-commits at lists.llvm.org
Tue Apr 28 01:01:18 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 62e747f6172942db0e9fd55a6a25f166f338459a
https://github.com/llvm/llvm-project/commit/62e747f6172942db0e9fd55a6a25f166f338459a
Author: Gabor Marton <gabor.marton at ericsson.com>
Date: 2020-04-28 (Tue, 28 Apr 2020)
Changed paths:
M clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
Log Message:
-----------
[analyzer] StdLibraryFunctionsChecker: Associate summaries to FunctionDecls
Summary:
Currently we map function summaries to names (i.e. strings). We can
associate more summaries with different signatures to one name, this way
we support overloading. During a call event we check whether the
signature of the summary matches the signature of the callee and we
apply the summary only in that case.
In this patch we change this mapping to associate a summary to a
FunctionDecl. We do lookup operations when the summary map is
initialized. We lookup the given name and we match the signature of the
given summary against the lookup results. If the summary matches the
FunctionDecl (got from the lookup result) then we add that to the
summary map. During a call event we compare FunctionDecl pointers.
Advantages of this new refactor:
- Cleaner mapping and structure for the checker.
- Possibly way more efficient handling of call events.
- A summary is added only if that is relevant for the given TU.
- We can get the concrete FunctionDecl by the time when we create the
summary, this opens up possibilities of further sanity checks
regarding the summary cases and argument constraints.
- Opens up to future work when we'd like to store summaries from IR to a
FunctionDecl (or from the Attributor results of the given
FunctionDecl).
Note, we cannot support old C functions without prototypes.
Reviewers: NoQ, Szelethus, balazske, jdoerfert, sstefan1, uenoku
Subscribers: whisperity, xazax.hun, baloghadamsoftware, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, gamesh411, Charusso, steakhal, uenoku, ASDenysPetrov, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D77641
More information about the All-commits
mailing list