mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-28 18:54:55 +00:00
Apply performance-unnecessary-value-param to clang-tidy.
With minor manual tweaks. No functionality change intended. llvm-svn: 272795
This commit is contained in:
parent
7b4ab98b03
commit
51a9cc9ce7
@ -18,7 +18,7 @@ namespace tidy {
|
||||
|
||||
void ClangTidyCheckFactories::registerCheckFactory(StringRef Name,
|
||||
CheckFactory Factory) {
|
||||
Factories[Name] = Factory;
|
||||
Factories[Name] = std::move(Factory);
|
||||
}
|
||||
|
||||
void ClangTidyCheckFactories::createChecks(
|
||||
|
@ -29,7 +29,8 @@ void ExplicitConstructorCheck::registerMatchers(MatchFinder *Finder) {
|
||||
|
||||
// Looks for the token matching the predicate and returns the range of the found
|
||||
// token including trailing whitespace.
|
||||
static SourceRange FindToken(const SourceManager &Sources, LangOptions LangOpts,
|
||||
static SourceRange FindToken(const SourceManager &Sources,
|
||||
const LangOptions &LangOpts,
|
||||
SourceLocation StartLoc, SourceLocation EndLoc,
|
||||
bool (*Pred)(const Token &)) {
|
||||
if (StartLoc.isMacroID() || EndLoc.isMacroID())
|
||||
|
@ -21,14 +21,14 @@ namespace misc {
|
||||
namespace {
|
||||
|
||||
ast_matchers::internal::BindableMatcher<Stmt>
|
||||
handleFrom(ast_matchers::internal::Matcher<RecordDecl> IsAHandle,
|
||||
ast_matchers::internal::Matcher<Expr> Arg) {
|
||||
handleFrom(const ast_matchers::internal::Matcher<RecordDecl> &IsAHandle,
|
||||
const ast_matchers::internal::Matcher<Expr> &Arg) {
|
||||
return cxxConstructExpr(hasDeclaration(cxxMethodDecl(ofClass(IsAHandle))),
|
||||
hasArgument(0, Arg));
|
||||
}
|
||||
|
||||
ast_matchers::internal::Matcher<Stmt> handleFromTemporaryValue(
|
||||
ast_matchers::internal::Matcher<RecordDecl> IsAHandle) {
|
||||
const ast_matchers::internal::Matcher<RecordDecl> &IsAHandle) {
|
||||
// If a ternary operator returns a temporary value, then both branches hold a
|
||||
// temporary value. If one of them is not a temporary then it must be copied
|
||||
// into one to satisfy the type of the operator.
|
||||
@ -54,8 +54,8 @@ ast_matchers::internal::Matcher<RecordDecl> isAMap() {
|
||||
"::std::unordered_multimap");
|
||||
}
|
||||
|
||||
ast_matchers::internal::BindableMatcher<Stmt>
|
||||
makeContainerMatcher(ast_matchers::internal::Matcher<RecordDecl> IsAHandle) {
|
||||
ast_matchers::internal::BindableMatcher<Stmt> makeContainerMatcher(
|
||||
const ast_matchers::internal::Matcher<RecordDecl> &IsAHandle) {
|
||||
// This matcher could be expanded to detect:
|
||||
// - Constructors: eg. vector<string_view>(3, string("A"));
|
||||
// - emplace*(): This requires a different logic to determine that
|
||||
|
@ -186,7 +186,7 @@ getParameterSourceDeclaration(const FunctionDecl *OriginalDeclaration) {
|
||||
|
||||
std::string joinParameterNames(
|
||||
const DifferingParamsContainer &DifferingParams,
|
||||
std::function<StringRef(const DifferingParamInfo &)> ChooseParamName) {
|
||||
llvm::function_ref<StringRef(const DifferingParamInfo &)> ChooseParamName) {
|
||||
llvm::SmallVector<char, 40> Buffer;
|
||||
llvm::raw_svector_ostream Str(Buffer);
|
||||
bool First = true;
|
||||
|
@ -18,7 +18,7 @@ namespace tidy {
|
||||
namespace readability {
|
||||
|
||||
namespace {
|
||||
internal::Matcher<Expr> callToGet(internal::Matcher<Decl> OnClass) {
|
||||
internal::Matcher<Expr> callToGet(const internal::Matcher<Decl> &OnClass) {
|
||||
return cxxMemberCallExpr(
|
||||
on(expr(anyOf(hasType(OnClass),
|
||||
hasType(qualType(
|
||||
|
@ -338,7 +338,7 @@ static int clangTidyMain(int argc, const char **argv) {
|
||||
return 1;
|
||||
}
|
||||
llvm::outs() << "Enabled checks:";
|
||||
for (auto CheckName : EnabledChecks)
|
||||
for (const auto &CheckName : EnabledChecks)
|
||||
llvm::outs() << "\n " << CheckName;
|
||||
llvm::outs() << "\n\n";
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user