Skip to content

Commit

Permalink
[clang-tidy][NFC] Use C++17 nested namespaces in clang-tidy headers
Browse files Browse the repository at this point in the history
We forgot to apply the change to headers in the previous patch,
due to missing "-header-filter" in the run-clang-tidy invocation.

Differential Revision: https://reviews.llvm.org/D142307
  • Loading branch information
carlosgalvezp committed Jan 23, 2023
1 parent 136f778 commit 4718da5
Show file tree
Hide file tree
Showing 343 changed files with 688 additions and 2,065 deletions.
6 changes: 2 additions & 4 deletions clang-tools-extra/clang-tidy/ClangTidyForceLinker.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
#include "clang-tidy-config.h"
#include "llvm/Support/Compiler.h"

namespace clang {
namespace tidy {
namespace clang::tidy {

// This anchor is used to force the linker to link the AbseilModule.
extern volatile int AbseilModuleAnchorSource;
Expand Down Expand Up @@ -138,7 +137,6 @@ extern volatile int ZirconModuleAnchorSource;
static int LLVM_ATTRIBUTE_UNUSED ZirconModuleAnchorDestination =
ZirconModuleAnchorSource;

} // namespace tidy
} // namespace clang
} // namespace clang::tidy

#endif
6 changes: 2 additions & 4 deletions clang-tools-extra/clang-tidy/ClangTidyModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
#include <functional>
#include <memory>

namespace clang {
namespace tidy {
namespace clang::tidy {

class ClangTidyCheck;
class ClangTidyContext;
Expand Down Expand Up @@ -94,7 +93,6 @@ class ClangTidyModule {
virtual ClangTidyOptions getModuleOptions();
};

} // end namespace tidy
} // end namespace clang
} // namespace clang::tidy

#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYMODULE_H
6 changes: 2 additions & 4 deletions clang-tools-extra/clang-tidy/ClangTidyModuleRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@
#include "ClangTidyModule.h"
#include "llvm/Support/Registry.h"

namespace clang {
namespace tidy {
namespace clang::tidy {

typedef llvm::Registry<ClangTidyModule> ClangTidyModuleRegistry;

} // end namespace tidy
} // end namespace clang
} // namespace clang::tidy

#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYMODULEREGISTRY_H
6 changes: 2 additions & 4 deletions clang-tools-extra/clang-tidy/ClangTidyOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
#include <utility>
#include <vector>

