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

Argyrios Kyrtzidis akyrtzi at gmail.com
Tue Sep 11 08:47:37 PDT 2012


On Sep 10, 2012, at 4:44 PM, Jordan Rose <jordan_rose at apple.com> wrote:

> 
> On Sep 10, 2012, at 16:28 , Argyrios Kyrtzidis <akyrtzi at gmail.com> wrote:
> 
>> Author: akirtzidis
>> Date: Mon Sep 10 18:28:22 2012
>> New Revision: 163566
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=163566&view=rev
>> Log:
>> [PCH] Add a null check to avoid crashing.
>> 
>> Unfortunately, no test case. rdar://11960120
>> 
>> 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=163566&r1=163565&r2=163566&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
>> +++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Mon Sep 10 18:28:22 2012
>> @@ -590,8 +590,10 @@
>>                                                  TemplArgs.size(), C);
>>      void *InsertPos = 0;
>>      CanonTemplate->getSpecializations().FindNodeOrInsertPos(ID, InsertPos);
>> -      assert(InsertPos && "Another specialization already inserted!");
>> -      CanonTemplate->getSpecializations().InsertNode(FTInfo, InsertPos);
>> +      if (InsertPos)
>> +        CanonTemplate->getSpecializations().InsertNode(FTInfo, InsertPos);
>> +      else
>> +        assert(0 && "Another specialization already inserted!");
> 
> llvm_unreachable? Also, how is this any different than what you had before?
> 

As Sebastian said, no crashing in release. The idea is to avoid crashing clients of libclang if possible.





More information about the cfe-commits mailing list