llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.28k stars 12.1k forks source link

clang-analyzer-alpha.cplusplus.VirtualCall incompatible with mocking libraries #29315

Open llvmbot opened 8 years ago

llvmbot commented 8 years ago
Bugzilla Link 28945
Version unspecified
OS All
Reporter LLVM Bugzilla Contributor
CC @EugeneZelenko

Extended Description

Mocking libraries for C++ like http://hippomocks.com require functions be labeled as virtual to mock the code. clang-analyzer-alpha.cplusplus.VirtualCall however complains about functions being labeled virtual when the function is labeled virtual for mocking, and not because there is an issue with calling derived classes.

That being said... I understand the need for this check. The only solution I can think of (outside of updating the C++ spec to better account for mocking), would be to macro "virtual" for functions that only need virtual for unit testing, and then only analyze non-unit tested code, but this approach seems very anti-C++.

llvmbot commented 8 years ago

assigned to @tkremenek