]> granicus.if.org Git - clang/commit
Do not inline methods of C++ containers (coming from headers).
authorAnna Zaks <ganna@apple.com>
Fri, 27 Jun 2014 01:03:05 +0000 (01:03 +0000)
committerAnna Zaks <ganna@apple.com>
Fri, 27 Jun 2014 01:03:05 +0000 (01:03 +0000)
commita3911af74fa0314c5be721397997b422f9cbb07c
treecd961b6ae67fefe1d279159176c20cfd66fe9585
parent20eceba4ac8acf7f30675294df58d5c5e236419a
Do not inline methods of C++ containers (coming from headers).

This silences false positives (leaks, use of uninitialized value) in simple
code that uses containers such as std::vector and std::list. The analyzer
cannot reason about the internal invariances of those data structures which
leads to false positives. Until we come up with a better solution to that
problem, let's just not inline the methods of the containers and allow objects
to escape whenever such methods are called.

This just extends an already existing flag "c++-container-inlining" and applies
the heuristic not only to constructors and destructors of the containers, but
to all of their methods.

We have a bunch of distinct user reports all related to this issue
(radar://16058651, radar://16580751, radar://16384286, radar://16795491
[PR19637]).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211832 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
test/Analysis/inlining/containers.cpp