[cfe-commits] r122756 - /cfe/trunk/lib/Serialization/ASTReaderDecl.cpp

Argyrios Kyrtzidis kyrtzidis at apple.com
Mon Jan 3 10:50:38 PST 2011


On Jan 3, 2011, at 10:17 AM, Douglas Gregor wrote:

> 
> On Jan 3, 2011, at 9:57 AM, Argyrios Kyrtzidis wrote:
> 
>> Author: akirtzidis
>> Date: Mon Jan  3 11:57:40 2011
>> New Revision: 122756
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=122756&view=rev
>> Log:
>> In the latest episode of "Deserializing bugs caused by accessors" the series reached a thrilling climax when
>> FunctionDecl::setPure crashed a poor user's code.
>> 
>> Remove the use of this accessor when deserializing, along with several other in the neighborhood. Fixes rdar://8759653.
> 
> Can the mutators die, too?

setPure is needed to call CXXRecordDecl::markedVirtualFunctionPure and update the CXXRecord's DefinitionData.
Could we have some other scheme for the DefinitionData info without mutating CXXRecord ?

> 
> 	- Doug
> 
>> Modified:
>>  cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
>> 
>> Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=122756&r1=122755&r2=122756&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
>> +++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Mon Jan  3 11:57:40 2011
>> @@ -385,17 +385,17 @@
>> // after everything else is read.
>> 
>> FD->SClass = (StorageClass)Record[Idx++];
>> -  FD->setStorageClassAsWritten((StorageClass)Record[Idx++]);
>> +  FD->SClassAsWritten = (StorageClass)Record[Idx++];
>> FD->IsInline = Record[Idx++];
>> FD->IsInlineSpecified = Record[Idx++];
>> -  FD->setVirtualAsWritten(Record[Idx++]);
>> -  FD->setPure(Record[Idx++]);
>> -  FD->setHasInheritedPrototype(Record[Idx++]);
>> -  FD->setHasWrittenPrototype(Record[Idx++]);
>> -  FD->setDeleted(Record[Idx++]);
>> -  FD->setTrivial(Record[Idx++]);
>> -  FD->setHasImplicitReturnZero(Record[Idx++]);
>> -  FD->setLocEnd(ReadSourceLocation(Record, Idx));
>> +  FD->IsVirtualAsWritten = Record[Idx++];
>> +  FD->IsPure = Record[Idx++];
>> +  FD->HasInheritedPrototype = Record[Idx++];
>> +  FD->HasWrittenPrototype = Record[Idx++];
>> +  FD->IsDeleted = Record[Idx++];
>> +  FD->IsTrivial = Record[Idx++];
>> +  FD->HasImplicitReturnZero = Record[Idx++];
>> +  FD->EndRangeLoc = ReadSourceLocation(Record, Idx);
>> 
>> // Read in the parameters.
>> unsigned NumParams = Record[Idx++];
>> 
>> 
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> 





More information about the cfe-commits mailing list