[clang-tidy] Extend 'bugprone-easily-swappable-parameters' with optionally...
[clang-tidy] Extend 'bugprone-easily-swappable-parameters' with optionally considering differently qualified types mixable Adds a relaxation option QualifiersMix which will make the check report for cases where parameters refer to the same type if they only differ in qualifiers. This makes cases, such as the following, not warned about by default, produce a warning. void* memcpy(void* dst, const void* src, unsigned size) {} However, unless people meticulously const their local variables, unfortunately, even such a function carry a potential swap: T* obj = new T; // Not const!!! void* buf = malloc(sizeof(T)); memcpy(obj, buf, sizeof(T)); // ^~~ ^~~ accidental swap here, even though the interface "specified" a const. Reviewed By: aaron.ballman Differential Revision: http://reviews.llvm.org/D96355
Loading
Please register or sign in to comment