[PATCH] D25024: [clang-tidy] Add check for detecting declarations with multiple names

Malcolm Parsons via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 3 14:14:54 PDT 2016


malcolm.parsons added inline comments.


> cppcoreguidelines-one-name-per-declaration.cpp:8
> +  {
> +    int x = 42, y = 43;
> +    // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: Do not declare multiple names per declaration [cppcoreguidelines-one-name-per-declaration]

The guideline says "Flag non-function arguments with multiple declarators involving declarator operators (e.g., int* p, q;)".

There are no declarator operators in this test, so there should be no warning.

> aaron.ballman wrote in cppcoreguidelines-one-name-per-declaration.cpp:16
> Please add tests that show the exceptions in the C++ Core Guidelines are properly handled. Also, I'd like to see tests with other named declarations, such as typedefs, template parameter lists, for loop initializers, etc.

and structured bindings (no warning).

https://reviews.llvm.org/D25024





More information about the cfe-commits mailing list