r186314 - Add 'static' and 'const' qualifiers to some arrays of strings.
Craig Topper
craig.topper at gmail.com
Mon Jul 15 01:24:27 PDT 2013
Author: ctopper
Date: Mon Jul 15 03:24:27 2013
New Revision: 186314
URL: http://llvm.org/viewvc/llvm-project?rev=186314&view=rev
Log:
Add 'static' and 'const' qualifiers to some arrays of strings.
Modified:
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/Format/BreakableToken.cpp
cfe/trunk/lib/Sema/SemaLookup.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=186314&r1=186313&r2=186314&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Mon Jul 15 03:24:27 2013
@@ -4511,7 +4511,7 @@ QualType ASTContext::getBlockDescriptorT
UnsignedLongTy,
};
- const char *FieldNames[] = {
+ static const char *const FieldNames[] = {
"reserved",
"Size"
};
@@ -4552,7 +4552,7 @@ QualType ASTContext::getBlockDescriptorE
getPointerType(VoidPtrTy)
};
- const char *FieldNames[] = {
+ static const char *const FieldNames[] = {
"reserved",
"Size",
"CopyFuncPtr",
Modified: cfe/trunk/lib/Format/BreakableToken.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/BreakableToken.cpp?rev=186314&r1=186313&r2=186314&view=diff
==============================================================================
--- cfe/trunk/lib/Format/BreakableToken.cpp (original)
+++ cfe/trunk/lib/Format/BreakableToken.cpp Mon Jul 15 03:24:27 2013
@@ -167,7 +167,7 @@ void BreakableStringLiteral::insertBreak
}
static StringRef getLineCommentPrefix(StringRef Comment) {
- const char *KnownPrefixes[] = { "/// ", "///", "// ", "//" };
+ static const char *const KnownPrefixes[] = { "/// ", "///", "// ", "//" };
for (size_t i = 0, e = llvm::array_lengthof(KnownPrefixes); i != e; ++i)
if (Comment.startswith(KnownPrefixes[i]))
return KnownPrefixes[i];
Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=186314&r1=186313&r2=186314&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Mon Jul 15 03:24:27 2013
@@ -3616,7 +3616,7 @@ static void AddKeywordsToConsumer(Sema &
if (CCC.WantTypeSpecifiers) {
// Add type-specifier keywords to the set of results.
- const char *CTypeSpecs[] = {
+ static const char *const CTypeSpecs[] = {
"char", "const", "double", "enum", "float", "int", "long", "short",
"signed", "struct", "union", "unsigned", "void", "volatile",
"_Complex", "_Imaginary",
@@ -3668,7 +3668,7 @@ static void AddKeywordsToConsumer(Sema &
}
if (SemaRef.getLangOpts().CPlusPlus) {
- const char *CXXExprs[] = {
+ static const char *const CXXExprs[] = {
"delete", "new", "operator", "throw", "typeid"
};
const unsigned NumCXXExprs = llvm::array_lengthof(CXXExprs);
@@ -3695,7 +3695,7 @@ static void AddKeywordsToConsumer(Sema &
if (CCC.WantRemainingKeywords) {
if (SemaRef.getCurFunctionOrMethodDecl() || SemaRef.getCurBlock()) {
// Statements.
- const char *CStmts[] = {
+ static const char *const CStmts[] = {
"do", "else", "for", "goto", "if", "return", "switch", "while" };
const unsigned NumCStmts = llvm::array_lengthof(CStmts);
for (unsigned I = 0; I != NumCStmts; ++I)
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp?rev=186314&r1=186313&r2=186314&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp Mon Jul 15 03:24:27 2013
@@ -100,7 +100,7 @@ public:
}
void dump(raw_ostream &OS) const {
- static const char *Table[] = {
+ static const char *const Table[] = {
"Allocated",
"Released",
"Relinquished"
More information about the cfe-commits
mailing list