namespace clang {
namespace tidy {
namespace clang::tidy {

/// Contains a list of line ranges in a single file.
struct FileFilter {
Expand Down Expand Up @@ -328,7 +327,6 @@ parseConfigurationWithDiags(llvm::MemoryBufferRef Config, DiagCallback Handler);
/// Serializes configuration to a YAML-encoded string.
std::string configurationAsText(const ClangTidyOptions &Options);

} // end namespace tidy
} // end namespace clang
} // namespace clang::tidy

#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYOPTIONS_H
6 changes: 2 additions & 4 deletions clang-tools-extra/clang-tidy/ClangTidyProfiling.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ namespace llvm {
class raw_ostream;
} // namespace llvm

namespace clang {
namespace tidy {
namespace clang::tidy {

class ClangTidyProfiling {
public:
Expand Down Expand Up @@ -54,7 +53,6 @@ class ClangTidyProfiling {
~ClangTidyProfiling();
};

} // end namespace tidy
} // end namespace clang
} // namespace clang::tidy

#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYPROFILING_H
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@
#include "clang/Lex/Preprocessor.h"
#include "llvm/ADT/DenseSet.h"

namespace llvm {
namespace vfs {
namespace llvm::vfs {
class OverlayFileSystem;
class InMemoryFileSystem;
} // namespace vfs
} // namespace llvm
} // namespace llvm::vfs

namespace clang {
class CompilerInstance;
Expand Down
6 changes: 2 additions & 4 deletions clang-tools-extra/clang-tidy/GlobList.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Regex.h"

namespace clang {
namespace tidy {
namespace clang::tidy {

/// Read-only set of strings represented as a list of positive and negative
/// globs.
Expand Down Expand Up @@ -62,7 +61,6 @@ class CachedGlobList final : public GlobList {
mutable llvm::StringMap<bool> Cache;
};

} // namespace tidy
} // namespace clang
} // namespace clang::tidy

#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GLOBLIST_H
12 changes: 4 additions & 8 deletions clang-tools-extra/clang-tidy/NoLintDirectiveHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,15 @@
#include "llvm/ADT/StringRef.h"
#include <memory>

namespace clang {
namespace tooling {
namespace clang::tooling {
struct Diagnostic;
} // namespace tooling
} // namespace clang
} // namespace clang::tooling

namespace llvm {
template <typename T> class SmallVectorImpl;
} // namespace llvm

namespace clang {
namespace tidy {
namespace clang::tidy {

/// This class is used to locate NOLINT comments in the file being analyzed, to
/// decide whether a diagnostic should be suppressed.
Expand All @@ -45,7 +42,6 @@ class NoLintDirectiveHandler {
std::unique_ptr<Impl> PImpl;
};

} // namespace tidy
} // namespace clang
} // namespace clang::tidy

#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_NOLINTDIRECTIVEHANDLER_H
6 changes: 2 additions & 4 deletions clang-tools-extra/clang-tidy/abseil/AbseilMatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include <algorithm>

namespace clang {
namespace ast_matchers {
namespace clang::ast_matchers {

/// Matches AST nodes that were found within Abseil files.
///
Expand Down Expand Up @@ -57,5 +56,4 @@ AST_POLYMORPHIC_MATCHER(
});
}

} // namespace ast_matchers
} // namespace clang
} // namespace clang::ast_matchers
8 changes: 2 additions & 6 deletions clang-tools-extra/clang-tidy/abseil/CleanupCtadCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

#include "../utils/TransformerClangTidyCheck.h"

namespace clang {
namespace tidy {
namespace abseil {
namespace clang::tidy::abseil {

/// Suggests switching the initialization pattern of `absl::Cleanup`
/// instances from the factory function to class template argument
Expand All @@ -30,8 +28,6 @@ class CleanupCtadCheck : public utils::TransformerClangTidyCheck {
}
};

} // namespace abseil
} // namespace tidy
} // namespace clang
} // namespace clang::tidy::abseil

#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_CLEANUPCTADCHECK_H
8 changes: 2 additions & 6 deletions clang-tools-extra/clang-tidy/abseil/DurationAdditionCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

#include "../ClangTidyCheck.h"

namespace clang {
namespace tidy {
namespace abseil {
namespace clang::tidy::abseil {

/// Checks for cases where addition should be performed in the
/// ``absl::Time`` domain.
Expand All @@ -28,8 +26,6 @@ class DurationAdditionCheck : public ClangTidyCheck {
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};

} // namespace abseil
} // namespace tidy
} // namespace clang
} // namespace clang::tidy::abseil

#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_TIMEADDITIONCHECK_H
8 changes: 2 additions & 6 deletions clang-tools-extra/clang-tidy/abseil/DurationComparisonCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

#include "../ClangTidyCheck.h"

namespace clang {
namespace tidy {
namespace abseil {
namespace clang::tidy::abseil {

/// Prefer comparison in the absl::Duration domain instead of the numeric
/// domain.
Expand All @@ -28,8 +26,6 @@ class DurationComparisonCheck : public ClangTidyCheck {
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};

} // namespace abseil
} // namespace tidy
} // namespace clang
} // namespace clang::tidy::abseil

#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_DURATIONCOMPARISONCHECK_H
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

#include "../ClangTidyCheck.h"

