spread 'const' love to some variables. this considerably reduces the amount of dirty data around.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91002 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclarationName.cpp b/lib/AST/DeclarationName.cpp
index 3471657..0ce03c2 100644
--- a/lib/AST/DeclarationName.cpp
+++ b/lib/AST/DeclarationName.cpp
@@ -338,7 +338,7 @@
DeclarationName DeclarationName::getUsingDirectiveName() {
// Single instance of DeclarationNameExtra for using-directive
- static DeclarationNameExtra UDirExtra =
+ static const DeclarationNameExtra UDirExtra =
{ DeclarationNameExtra::CXXUsingDirective };
uintptr_t Ptr = reinterpret_cast<uintptr_t>(&UDirExtra);
diff --git a/lib/Driver/DriverOptions.cpp b/lib/Driver/DriverOptions.cpp
index d1af95c..72aaf56 100644
--- a/lib/Driver/DriverOptions.cpp
+++ b/lib/Driver/DriverOptions.cpp
@@ -14,7 +14,7 @@
using namespace clang::driver;
using namespace clang::driver::options;
-static OptTable::Info InfoTable[] = {
+static const OptTable::Info InfoTable[] = {
#define OPTION(NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \
HELPTEXT, METAVAR) \
{ NAME, HELPTEXT, METAVAR, Option::KIND##Class, FLAGS, PARAM, \
diff --git a/lib/Driver/Types.cpp b/lib/Driver/Types.cpp
index 3397677..433af03 100644
--- a/lib/Driver/Types.cpp
+++ b/lib/Driver/Types.cpp
@@ -23,7 +23,7 @@
ID PreprocessedType;
};
-static TypeInfo TypeInfos[] = {
+static const TypeInfo TypeInfos[] = {
#define TYPE(NAME, ID, PP_TYPE, TEMP_SUFFIX, FLAGS) \
{ NAME, FLAGS, TEMP_SUFFIX, TY_##PP_TYPE, },
#include "clang/Driver/Types.def"
@@ -31,7 +31,7 @@
};
static const unsigned numTypes = sizeof(TypeInfos) / sizeof(TypeInfos[0]);
-static TypeInfo &getInfo(unsigned id) {
+static const TypeInfo &getInfo(unsigned id) {
assert(id > 0 && id - 1 < numTypes && "Invalid Type ID.");
return TypeInfos[id - 1];
}
diff --git a/lib/Frontend/LangStandards.cpp b/lib/Frontend/LangStandards.cpp
index 771a58c..08fd932 100644
--- a/lib/Frontend/LangStandards.cpp
+++ b/lib/Frontend/LangStandards.cpp
@@ -14,7 +14,7 @@
using namespace clang::frontend;
#define LANGSTANDARD(id, name, desc, features) \
- static LangStandard Lang_##id = { name, desc, features };
+ static const LangStandard Lang_##id = { name, desc, features };
#include "clang/Frontend/LangStandards.def"
const LangStandard &LangStandard::getLangStandardForKind(Kind K) {
diff --git a/lib/Parse/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp
index 0dbf37c..b827a48 100644
--- a/lib/Parse/ParseTemplate.cpp
+++ b/lib/Parse/ParseTemplate.cpp
@@ -522,7 +522,7 @@
if (Default.isInvalid()) {
Diag(Tok.getLocation(),
diag::err_default_template_template_parameter_not_template);
- static tok::TokenKind EndToks[] = {
+ static const tok::TokenKind EndToks[] = {
tok::comma, tok::greater, tok::greatergreater
};
SkipUntil(EndToks, 3, true, true);