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
This commit is contained in:
Nuno Lopes 2009-12-10 00:07:02 +00:00
Родитель 8755ec3361
Коммит 68f7a24262
5 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -338,7 +338,7 @@ void DeclarationName::setFETokenInfo(void *T) {
DeclarationName DeclarationName::getUsingDirectiveName() { DeclarationName DeclarationName::getUsingDirectiveName() {
// Single instance of DeclarationNameExtra for using-directive // Single instance of DeclarationNameExtra for using-directive
static DeclarationNameExtra UDirExtra = static const DeclarationNameExtra UDirExtra =
{ DeclarationNameExtra::CXXUsingDirective }; { DeclarationNameExtra::CXXUsingDirective };
uintptr_t Ptr = reinterpret_cast<uintptr_t>(&UDirExtra); uintptr_t Ptr = reinterpret_cast<uintptr_t>(&UDirExtra);

Просмотреть файл

@ -14,7 +14,7 @@
using namespace clang::driver; using namespace clang::driver;
using namespace clang::driver::options; using namespace clang::driver::options;
static OptTable::Info InfoTable[] = { static const OptTable::Info InfoTable[] = {
#define OPTION(NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \ #define OPTION(NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \
HELPTEXT, METAVAR) \ HELPTEXT, METAVAR) \
{ NAME, HELPTEXT, METAVAR, Option::KIND##Class, FLAGS, PARAM, \ { NAME, HELPTEXT, METAVAR, Option::KIND##Class, FLAGS, PARAM, \

Просмотреть файл

@ -23,7 +23,7 @@ struct TypeInfo {
ID PreprocessedType; ID PreprocessedType;
}; };
static TypeInfo TypeInfos[] = { static const TypeInfo TypeInfos[] = {
#define TYPE(NAME, ID, PP_TYPE, TEMP_SUFFIX, FLAGS) \ #define TYPE(NAME, ID, PP_TYPE, TEMP_SUFFIX, FLAGS) \
{ NAME, FLAGS, TEMP_SUFFIX, TY_##PP_TYPE, }, { NAME, FLAGS, TEMP_SUFFIX, TY_##PP_TYPE, },
#include "clang/Driver/Types.def" #include "clang/Driver/Types.def"
@ -31,7 +31,7 @@ static TypeInfo TypeInfos[] = {
}; };
static const unsigned numTypes = sizeof(TypeInfos) / sizeof(TypeInfos[0]); 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."); assert(id > 0 && id - 1 < numTypes && "Invalid Type ID.");
return TypeInfos[id - 1]; return TypeInfos[id - 1];
} }

Просмотреть файл

@ -14,7 +14,7 @@ using namespace clang;
using namespace clang::frontend; using namespace clang::frontend;
#define LANGSTANDARD(id, name, desc, features) \ #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" #include "clang/Frontend/LangStandards.def"
const LangStandard &LangStandard::getLangStandardForKind(Kind K) { const LangStandard &LangStandard::getLangStandardForKind(Kind K) {

Просмотреть файл

@ -522,7 +522,7 @@ Parser::ParseTemplateTemplateParameter(unsigned Depth, unsigned Position) {
if (Default.isInvalid()) { if (Default.isInvalid()) {
Diag(Tok.getLocation(), Diag(Tok.getLocation(),
diag::err_default_template_template_parameter_not_template); diag::err_default_template_template_parameter_not_template);
static tok::TokenKind EndToks[] = { static const tok::TokenKind EndToks[] = {
tok::comma, tok::greater, tok::greatergreater tok::comma, tok::greater, tok::greatergreater
}; };
SkipUntil(EndToks, 3, true, true); SkipUntil(EndToks, 3, true, true);