[cfe-dev] Tests for Clang-tidy STL containers checks

Alexander Kornienko via cfe-dev cfe-dev at lists.llvm.org
Wed Dec 16 05:53:05 PST 2015


We mock out STL containers for multiple reasons. One of them is to make the
tests hermetic (as in "independent from the environment"). The developer
has to make the mocks appropriately model the implementation of the
standard library. If another implementation is sufficiently different, we
need to add mocks for that implementation as well. Making the tests use
actual library headers is problematic, since it will significantly increase
testing time and complicate integration with different tests environments.
So I'm strongly against this. We could make a mode where the actual headers
are used instead of mock implementations, but we're not going to remove
mocks completely.

Please file bugs for the specific issues you find. If you can isolate
specific differences between library implementations that result in
incorrect work of the checks (and maybe create the appropriate mocks for
the library you use), it would help check developers to fix their checks.

On Mon, Dec 14, 2015 at 10:08 PM, Eugene Zelenko via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hi!
>
> While working on LLDB code cleanup, I discovered that some of
> Clang-tidy STL containers checks don't work properly with LLVM STL
> implementation. More interesting discovery was that actual STL
> containers were not used in tests, but were replaced with code
> snippets.
>
> I think proper solution will be to use real STL headers and pass
> proper compiler flags from CMAKE_CXX_FLAGS when compiled with Clang
> and create -stdlib=libstdc++ --gcc-toolchain=<path> when compiled with
> GCC. Similar solution could be implemented for other compilers/STL
> implementations.
>
> Eugene.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151216/7eb68772/attachment-0001.html>


More information about the cfe-dev mailing list