namespace clang {
namespace tidy {
namespace abseil {
namespace clang::tidy::abseil {

/// Checks for casts of ``absl::Duration`` conversion functions, and recommends
/// the right conversion function instead.
Expand All @@ -28,8 +26,6 @@ class DurationConversionCastCheck : public ClangTidyCheck {
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};

} // namespace abseil
} // namespace tidy
} // namespace clang
} // namespace clang::tidy::abseil

#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_DURATIONCONVERSIONCASTCHECK_H
8 changes: 2 additions & 6 deletions clang-tools-extra/clang-tidy/abseil/DurationDivisionCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

#include "../ClangTidyCheck.h"

namespace clang {
namespace tidy {
namespace abseil {
namespace clang::tidy::abseil {

// Find potential incorrect uses of integer division of absl::Duration objects.
//
Expand All @@ -30,8 +28,6 @@ class DurationDivisionCheck : public ClangTidyCheck {
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};

} // namespace abseil
} // namespace tidy
} // namespace clang
} // namespace clang::tidy::abseil

#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_DURATIONDIVISIONCHECK_H_
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

#include "../ClangTidyCheck.h"

namespace clang {
namespace tidy {
namespace abseil {
namespace clang::tidy::abseil {

/// This check finds cases where `Duration` factories are being called with
/// floating point arguments, but could be called using integer arguments.
Expand All @@ -30,8 +28,6 @@ class DurationFactoryFloatCheck : public ClangTidyCheck {
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};

} // namespace abseil
} // namespace tidy
} // namespace clang
} // namespace clang::tidy::abseil

#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_DURATIONFACTORYFLOATCHECK_H
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

#include "../ClangTidyCheck.h"

namespace clang {
namespace tidy {
namespace abseil {
namespace clang::tidy::abseil {

/// This check finds cases where the incorrect `Duration` factory function is
/// being used by looking for scaling constants inside the factory argument
Expand All @@ -30,8 +28,6 @@ class DurationFactoryScaleCheck : public ClangTidyCheck {
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};

} // namespace abseil
} // namespace tidy
} // namespace clang
} // namespace clang::tidy::abseil

#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_DURATIONFACTORYSCALECHECK_H
8 changes: 2 additions & 6 deletions clang-tools-extra/clang-tidy/abseil/DurationRewriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
#include <cinttypes>
#include <optional>

namespace clang {
namespace tidy {
namespace abseil {
namespace clang::tidy::abseil {

/// Duration factory and conversion scales
enum class DurationScale : std::uint8_t {
Expand Down Expand Up @@ -135,8 +133,6 @@ AST_MATCHER_FUNCTION_P(ast_matchers::internal::Matcher<Stmt>,
hasEitherOperand(ignoringImpCasts(callExpr(callee(funcDecl)))));
}

} // namespace abseil
} // namespace tidy
} // namespace clang
} // namespace clang::tidy::abseil

#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_DURATIONREWRITER_H
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

#include "../ClangTidyCheck.h"

namespace clang {
namespace tidy {
namespace abseil {
namespace clang::tidy::abseil {

/// Checks for cases where subtraction should be performed in the
/// `absl::Duration` domain.
Expand All @@ -28,8 +26,6 @@ class DurationSubtractionCheck : public ClangTidyCheck {
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};

} // namespace abseil
} // namespace tidy
} // namespace clang
} // namespace clang::tidy::abseil

#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_DURATIONSUBTRACTIONCHECK_H
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

#include "../ClangTidyCheck.h"

namespace clang {
namespace tidy {
namespace abseil {
namespace clang::tidy::abseil {

/// Finds and fixes cases where ``absl::Duration`` values are being converted
/// to numeric types and back again.
Expand All @@ -28,8 +26,6 @@ class DurationUnnecessaryConversionCheck : public ClangTidyCheck {
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};

} // namespace abseil
} // namespace tidy
} // namespace clang
} // namespace clang::tidy::abseil

#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_TIMEDOUBLECONVERSIONCHECK_H
Loading

0 comments on commit 4718da5

Please sign in to comment.