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)
commitb8de0c4278b638163f6b5103b2eadcb6590f8dfd
tree04eb77aa35d53924bd503ebdc313d55a60606c0b
parent25dadfd2a84ca787f64196a826fc7114626a63b2
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]).

llvm-svn: 211832
clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
clang/test/Analysis/inlining/containers.cpp