[cfe-commits] r128138 - /cfe/trunk/lib/Frontend/ASTUnit.cpp

Ted Kremenek kremenek at apple.com
Tue Mar 22 20:44:36 PDT 2011


Either suggestions works for me.  It use to be a SmallVector, but I needed to change it to be heap allocated for safety reasons when cleaning up resources during a crash.  SmallVectors certainly can be heap allocated, but at the time I didn't really see the point in that case of not just using a regular vector.

On Mar 22, 2011, at 8:10 PM, Chris Lattner wrote:

> 
> On Mar 22, 2011, at 7:16 PM, Ted Kremenek wrote:
> 
>> Author: kremenek
>> Date: Tue Mar 22 21:16:41 2011
>> New Revision: 128138
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=128138&view=rev
>> Log:
>> std::vector::data() is not portable to VS.  Use a gross hack instead.
> 
> Can you just change this to use a SmallVector?  Alternatively, BuildCompilation could also just take an llvm::ArrayRef which already handles this.
> 
> -Chris
> 
>> 
>> Modified:
>>   cfe/trunk/lib/Frontend/ASTUnit.cpp
>> 
>> Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=128138&r1=128137&r2=128138&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
>> +++ cfe/trunk/lib/Frontend/ASTUnit.cpp Tue Mar 22 21:16:41 2011
>> @@ -1662,7 +1662,9 @@
>>    TheDriver.setCheckInputsExist(false);
>> 
>>    llvm::OwningPtr<driver::Compilation> C(
>> -      TheDriver.BuildCompilation(Args->size(), Args->data()));
>> +      TheDriver.BuildCompilation(
>> +        Args->size(),
>> +        Args->size() ? &(*Args)[0] : 0 ));  // std::vector::data() not portable
>> 
>>    // Just print the cc1 options if -### was present.
>>    if (C->getArgs().hasArg(driver::options::OPT__HASH_HASH_HASH)) {
>> 
>> 
>> _______________________________________________
>> 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