[clang-tools-extra] r230950 - [clang-tidy] Refactor: Move misc clang-tidy checks to namespace clang::tidy::misc
Alexander Kornienko
alexfh at google.com
Mon Mar 2 04:25:04 PST 2015
Author: alexfh
Date: Mon Mar 2 06:25:03 2015
New Revision: 230950
URL: http://llvm.org/viewvc/llvm-project?rev=230950&view=rev
Log:
[clang-tidy] Refactor: Move misc clang-tidy checks to namespace clang::tidy::misc
clang-tidy checks are organized into modules. This refactoring moves the misc
module checks into the namespace clang::tidy::misc
http://reviews.llvm.org/D7996
Patch by Richard Thomson!
Modified:
clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.h
clang-tools-extra/trunk/clang-tidy/misc/AssignOperatorSignatureCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/AssignOperatorSignatureCheck.h
clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversion.cpp
clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversion.h
clang-tools-extra/trunk/clang-tidy/misc/InaccurateEraseCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/InaccurateEraseCheck.h
clang-tools-extra/trunk/clang-tidy/misc/InefficientAlgorithmCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/InefficientAlgorithmCheck.h
clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp
clang-tools-extra/trunk/clang-tidy/misc/SwappedArgumentsCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/SwappedArgumentsCheck.h
clang-tools-extra/trunk/clang-tidy/misc/UndelegatedConstructor.cpp
clang-tools-extra/trunk/clang-tidy/misc/UndelegatedConstructor.h
clang-tools-extra/trunk/clang-tidy/misc/UniqueptrResetRelease.cpp
clang-tools-extra/trunk/clang-tidy/misc/UniqueptrResetRelease.h
clang-tools-extra/trunk/clang-tidy/misc/UnusedRAII.cpp
clang-tools-extra/trunk/clang-tidy/misc/UnusedRAII.h
clang-tools-extra/trunk/clang-tidy/misc/UseOverride.cpp
clang-tools-extra/trunk/clang-tidy/misc/UseOverride.h
clang-tools-extra/trunk/unittests/clang-tidy/MiscModuleTest.cpp
Modified: clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.cpp?rev=230950&r1=230949&r2=230950&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.cpp Mon Mar 2 06:25:03 2015
@@ -17,6 +17,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
+namespace misc {
ArgumentCommentCheck::ArgumentCommentCheck(StringRef Name,
ClangTidyContext *Context)
@@ -181,5 +182,6 @@ void ArgumentCommentCheck::check(const M
}
}
+} // namespace misc
} // namespace tidy
} // namespace clang
Modified: clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.h?rev=230950&r1=230949&r2=230950&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.h Mon Mar 2 06:25:03 2015
@@ -15,6 +15,7 @@
namespace clang {
namespace tidy {
+namespace misc {
/// \brief Checks that argument comments match parameter names.
class ArgumentCommentCheck : public ClangTidyCheck {
@@ -36,6 +37,7 @@ private:
llvm::ArrayRef<const Expr *> Args);
};
+} // namespace misc
} // namespace tidy
} // namespace clang
Modified: clang-tools-extra/trunk/clang-tidy/misc/AssignOperatorSignatureCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/AssignOperatorSignatureCheck.cpp?rev=230950&r1=230949&r2=230950&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/AssignOperatorSignatureCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/AssignOperatorSignatureCheck.cpp Mon Mar 2 06:25:03 2015
@@ -15,6 +15,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
+namespace misc {
void AssignOperatorSignatureCheck::registerMatchers(
ast_matchers::MatchFinder *Finder) {
@@ -63,5 +64,6 @@ void AssignOperatorSignatureCheck::check
}
}
+} // namespace misc
} // namespace tidy
} // namespace clang
Modified: clang-tools-extra/trunk/clang-tidy/misc/AssignOperatorSignatureCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/AssignOperatorSignatureCheck.h?rev=230950&r1=230949&r2=230950&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/AssignOperatorSignatureCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/AssignOperatorSignatureCheck.h Mon Mar 2 06:25:03 2015
@@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
+namespace misc {
/// \brief Finds declarations of assign operators with the wrong return and/or
/// argument types.
@@ -29,6 +30,7 @@ public:
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
+} // namespace misc
} // namespace tidy
} // namespace clang
Modified: clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversion.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversion.cpp?rev=230950&r1=230949&r2=230950&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversion.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversion.cpp Mon Mar 2 06:25:03 2015
@@ -22,6 +22,7 @@ AST_MATCHER(QualType, isBoolean) { retur
} // namespace ast_matchers
namespace tidy {
+namespace misc {
void BoolPointerImplicitConversion::registerMatchers(MatchFinder *Finder) {
// Look for ifs that have an implicit bool* to bool conversion in the
@@ -71,5 +72,6 @@ BoolPointerImplicitConversion::check(con
<< FixItHint::CreateInsertion(Var->getLocStart(), "*");
}
+} // namespace misc
} // namespace tidy
} // namespace clang
Modified: clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversion.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversion.h?rev=230950&r1=230949&r2=230950&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversion.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversion.h Mon Mar 2 06:25:03 2015
@@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
+namespace misc {
/// \brief Checks for conditions based on implicit conversion from a bool
/// pointer to bool e.g.
@@ -29,6 +30,7 @@ public:
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
+} // namespace misc
} // namespace tidy
} // namespace clang
Modified: clang-tools-extra/trunk/clang-tidy/misc/InaccurateEraseCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/InaccurateEraseCheck.cpp?rev=230950&r1=230949&r2=230950&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/InaccurateEraseCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/InaccurateEraseCheck.cpp Mon Mar 2 06:25:03 2015
@@ -16,6 +16,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
+namespace misc {
void InaccurateEraseCheck::registerMatchers(MatchFinder *Finder) {
const auto CheckForEndCall = hasArgument(
@@ -60,5 +61,6 @@ void InaccurateEraseCheck::check(const M
<< Hint;
}
+} // namespace misc
} // namespace tidy
} // namespace clang
Modified: clang-tools-extra/trunk/clang-tidy/misc/InaccurateEraseCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/InaccurateEraseCheck.h?rev=230950&r1=230949&r2=230950&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/InaccurateEraseCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/InaccurateEraseCheck.h Mon Mar 2 06:25:03 2015
@@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
+namespace misc {
/// \brief Checks for inaccurate use of \c erase() method.
///
@@ -30,6 +31,7 @@ public:
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
+} // namespace misc
} // namespace tidy
} // namespace clang
Modified: clang-tools-extra/trunk/clang-tidy/misc/InefficientAlgorithmCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/InefficientAlgorithmCheck.cpp?rev=230950&r1=230949&r2=230950&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/InefficientAlgorithmCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/InefficientAlgorithmCheck.cpp Mon Mar 2 06:25:03 2015
@@ -16,6 +16,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
+namespace misc {
static bool areTypesCompatible(QualType Left, QualType Right) {
if (const auto *LeftRefType = Left->getAs<ReferenceType>())
@@ -123,5 +124,6 @@ void InefficientAlgorithmCheck::check(co
<< Hint;
}
+} // namespace misc
} // namespace tidy
} // namespace clang
Modified: clang-tools-extra/trunk/clang-tidy/misc/InefficientAlgorithmCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/InefficientAlgorithmCheck.h?rev=230950&r1=230949&r2=230950&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/InefficientAlgorithmCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/InefficientAlgorithmCheck.h Mon Mar 2 06:25:03 2015
@@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
+namespace misc {
/// \brief Warns on inefficient use of STL algorithms on associative containers.
///
@@ -28,6 +29,7 @@ public:
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
+} // namespace misc
} // namespace tidy
} // namespace clang
Modified: clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp?rev=230950&r1=230949&r2=230950&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp Mon Mar 2 06:25:03 2015
@@ -25,6 +25,7 @@
namespace clang {
namespace tidy {
+namespace misc {
class MiscModule : public ClangTidyModule {
public:
@@ -53,8 +54,10 @@ public:
}
};
+} // namespace misc
+
// Register the MiscTidyModule using this statically initialized variable.
-static ClangTidyModuleRegistry::Add<MiscModule>
+static ClangTidyModuleRegistry::Add<misc::MiscModule>
X("misc-module", "Adds miscellaneous lint checks.");
// This anchor is used to force the linker to link in the generated object file
Modified: clang-tools-extra/trunk/clang-tidy/misc/SwappedArgumentsCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/SwappedArgumentsCheck.cpp?rev=230950&r1=230949&r2=230950&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/SwappedArgumentsCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/SwappedArgumentsCheck.cpp Mon Mar 2 06:25:03 2015
@@ -16,6 +16,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
+namespace misc {
void SwappedArgumentsCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(callExpr().bind("call"), this);
@@ -121,5 +122,6 @@ void SwappedArgumentsCheck::check(const
}
}
+} // namespace misc
} // namespace tidy
} // namespace clang
Modified: clang-tools-extra/trunk/clang-tidy/misc/SwappedArgumentsCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/SwappedArgumentsCheck.h?rev=230950&r1=230949&r2=230950&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/SwappedArgumentsCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/SwappedArgumentsCheck.h Mon Mar 2 06:25:03 2015
@@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
+namespace misc {
/// \brief Finds potentially swapped arguments by looking at implicit
/// conversions.
@@ -25,8 +26,8 @@ public:
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
+} // namespace misc
} // namespace tidy
} // namespace clang
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_SWAPPED_ARGUMENTS_CHECK_H
-
Modified: clang-tools-extra/trunk/clang-tidy/misc/UndelegatedConstructor.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/UndelegatedConstructor.cpp?rev=230950&r1=230949&r2=230950&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/UndelegatedConstructor.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/UndelegatedConstructor.cpp Mon Mar 2 06:25:03 2015
@@ -46,6 +46,7 @@ AST_MATCHER_P(CXXRecordDecl, baseOfBound
} // namespace ast_matchers
namespace tidy {
+namespace misc {
void UndelegatedConstructorCheck::registerMatchers(MatchFinder *Finder) {
// We look for calls to constructors of the same type in constructors. To do
@@ -70,5 +71,6 @@ void UndelegatedConstructorCheck::check(
"A temporary object is created here instead");
}
+} // namespace misc
} // namespace tidy
} // namespace clang
Modified: clang-tools-extra/trunk/clang-tidy/misc/UndelegatedConstructor.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/UndelegatedConstructor.h?rev=230950&r1=230949&r2=230950&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/UndelegatedConstructor.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/UndelegatedConstructor.h Mon Mar 2 06:25:03 2015
@@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
+namespace misc {
/// \brief Finds creation of temporary objects in constructors that look like a
/// function call to another constructor of the same class. The user most likely
@@ -26,6 +27,7 @@ public:
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
+} // namespace misc
} // namespace tidy
} // namespace clang
Modified: clang-tools-extra/trunk/clang-tidy/misc/UniqueptrResetRelease.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/UniqueptrResetRelease.cpp?rev=230950&r1=230949&r2=230950&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/UniqueptrResetRelease.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/UniqueptrResetRelease.cpp Mon Mar 2 06:25:03 2015
@@ -15,6 +15,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
+namespace misc {
void UniqueptrResetRelease::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(
@@ -62,5 +63,6 @@ void UniqueptrResetRelease::check(const
CharSourceRange::getTokenRange(ResetCall->getSourceRange()), NewText);
}
+} // namespace misc
} // namespace tidy
} // namespace clang
Modified: clang-tools-extra/trunk/clang-tidy/misc/UniqueptrResetRelease.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/UniqueptrResetRelease.h?rev=230950&r1=230949&r2=230950&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/UniqueptrResetRelease.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/UniqueptrResetRelease.h Mon Mar 2 06:25:03 2015
@@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
+namespace misc {
/// \brief Find and replace unique_ptr::reset(release()) with std::move
///
@@ -32,6 +33,7 @@ public:
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
+} // namespace misc
} // namespace tidy
} // namespace clang
Modified: clang-tools-extra/trunk/clang-tidy/misc/UnusedRAII.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/UnusedRAII.cpp?rev=230950&r1=230949&r2=230950&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/UnusedRAII.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/UnusedRAII.cpp Mon Mar 2 06:25:03 2015
@@ -22,6 +22,7 @@ AST_MATCHER(CXXRecordDecl, hasUserDeclar
} // namespace ast_matchers
namespace tidy {
+namespace misc {
void UnusedRAIICheck::registerMatchers(MatchFinder *Finder) {
// Look for temporaries that are constructed in-place and immediately
@@ -79,5 +80,6 @@ void UnusedRAIICheck::check(const MatchF
Replacement);
}
+} // namespace misc
} // namespace tidy
} // namespace clang
Modified: clang-tools-extra/trunk/clang-tidy/misc/UnusedRAII.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/UnusedRAII.h?rev=230950&r1=230949&r2=230950&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/UnusedRAII.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/UnusedRAII.h Mon Mar 2 06:25:03 2015
@@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
+namespace misc {
/// \brief Finds temporaries that look like RAII objects.
///
@@ -43,6 +44,7 @@ public:
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
+} // namespace misc
} // namespace tidy
} // namespace clang
Modified: clang-tools-extra/trunk/clang-tidy/misc/UseOverride.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/UseOverride.cpp?rev=230950&r1=230949&r2=230950&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/UseOverride.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/UseOverride.cpp Mon Mar 2 06:25:03 2015
@@ -16,6 +16,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
+namespace misc {
void UseOverride::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(methodDecl(isOverride()).bind("method"), this);
@@ -175,5 +176,6 @@ void UseOverride::check(const MatchFinde
}
}
+} // namespace misc
} // namespace tidy
} // namespace clang
Modified: clang-tools-extra/trunk/clang-tidy/misc/UseOverride.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/UseOverride.h?rev=230950&r1=230949&r2=230950&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/UseOverride.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/UseOverride.h Mon Mar 2 06:25:03 2015
@@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
+namespace misc {
/// \brief Use C++11's 'override' and remove 'virtual' where applicable.
class UseOverride : public ClangTidyCheck {
@@ -24,8 +25,8 @@ public:
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
+} // namespace misc
} // namespace tidy
} // namespace clang
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_USE_OVERRIDE_H
-
Modified: clang-tools-extra/trunk/unittests/clang-tidy/MiscModuleTest.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clang-tidy/MiscModuleTest.cpp?rev=230950&r1=230949&r2=230950&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clang-tidy/MiscModuleTest.cpp (original)
+++ clang-tools-extra/trunk/unittests/clang-tidy/MiscModuleTest.cpp Mon Mar 2 06:25:03 2015
@@ -6,6 +6,8 @@ namespace clang {
namespace tidy {
namespace test {
+using misc::ArgumentCommentCheck;
+
TEST(ArgumentCommentCheckTest, CorrectComments) {
EXPECT_NO_CHANGES(ArgumentCommentCheck,
"void f(int x, int y); void g() { f(/*x=*/0, /*y=*/0); }");
More information about the cfe-commits
mailing list