[llvm-commits] [PATCH] remove redundant 'static'

Zhongxing Xu xuzhongxing at gmail.com
Mon Mar 8 17:05:35 PST 2010


2010/3/9 Chris Lattner <clattner at apple.com>:
>
> On Mar 8, 2010, at 4:45 AM, Zhongxing Xu wrote:
>
>> 'static' is redundant in this context:
>
> Um, no it's not.  It prevents exporting the symbol from the .o file.  What are you trying to fix?
>

'const' in namespace scope implies internal linkage. Is that
sufficient to prevent exporting the symbol from the .o file?

> -Chris
>
>>
>> Index: utils/TableGen/RegisterInfoEmitter.cpp
>> ===================================================================
>> --- utils/TableGen/RegisterInfoEmitter.cpp    (版本 97892)
>> +++ utils/TableGen/RegisterInfoEmitter.cpp    (工作副本)
>> @@ -201,7 +201,7 @@
>>
>>     // Emit the register list now.
>>     OS << "  // " << Name << " Register Class...\n"
>> -       << "  static const unsigned " << Name
>> +       << "  const unsigned " << Name
>>        << "[] = {\n    ";
>>     for (unsigned i = 0, e = RC.Elements.size(); i != e; ++i) {
>>       Record *Reg = RC.Elements[i];
>> @@ -223,7 +223,7 @@
>>     // Emit the register list now.
>>     OS << "  // " << Name
>>        << " Register Class Value Types...\n"
>> -       << "  static const EVT " << Name
>> +       << "  const EVT " << Name
>>        << "[] = {\n    ";
>>     for (unsigned i = 0, e = RC.VTs.size(); i != e; ++i)
>>       OS << getEnumName(RC.VTs[i]) << ", ";
>> @@ -252,7 +252,7 @@
>>
>>       OS << "  // " << Name
>>          << " Sub-register Classes...\n"
>> -         << "  static const TargetRegisterClass* const "
>> +         << "  const TargetRegisterClass* const "
>>          << Name << "SubRegClasses[] = {\n    ";
>>
>>       bool Empty = true;
>> @@ -298,7 +298,7 @@
>>
>>       OS << "  // " << Name
>>          << " Super-register Classes...\n"
>> -         << "  static const TargetRegisterClass* const "
>> +         << "  const TargetRegisterClass* const "
>>          << Name << "SuperRegClasses[] = {\n    ";
>>
>>       bool Empty = true;
>> @@ -334,7 +334,7 @@
>>
>>       OS << "  // " << Name
>>          << " Register Class sub-classes...\n"
>> -         << "  static const TargetRegisterClass* const "
>> +         << "  const TargetRegisterClass* const "
>>          << Name << "Subclasses[] = {\n    ";
>>
>>       bool Empty = true;
>> @@ -382,7 +382,7 @@
>>
>>       OS << "  // " << Name
>>          << " Register Class super-classes...\n"
>> -         << "  static const TargetRegisterClass* const "
>> +         << "  const TargetRegisterClass* const "
>>          << Name << "Superclasses[] = {\n    ";
>>
>>       bool Empty = true;
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>




More information about the llvm-commits mailing list