Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Kitware
GitHub Repository: Kitware/CMake
Path: blob/master/Utilities/ClangTidyModule/StringConcatenationUseCmstrcatCheck.h
3148 views
1
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2
file LICENSE.rst or https://cmake.org/licensing for details. */
3
#pragma once
4
5
#include <clang-tidy/ClangTidyCheck.h>
6
#include <clang/ASTMatchers/ASTMatchFinder.h>
7
8
namespace clang {
9
namespace tidy {
10
namespace cmake {
11
class StringConcatenationUseCmstrcatCheck : public ClangTidyCheck
12
{
13
public:
14
StringConcatenationUseCmstrcatCheck(StringRef Name,
15
ClangTidyContext* Context);
16
void registerMatchers(ast_matchers::MatchFinder* Finder) override;
17
void check(ast_matchers::MatchFinder::MatchResult const& Result) override;
18
19
private:
20
enum class OperatorType
21
{
22
Plus,
23
PlusEquals
24
};
25
typedef std::pair<OperatorType, std::vector<CXXOperatorCallExpr const*>>
26
ExprChain;
27
std::map<CXXOperatorCallExpr const*, ExprChain> InProgressExprChains;
28
29
void issueCorrection(ExprChain const& ExprChain,
30
ast_matchers::MatchFinder::MatchResult const& Result);
31
};
32
}
33
}
34
}
35
36