Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

clang-tidy readability-identifier-naming should ignore namespaces created in system libraries #25205

Open Quuxplusone opened 8 years ago

Quuxplusone commented 8 years ago
Bugzilla Link PR25206
Status NEW
Importance P normal
Reported by Gonzalo BG (gonzalo.gadeschi@gmail.com)
Reported on 2015-10-16 12:01:47 -0700
Last modified on 2015-11-06 03:35:03 -0800
Version unspecified
Hardware PC Linux
CC alexfh@google.com, djasper@google.com, klimek@google.com
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also

When reopening namespaces of system/thirdparty libraries (like std) in my own code, the check readability-identifier-naming complains if they do not follow the same convention as my code.

Since this happens often, and typically one cannot do anything about it, the sane thing should be to not complain on namespaces that are "viewed" for the first time in system headers.

Quuxplusone commented 8 years ago
To double-check. Here's the situation:

a.h (known to be a system header to clang):
namespace x { ... }

b.cpp:
#include "a.h"
namespace x {
class A;
}

Do you want the check to ignore naming style violations in namespace x in file
b.cpp (e.g. x::A)?

There's one little issue with this approach: what if the "std" namespace, for
example, is used in a user header that happens to be included first?
Quuxplusone commented 8 years ago

Do you want the check to ignore naming style violations in namespace x in file b.cpp (e.g. x::A)?

Yes.

There's one little issue with this approach: what if the "std" namespace, for example, is used in a user header that happens to be included first?

I'd argue that this situation is not common, but clang-tidy cannot do anything about this anyways.

I still would like clang-tidy to recognize this when it can though.