]> granicus.if.org Git - clang/commit
[analyzer] For now, don't inline [cd]tors of C++ containers.
authorJordan Rose <jordan_rose@apple.com>
Tue, 2 Apr 2013 00:26:35 +0000 (00:26 +0000)
committerJordan Rose <jordan_rose@apple.com>
Tue, 2 Apr 2013 00:26:35 +0000 (00:26 +0000)
commitc63a460d78a7625ff38d2b3580f78030c44f07db
tree92f8f273c29d583cb32ed3fabc63c67cd5473937
parentc9092bb5eb67d859122abb69a0ef61e9249500cd
[analyzer] For now, don't inline [cd]tors of C++ containers.

This is a heuristic to make up for the fact that the analyzer doesn't
model C++ containers very well. One example is modeling that
'std::distance(I, E) == 0' implies 'I == E'. In the future, it would be
nice to model this explicitly, but for now it just results in a lot of
false positives.

The actual heuristic checks if the base type has a member named 'begin' or
'iterator'. If so, we treat the constructors and destructors of that type
as opaque, rather than inlining them.

This is intended to drastically reduce the number of false positives
reported with experimental destructor support turned on. We can tweak the
heuristic in the future, but we'd rather err on the side of false negatives
for now.

<rdar://problem/13497258>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178516 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
test/Analysis/analyzer-config.cpp
test/Analysis/diagnostics/explicit-suppression.cpp
test/Analysis/inlining/containers.cpp [new file with mode: 0644]
test/Analysis/inlining/stl.cpp