diff options
| author | Anna Zaks <ganna@apple.com> | 2014-06-27 01:03:05 +0000 |
|---|---|---|
| committer | Anna Zaks <ganna@apple.com> | 2014-06-27 01:03:05 +0000 |
| commit | a3911af74fa0314c5be721397997b422f9cbb07c (patch) | |
| tree | cd961b6ae67fefe1d279159176c20cfd66fe9585 /include | |
| parent | 20eceba4ac8acf7f30675294df58d5c5e236419a (diff) | |
| download | clang-a3911af74fa0314c5be721397997b422f9cbb07c.tar.gz clang-a3911af74fa0314c5be721397997b422f9cbb07c.tar.bz2 clang-a3911af74fa0314c5be721397997b422f9cbb07c.tar.xz | |
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
Diffstat (limited to 'include')
| -rw-r--r-- | include/clang/StaticAnalyzer/Core/AnalyzerOptions.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h b/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h index 520fed08e3..978c3e20ab 100644 --- a/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h +++ b/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h @@ -202,8 +202,8 @@ private: /// \sa mayInlineCXXAllocator Optional<bool> InlineCXXAllocator; - /// \sa mayInlineCXXContainerCtorsAndDtors - Optional<bool> InlineCXXContainerCtorsAndDtors; + /// \sa mayInlineCXXContainerMethods + Optional<bool> InlineCXXContainerMethods; /// \sa mayInlineCXXSharedPtrDtor Optional<bool> InlineCXXSharedPtrDtor; @@ -303,12 +303,12 @@ public: /// accepts the values "true" and "false". bool mayInlineCXXAllocator(); - /// Returns whether or not constructors and destructors of C++ container - /// objects may be considered for inlining. + /// Returns whether or not methods of C++ container objects may be considered + /// for inlining. /// /// This is controlled by the 'c++-container-inlining' config option, which /// accepts the values "true" and "false". - bool mayInlineCXXContainerCtorsAndDtors(); + bool mayInlineCXXContainerMethods(); /// Returns whether or not the destructor of C++ 'shared_ptr' may be /// considered for inlining. |
