r226364 - Wrap to 80 columns. No behavior change.

David Blaikie dblaikie at gmail.com
Fri Jan 16 21:48:22 PST 2015


On Fri, Jan 16, 2015 at 9:40 PM, Nico Weber <thakis at chromium.org> wrote:

> On Fri, Jan 16, 2015 at 9:05 PM, David Blaikie <dblaikie at gmail.com> wrote:
>
>>
>>
>> On Fri, Jan 16, 2015 at 6:27 PM, Nico Weber <nicolasweber at gmx.de> wrote:
>>
>>> Author: nico
>>> Date: Fri Jan 16 20:27:54 2015
>>> New Revision: 226364
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=226364&view=rev
>>> Log:
>>> Wrap to 80 columns. No behavior change.
>>>
>>> Modified:
>>>     cfe/trunk/lib/CodeGen/ModuleBuilder.cpp
>>>
>>> Modified: cfe/trunk/lib/CodeGen/ModuleBuilder.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ModuleBuilder.cpp?rev=226364&r1=226363&r2=226364&view=diff
>>>
>>> ==============================================================================
>>> --- cfe/trunk/lib/CodeGen/ModuleBuilder.cpp (original)
>>> +++ cfe/trunk/lib/CodeGen/ModuleBuilder.cpp Fri Jan 16 20:27:54 2015
>>> @@ -95,7 +95,8 @@ namespace {
>>>
>>>        M->setTargetTriple(Ctx->getTargetInfo().getTriple().getTriple());
>>>        M->setDataLayout(Ctx->getTargetInfo().getTargetDescription());
>>> -      TD.reset(new
>>> llvm::DataLayout(Ctx->getTargetInfo().getTargetDescription()));
>>> +      TD.reset(
>>> +          new
>>> llvm::DataLayout(Ctx->getTargetInfo().getTargetDescription()));
>>>
>>
>> llvm::make_unique, perhaps?
>>
>
> In a reset() call? Why?
>

Perhaps there are other preferences, but I tend to prefer:

  x = make_unique<T>(...);

over

  x.reset(new T(...));

except when necessary (the T ctor is private is the usual
reason/limitation) because I find it easier to read/less to think about -
whenever I see a raw 'new' I tend to pause a moment to think about where
it's going/who's owning it (even if it's just long enough to see the reset
call, etc).

Not sure which one's more popular in the codebase at the moment but I'd
wager/hope it's the first & would like to encourage things in that
direction.

- David


>
>
>>
>>
>>>        Builder.reset(new CodeGen::CodeGenModule(Context, CodeGenOpts,
>>> *M, *TD,
>>>                                                 Diags, CoverageInfo));
>>>
>>>
>>>
>>> _______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>>
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150116/82032d3e/attachment.html>


More information about the cfe-commits mailing list