]> granicus.if.org Git - clang/commitdiff
Add 'static' and 'const' qualifiers to some arrays of strings.
authorCraig Topper <craig.topper@gmail.com>
Mon, 15 Jul 2013 08:24:27 +0000 (08:24 +0000)
committerCraig Topper <craig.topper@gmail.com>
Mon, 15 Jul 2013 08:24:27 +0000 (08:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186314 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTContext.cpp
lib/Format/BreakableToken.cpp
lib/Sema/SemaLookup.cpp
lib/StaticAnalyzer/Checkers/MallocChecker.cpp

index 7938d6a29277cbb862959d54629def52e77d2dbe..8984c3c96dd098f89c9e2ae1deac7be402708dad 100644 (file)
@@ -4511,7 +4511,7 @@ QualType ASTContext::getBlockDescriptorType() const {
     UnsignedLongTy,
   };
 
-  const char *FieldNames[] = {
+  static const char *const FieldNames[] = {
     "reserved",
     "Size"
   };
@@ -4552,7 +4552,7 @@ QualType ASTContext::getBlockDescriptorExtendedType() const {
     getPointerType(VoidPtrTy)
   };
 
-  const char *FieldNames[] = {
+  static const char *const FieldNames[] = {
     "reserved",
     "Size",
     "CopyFuncPtr",
index 816fd237bbac4f4ebf878ee5deade5a1ca5e7080..3b2913779831ce47d4ac305b179ffa6f32d880e5 100644 (file)
@@ -167,7 +167,7 @@ void BreakableStringLiteral::insertBreak(unsigned LineIndex,
 }
 
 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];
index cd3968d8b11d6d5d6f5ff329019b00017a98d4e9..3769c14c0b2f743ceae1cd61ecc17e488c694c6b 100644 (file)
@@ -3616,7 +3616,7 @@ static void AddKeywordsToConsumer(Sema &SemaRef,
 
   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 &SemaRef,
     }
 
     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 &SemaRef,
   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)
index 1229a326fdf6fdea6c7c0c6b33be58dd3efaf4e5..c357a66ea2ca1611f4659e1ba3edbe49f6132c03 100644 (file)
@@ -100,7 +100,7 @@ public:
   }
 
   void dump(raw_ostream &OS) const {
-    static const char *Table[] = {
+    static const char *const Table[] = {
       "Allocated",
       "Released",
       "Relinquished"