[cfe-commits] r97658 - in /cfe/trunk: lib/CodeGen/Mangle.cpp test/CodeGenCXX/mangle-local-class-names.cpp
Fariborz Jahanian
fjahanian at apple.com
Thu Mar 4 08:24:18 PST 2010
On Mar 4, 2010, at 5:34 AM, Daniel Dunbar wrote:
> Hi Fariborz,
>
> On Wed, Mar 3, 2010 at 11:41 AM, Fariborz Jahanian <fjahanian at apple.com
> > wrote:
>> Author: fjahanian
>> Date: Wed Mar 3 13:41:08 2010
>> New Revision: 97658
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=97658&view=rev
>> Log:
>> Implements mangling of local class names to
>> fix a code gen crash. This is WIP as not
>> all ABI cases are covered (there is a FIXME to
>> this effect). Fixes radar 7696748.
>>
>> Added:
>> cfe/trunk/test/CodeGenCXX/mangle-local-class-names.cpp
>> Modified:
>> cfe/trunk/lib/CodeGen/Mangle.cpp
>>
>> Modified: cfe/trunk/lib/CodeGen/Mangle.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.cpp?rev=97658&r1=97657&r2=97658&view=diff
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/Mangle.cpp Wed Mar 3 13:41:08 2010
>> @@ -37,7 +37,19 @@
>> using namespace CodeGen;
>>
>> namespace {
>> -
>> +
>> +static const DeclContext *GetLocalClassFunctionDeclContext(
>> + const
>> DeclContext *DC) {
>> + if (isa<CXXRecordDecl>(DC)) {
>> + while (!DC->isNamespace() && !DC->isTranslationUnit() &&
>> + !isa<FunctionDecl>(DC))
>> + DC = DC->getParent();
>> + if (isa<FunctionDecl>(DC))
>> + return DC;
>> + }
>> + return 0;
>> +}
>> +
>> static const CXXMethodDecl *getStructor(const CXXMethodDecl *MD) {
>> assert((isa<CXXConstructorDecl>(MD) ||
>> isa<CXXDestructorDecl>(MD)) &&
>> "Passed in decl is not a ctor or dtor!");
>> @@ -53,6 +65,8 @@
>> }
>>
>> static const unsigned UnknownArity = ~0U;
>> +static unsigned Discriminator = 0;
>> +static llvm::DenseMap<const NamedDecl*, unsigned> Uniquifier;
>
> Please do not add new static global variables. These belong in a class
> somewhere.
Ii was already done in a subsequent patch.
>
>
> They should also be documented, I don't understand the purpose of
> Discriminator.
It is in the Ithenium ABI document. (5.1.6)
- Fariborz
>
More information about the cfe-commits
mailing list