[clang-tools-extra] d57cf05 - [clang-tidy][NFC] Fix modernize-concat-nested-namespaces findings

Piotr Zegar via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 27 01:53:42 PDT 2023


Author: Piotr Zegar
Date: 2023-08-27T08:52:10Z
New Revision: d57cf05f9406b9136a5859a53042de8789cfd6aa

URL: https://github.com/llvm/llvm-project/commit/d57cf05f9406b9136a5859a53042de8789cfd6aa
DIFF: https://github.com/llvm/llvm-project/commit/d57cf05f9406b9136a5859a53042de8789cfd6aa.diff

LOG: [clang-tidy][NFC] Fix modernize-concat-nested-namespaces findings

Fix issues found by clang-tidy in clang-tidy source directory.

Added: 
    

Modified: 
    clang-tools-extra/clang-tidy/bugprone/MultipleNewInOneExpressionCheck.cpp
    clang-tools-extra/clang-tidy/bugprone/MultipleNewInOneExpressionCheck.h
    clang-tools-extra/clang-tidy/bugprone/UnsafeFunctionsCheck.cpp
    clang-tools-extra/clang-tidy/bugprone/UnsafeFunctionsCheck.h

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clang-tidy/bugprone/MultipleNewInOneExpressionCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/MultipleNewInOneExpressionCheck.cpp
index 47b96678599039..bd8a0b359c2e00 100644
--- a/clang-tools-extra/clang-tidy/bugprone/MultipleNewInOneExpressionCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/MultipleNewInOneExpressionCheck.cpp
@@ -12,7 +12,8 @@
 #include "clang/Lex/Lexer.h"
 
 using namespace clang::ast_matchers;
-using namespace clang;
+
+namespace clang::tidy::bugprone {
 
 namespace {
 
@@ -50,10 +51,6 @@ bool isExprValueStored(const Expr *E, ASTContext &C) {
 
 } // namespace
 
-namespace clang {
-namespace tidy {
-namespace bugprone {
-
 AST_MATCHER_P(CXXTryStmt, hasHandlerFor,
               ast_matchers::internal::Matcher<QualType>, InnerMatcher) {
   for (unsigned NH = Node.getNumHandlers(), I = 0; I < NH; ++I) {
@@ -157,6 +154,4 @@ void MultipleNewInOneExpressionCheck::check(
         << NewExpr1->getSourceRange() << NewExpr2->getSourceRange();
 }
 
-} // namespace bugprone
-} // namespace tidy
-} // namespace clang
+} // namespace clang::tidy::bugprone

diff  --git a/clang-tools-extra/clang-tidy/bugprone/MultipleNewInOneExpressionCheck.h b/clang-tools-extra/clang-tidy/bugprone/MultipleNewInOneExpressionCheck.h
index eba6c84d818caa..29eea12ff71921 100644
--- a/clang-tools-extra/clang-tidy/bugprone/MultipleNewInOneExpressionCheck.h
+++ b/clang-tools-extra/clang-tidy/bugprone/MultipleNewInOneExpressionCheck.h
@@ -11,9 +11,7 @@
 
 #include "../ClangTidyCheck.h"
 
-namespace clang {
-namespace tidy {
-namespace bugprone {
+namespace clang::tidy::bugprone {
 
 /// For the user-facing documentation see:
 /// http://clang.llvm.org/extra/clang-tidy/checks/bugprone/multiple-new-in-one-expression.html
@@ -28,8 +26,6 @@ class MultipleNewInOneExpressionCheck : public ClangTidyCheck {
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
 };
 
-} // namespace bugprone
-} // namespace tidy
-} // namespace clang
+} // namespace clang::tidy::bugprone
 
 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_MULTIPLENEWINONEEXPRESSIONCHECK_H

diff  --git a/clang-tools-extra/clang-tidy/bugprone/UnsafeFunctionsCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/UnsafeFunctionsCheck.cpp
index ebb49645b5904e..ea7eaa0b0ff811 100644
--- a/clang-tools-extra/clang-tidy/bugprone/UnsafeFunctionsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/UnsafeFunctionsCheck.cpp
@@ -16,9 +16,7 @@
 using namespace clang::ast_matchers;
 using namespace llvm;
 
-namespace clang {
-namespace tidy {
-namespace bugprone {
+namespace clang::tidy::bugprone {
 
 static constexpr llvm::StringLiteral OptionNameReportMoreUnsafeFunctions =
     "ReportMoreUnsafeFunctions";
@@ -233,6 +231,4 @@ void UnsafeFunctionsCheck::onEndOfTranslationUnit() {
   IsAnnexKAvailable.reset();
 }
 
-} // namespace bugprone
-} // namespace tidy
-} // namespace clang
+} // namespace clang::tidy::bugprone

diff  --git a/clang-tools-extra/clang-tidy/bugprone/UnsafeFunctionsCheck.h b/clang-tools-extra/clang-tidy/bugprone/UnsafeFunctionsCheck.h
index 369ea25f693cc0..5adfee60d1a7de 100644
--- a/clang-tools-extra/clang-tidy/bugprone/UnsafeFunctionsCheck.h
+++ b/clang-tools-extra/clang-tidy/bugprone/UnsafeFunctionsCheck.h
@@ -12,9 +12,7 @@
 #include "../ClangTidyCheck.h"
 #include <optional>
 
-namespace clang {
-namespace tidy {
-namespace bugprone {
+namespace clang::tidy::bugprone {
 
 /// Checks for functions that have safer, more secure replacements available, or
 /// are considered deprecated due to design flaws. This check relies heavily on,
@@ -45,8 +43,6 @@ class UnsafeFunctionsCheck : public ClangTidyCheck {
   std::optional<bool> IsAnnexKAvailable;
 };
 
-} // namespace bugprone
-} // namespace tidy
-} // namespace clang
+} // namespace clang::tidy::bugprone
 
 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_UNSAFEFUNCTIONSCHECK_H


        


More information about the cfe-commits mailing list