Go to file
Alexander Kornienko eec01adde3 [clang-tidy] Update IdentifierNamingCheck to remove extra leading/trailing underscores
Summary:
The goal of this change is to fix the following suboptimal replacements currently suggested by clang-tidy:
```
// with MemberPrefix == "_"
int __foo;  // accepted without complaint
```
```
// with MemberPrefix == "m_"
int _foo;
    ^~~~~~
    m__foo
```

I fixed this by
- updating `matchesStyle()` to reject names which have a leading underscore after a prefix has already been stripped, or a trailing underscore if a suffix has already been stripped;
- updating `fixupWithStyle()` to strip leading & trailing underscores before adding the user-defined prefix and suffix.

The replacements are now:
```
// MemberPrefix == "_"
int __foo;
    ^~~~~~
    _foo
```
```
// MemberPrefix == "m_"
int _foo;
    ^~~~~
    m_foo
```

Future improvements might elect to add .clang-tidy flags to improve what is being stripped. For instance, stripping `m_` could allow `m_foo` to be automatically replaced with `_foo`.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: cfe-commits

Patch by Jacob Bandes-Storch!

Differential Revision: https://reviews.llvm.org/D32333

llvm-svn: 301431
2017-04-26 16:39:11 +00:00
clang Revert "Update to LLVM's use of WeakTrackingVH; NFC" 2017-04-26 16:37:51 +00:00
clang-tools-extra [clang-tidy] Update IdentifierNamingCheck to remove extra leading/trailing underscores 2017-04-26 16:39:11 +00:00
compiler-rt [test] Build sanitizer/xray tests only if COMPILER_RT_BUILD_* is on 2017-04-26 07:35:36 +00:00
debuginfo-tests Add additional CHECKs to safestack.c. 2017-04-17 17:57:05 +00:00
libclc math: Implement sinh function 2017-02-25 02:46:53 +00:00
libcxx Add missing acquire_load to call_once overload. 2017-04-23 16:58:48 +00:00
libcxxabi Fix PR25874 - cxa_thread_atexit_test.pass.cpp has an incorrect XFAIL. 2017-04-20 23:40:35 +00:00
libunwind [CMake][libunwind] Fix the -target and -gcc-toolchain flag handling 2017-04-16 06:08:44 +00:00
lld Make LLD work even if the current directory is not writable. 2017-04-26 16:15:07 +00:00
lldb Initial implementation of SB APIs for Tracing support. 2017-04-26 08:48:50 +00:00
llgo benchcomp: Add a mode for analyzing file sizes. 2017-04-03 19:13:12 +00:00
llvm Reverts commit r301424, r301425 and r301426 2017-04-26 16:37:05 +00:00
openmp Fix Hwloc API Incompatibility 2017-04-25 19:04:07 +00:00
parallel-libs [Axccel] Remove -Wno-missing-braces in build 2016-12-19 21:34:07 +00:00
polly [DeLICM] Use Known information when comparing Existing.Occupied and Proposed.Occupied. 2017-04-25 10:57:32 +00:00