[cfe-commits] r103173 - in /cfe/trunk: include/clang/AST/Decl.h lib/AST/ASTImporter.cpp lib/AST/Decl.cpp lib/Frontend/PCHReaderDecl.cpp lib/Frontend/PCHWriterDecl.cpp lib/Sema/SemaDecl.cpp

John McCall rjmccall at apple.com
Fri Jul 16 10:03:58 PDT 2010


On Jul 16, 2010, at 5:00 AM, Benjamin Kramer wrote:

> 
> On 06.05.2010, at 10:49, John McCall wrote:
> 
>> Author: rjmccall
>> Date: Thu May  6 03:49:23 2010
>> New Revision: 103173
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=103173&view=rev
>> Log:
>> Remember the number of positive and negative bits used by the enumerators of
>> an enum in the enum decl itself.  Use some spare bits from TagDecl for this
>> purpose.
>> 
>> Modified: cfe/trunk/lib/Frontend/PCHWriterDecl.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHWriterDecl.cpp?rev=103173&r1=103172&r2=103173&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Frontend/PCHWriterDecl.cpp (original)
>> +++ cfe/trunk/lib/Frontend/PCHWriterDecl.cpp Thu May  6 03:49:23 2010
>> @@ -137,6 +137,8 @@
>>  VisitTagDecl(D);
>>  Writer.AddTypeRef(D->getIntegerType(), Record);
>>  Writer.AddTypeRef(D->getPromotionType(), Record);
>> +  Record.push_back(D->getNumPositiveBits());
>> +  Record.push_back(D->getNumNegativeBits());
>>  // FIXME: C++ InstantiatedFrom
>>  Code = pch::DECL_ENUM;
>> }
> 
> Valgrind shows these two as being written uninitialized to the PCH in test/PCH/types.c.
> Should they be nulled by default or not even serialized if the enum has no body?

They probably shouldn't be serialized if the enum has no body, but I've done the simple fix for now.

John.



More information about the cfe-commits mailing list