llvm-project/clang-tools-extra/clang-tidy
Jonas Toth d1bd01c318 [clang-tidy] Add modernize-concat-nested-namespaces check
Summary:
Finds instances of namespaces concatenated using explicit syntax, such as `namespace a { namespace b { [...] }}` and offers fix to glue it to `namespace a::b { [...] }`.

Properly handles `inline` and unnamed namespaces. ~~Also, detects empty blocks in nested namespaces and offers to remove them.~~

Test with common use cases included.
I ran the check against entire llvm repository. Except for expected `nested namespace definitions only available with -std=c++17 or -std=gnu++17` warnings I noticed no issues when the check was performed.

Example:
```
namespace a { namespace b {
void test();
}}

```
can become
```
namespace a::b {
void test();
}
```

Patch by wgml!

Reviewers: alexfh, aaron.ballman, hokein

Reviewed By: aaron.ballman

Subscribers: JonasToth, Eugene.Zelenko, lebedev.ri, mgorny, xazax.hun, cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 343000
2018-09-25 18:12:28 +00:00
..
abseil [Clang-tidy] Alphabetical sort of files/checks. Add space after clang-tidy in source code headers. 2018-09-20 00:02:55 +00:00
android [Clang-tidy] Alphabetical sort of files/checks. Add space after clang-tidy in source code headers. 2018-09-20 00:02:55 +00:00
boost Port getLocStart -> getBeginLoc 2018-08-09 22:42:26 +00:00
bugprone [clang-tidy] Recognize [[clang::reinitializes]] attribute in bugprone-use-after-move 2018-08-13 14:24:52 +00:00
cert Port getLocStart -> getBeginLoc 2018-08-09 22:42:26 +00:00
cppcoreguidelines [Clang-tidy] Alphabetical sort of files/checks. Add space after clang-tidy in source code headers. 2018-09-20 00:02:55 +00:00
fuchsia Port getLocEnd -> getEndLoc 2018-08-09 22:43:02 +00:00
google Port getLocEnd -> getEndLoc 2018-08-09 22:43:02 +00:00
hicpp [Clang-tidy] Alphabetical sort of files/checks. Add space after clang-tidy in source code headers. 2018-09-20 00:02:55 +00:00
llvm Port getLocEnd -> getEndLoc 2018-08-09 22:43:02 +00:00
misc [Clang-tidy] Alphabetical sort of files/checks. Add space after clang-tidy in source code headers. 2018-09-20 00:02:55 +00:00
modernize [clang-tidy] Add modernize-concat-nested-namespaces check 2018-09-25 18:12:28 +00:00
mpi modernize-use-auto NFC fixes 2016-12-14 15:29:23 +00:00
objc [clang-tidy/ObjC] Update list of acronyms in PropertyDeclarationCheck 2018-09-07 22:02:38 +00:00
performance [clang-tidy] Remove duplicated logic in UnnecessaryValueParamCheck and use FunctionParmMutationAnalyzer instead. 2018-09-17 17:59:51 +00:00
plugin [clang-tidy] add all clang-tidy modules to plugin 2018-07-31 15:23:49 +00:00
portability [clang-tidy] Add "portability" module and rename readability-simd-intrinsics to portability-simd-intrinsics 2018-03-07 16:57:42 +00:00
readability [Clang-tidy] Alphabetical sort of files/checks. Add space after clang-tidy in source code headers. 2018-09-20 00:02:55 +00:00
tool [clang-tidy] run-clang-tidy.py - fails using python 3.7 2018-09-19 11:52:20 +00:00
utils [clangtidy] Remove old copy of ExprMutationAnalyzer 2018-09-11 22:59:46 +00:00
zircon [clang-tidy] Add Zircon module to clang-tidy 2018-03-14 23:47:50 +00:00
CMakeLists.txt [clang-tidy] Profile is a per-AST (per-TU) data. 2018-05-08 13:14:21 +00:00
ClangTidy.cpp Fix reported range of partial token replacement 2018-09-06 20:16:34 +00:00
ClangTidy.h [clang-tidy] Store checks profiling info as JSON files 2018-06-06 15:07:51 +00:00
ClangTidyDiagnosticConsumer.cpp [clang-tidy] Store checks profiling info as JSON files 2018-06-06 15:07:51 +00:00
ClangTidyDiagnosticConsumer.h [clang-tidy] Store checks profiling info as JSON files 2018-06-06 15:07:51 +00:00
ClangTidyModule.cpp Change getChecksFilter() interface to hide implementation details. 2017-05-17 14:39:47 +00:00
ClangTidyModule.h [clang-tools-extra] Format sources with clang-format. NFC. 2016-11-08 07:50:19 +00:00
ClangTidyModuleRegistry.h Reapply r276973 "Adjust Registry interface to not require plugins to export a registry" 2016-08-05 11:01:08 +00:00
ClangTidyOptions.cpp [clang-tools-extra] Update uses of DEBUG macro to LLVM_DEBUG. 2018-05-15 16:37:45 +00:00
ClangTidyOptions.h [clang-tidy] Remove AnalyzeTemporaryDtors option. 2018-05-03 14:40:37 +00:00
ClangTidyProfiling.cpp [clang-tidy] Store checks profiling info as JSON files 2018-06-06 15:07:51 +00:00
ClangTidyProfiling.h [clang-tidy] Store checks profiling info as JSON files 2018-06-06 15:07:51 +00:00
add_new_check.py [Clang-tidy] Alphabetical sort of files/checks. Add space after clang-tidy in source code headers. 2018-09-20 00:02:55 +00:00
rename_check.py [clang-tidy] Use :doc: for check links in Release Notes. 2018-03-21 17:06:13 +00:00