///
/// \c namedDecl(hasStdIteratorName()) matches \c I and \c CI.
AST_MATCHER(NamedDecl, hasStdIteratorName) {
- static const char *IteratorNames[] = {
+ static const char *const IteratorNames[] = {
"iterator",
"reverse_iterator",
"const_iterator",
/// \c recordDecl(hasStdContainerName()) matches \c vector and \c forward_list
/// but not \c my_vec.
AST_MATCHER(NamedDecl, hasStdContainerName) {
- static const char *ContainerNames[] = {
+ static const char *const ContainerNames[] = {
"array",
"deque",
"forward_list",
static cl::OptionCategory IncludeExcludeCategory("Inclusion/Exclusion Options");
static cl::OptionCategory SerializeCategory("Serialization Options");
-static const cl::OptionCategory *VisibleCategories[] = {
+static const cl::OptionCategory *const VisibleCategories[] = {
&GeneralCategory, &FormattingCategory, &IncludeExcludeCategory,
&SerializeCategory, &TransformCategory, &TransformsOptionsCategory,
};
namespace {
static const char *AnalyzerCheckNamePrefix = "clang-analyzer-";
-static StringRef StaticAnalyzerChecks[] = {
+static const StringRef StaticAnalyzerChecks[] = {
#define GET_CHECKERS
#define CHECKER(FULLNAME, CLASS, DESCFILE, HELPTEXT, GROUPINDEX, HIDDEN) \
FULLNAME,
const auto* Method = Result.Nodes.getNodeAs<CXXMethodDecl>("method");
std::string Name = Method->getParent()->getName();
- static const char *Messages[][2] = {
+ static const char *const Messages[][2] = {
{"ReturnType", "operator=() should return '%0&'"},
{"ArgumentType", "operator=() should take '%0 const&', '%0&&' or '%0'"},
{"cv", "operator=() should not be marked '%1'"}
// users can add their own elements to the list. However, it may require some
// extra thought since POSIX types and FILE types are usable in different ways.
bool isPOSIXTypeName(StringRef ClassName) {
- static const char *TypeNames[] = {
+ static const char *const TypeNames[] = {
"::pthread_cond_t",
"::pthread_mutex_t",
"pthread_cond_t",
}
bool isFILETypeName(StringRef ClassName) {
- static const char *TypeNames[] = {
+ static const char *const TypeNames[] = {
"::FILE",
"FILE",
"std::FILE"
namespace clang {
namespace {
bool isShrinkableContainer(llvm::StringRef ClassName) {
- static const char *Shrinkables[] = {
+ static const char *const Shrinkables[] = {
"std::basic_string",
"std::deque",
"std::vector"
///
/// namedDecl(hasStdIteratorName()) matches \c I and \c CI.
AST_MATCHER(NamedDecl, hasStdIteratorName) {
- static const char *IteratorNames[] = {"iterator", "reverse_iterator",
- "const_iterator",
- "const_reverse_iterator"};
+ static const char *const IteratorNames[] = {"iterator", "reverse_iterator",
+ "const_iterator",
+ "const_reverse_iterator"};
for (const char *Name : IteratorNames) {
if (hasName(Name).matches(Node, Finder, Builder))
/// recordDecl(hasStdContainerName()) matches \c vector and \c forward_list
/// but not \c my_vec.
AST_MATCHER(NamedDecl, hasStdContainerName) {
- static const char *ContainerNames[] = {"array", "deque",
- "forward_list", "list",
- "vector",
+ static const char *const ContainerNames[] = {"array", "deque",
+ "forward_list", "list",
+ "vector",
- "map", "multimap",
- "set", "multiset",
+ "map", "multimap",
+ "set", "multiset",
- "unordered_map", "unordered_multimap",
- "unordered_set", "unordered_multiset",
+ "unordered_map",
+ "unordered_multimap",
+ "unordered_set",
+ "unordered_multiset",
- "queue", "priority_queue",
- "stack"};
+ "queue", "priority_queue",
+ "stack"};
for (const char *Name : ContainerNames) {
if (hasName(Name).matches(Node, Finder, Builder))
using namespace clang::ast_matchers;
static bool isContainer(llvm::StringRef ClassName) {
- static const char *ContainerNames[] = {
+ static const char *const ContainerNames[] = {
"std::array",
"std::deque",
"std::forward_list",
// Reserved keywords in module.modulemap syntax.
// Keep in sync with keywords in module map parser in Lex/ModuleMap.cpp,
// such as in ModuleMapParser::consumeToken().
-static const char *ReservedNames[] = {
+static const char *const ReservedNames[] = {
"config_macros", "export", "module", "conflict", "framework",
"requires", "exclude", "header", "private", "explicit",
"link", "umbrella", "extern", "use", nullptr // Flag end.
// Enum string tables.
// FileChangeReason strings.
-static const char *FileChangeReasonStrings[] = {
+static const char *const FileChangeReasonStrings[] = {
"EnterFile", "ExitFile", "SystemHeaderPragma", "RenameFile"
};
// CharacteristicKind strings.
-static const char *CharacteristicKindStrings[] = { "C_User", "C_System",
- "C_ExternCSystem" };
+static const char *const CharacteristicKindStrings[] = { "C_User", "C_System",
+ "C_ExternCSystem" };
// MacroDirective::Kind strings.
-static const char *MacroDirectiveKindStrings[] = { "MD_Define", "MD_Undefine",
- "MD_Visibility" };
+static const char *const MacroDirectiveKindStrings[] = {
+ "MD_Define","MD_Undefine", "MD_Visibility"
+};
// PragmaIntroducerKind strings.
-static const char *PragmaIntroducerKindStrings[] = { "PIK_HashPragma",
- "PIK__Pragma",
- "PIK___pragma" };
+static const char *const PragmaIntroducerKindStrings[] = { "PIK_HashPragma",
+ "PIK__Pragma",
+ "PIK___pragma" };
// PragmaMessageKind strings.
-static const char *PragmaMessageKindStrings[] = { "PMK_Message", "PMK_Warning",
- "PMK_Error" };
+static const char *const PragmaMessageKindStrings[] = {
+ "PMK_Message", "PMK_Warning", "PMK_Error"
+};
// ConditionValueKind strings.
-static const char *ConditionValueKindStrings[] = {"CVK_NotEvaluated",
- "CVK_False", "CVK_True"};
+static const char *const ConditionValueKindStrings[] = {
+ "CVK_NotEvaluated", "CVK_False", "CVK_True"
+};
// Mapping strings.
-static const char *MappingStrings[] = { "0", "MAP_IGNORE",
- "MAP_REMARK", "MAP_WARNING",
- "MAP_ERROR", "MAP_FATAL" };
+static const char *const MappingStrings[] = { "0", "MAP_IGNORE",
+ "MAP_REMARK", "MAP_WARNING",
+ "MAP_ERROR", "MAP_FATAL" };
// PPCallbacksTracker functions.
// Append an enum argument to the top trace item.
void PPCallbacksTracker::appendArgument(const char *Name, int Value,
- const char *Strings[]) {
+ const char *const Strings[]) {
appendArgument(Name, Strings[Value]);
}
void appendArgument(const char *Name, const clang::Token &Value);
/// \brief Append an enum argument to the top trace item.
- void appendArgument(const char *Name, int Value, const char *Strings[]);
+ void appendArgument(const char *Name, int Value, const char *const Strings[]);
/// \brief Append a FileID argument to the top trace item.
void appendArgument(const char *Name, clang::FileID Value);