[lld] r230015 - Remove redundant "explicit".

Rui Ueyama ruiu at google.com
Fri Feb 20 09:20:59 PST 2015


Thanks David, I didn't really think about that before.

On Fri, Feb 20, 2015 at 9:08 AM, David Blaikie <dblaikie at gmail.com> wrote:

>
>
> On Fri, Feb 20, 2015 at 6:57 AM, Rui Ueyama <ruiu at google.com> wrote:
>
>> Author: ruiu
>> Date: Fri Feb 20 08:57:04 2015
>> New Revision: 230015
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=230015&view=rev
>> Log:
>> Remove redundant "explicit".
>>
>
> FWIW 'explicit' on > 1 arg ctors isn't actually redundant, it stops you
> from being able to use braced init. eg:
>
> void func(Command);
> ...
> func({p, k}); // this compiles if the ctor is not explicit, but fails to
> compile if the ctor is explicit
>
> But we haven't really taken any consistent strategy about multi-arg ctor
> explicitness in LLVM, so I think this change is the right one - just
> mentioning for the sake of completeness.
>
>
>>
>> Modified:
>>     lld/trunk/include/lld/ReaderWriter/LinkerScript.h
>>
>> Modified: lld/trunk/include/lld/ReaderWriter/LinkerScript.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/LinkerScript.h?rev=230015&r1=230014&r2=230015&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/include/lld/ReaderWriter/LinkerScript.h (original)
>> +++ lld/trunk/include/lld/ReaderWriter/LinkerScript.h Fri Feb 20 08:57:04
>> 2015
>> @@ -171,7 +171,7 @@ public:
>>    virtual ~Command() {}
>>
>>  protected:
>> -  explicit Command(class Parser &ctx, Kind k) : _ctx(ctx), _kind(k) {}
>> +  Command(class Parser &ctx, Kind k) : _ctx(ctx), _kind(k) {}
>>
>>  private:
>>    Parser &_ctx;
>> @@ -180,7 +180,7 @@ private:
>>
>>  class Output : public Command {
>>  public:
>> -  explicit Output(Parser &ctx, StringRef outputFileName)
>> +  Output(Parser &ctx, StringRef outputFileName)
>>        : Command(ctx, Kind::Output), _outputFileName(outputFileName) {}
>>
>>    static bool classof(const Command *c) { return c->getKind() ==
>> Kind::Output; }
>> @@ -197,7 +197,7 @@ private:
>>
>>  class OutputFormat : public Command {
>>  public:
>> -  explicit OutputFormat(Parser &ctx, const SmallVectorImpl<StringRef>
>> &formats)
>> +  OutputFormat(Parser &ctx, const SmallVectorImpl<StringRef> &formats)
>>        : Command(ctx, Kind::OutputFormat) {
>>      size_t numFormats = formats.size();
>>      StringRef *formatsStart =
>> getAllocator().Allocate<StringRef>(numFormats);
>> @@ -229,7 +229,7 @@ private:
>>
>>  class OutputArch : public Command {
>>  public:
>> -  explicit OutputArch(Parser &ctx, StringRef arch)
>> +  OutputArch(Parser &ctx, StringRef arch)
>>        : Command(ctx, Kind::OutputArch), _arch(arch) {}
>>
>>    static bool classof(const Command *c) {
>> @@ -252,7 +252,7 @@ struct Path {
>>    bool _isDashlPrefix;
>>
>>    Path() : _asNeeded(false), _isDashlPrefix(false) {}
>> -  explicit Path(StringRef path, bool asNeeded = false, bool isLib =
>> false)
>> +  Path(StringRef path, bool asNeeded = false, bool isLib = false)
>>        : _path(path), _asNeeded(asNeeded), _isDashlPrefix(isLib) {}
>>  };
>>
>> @@ -310,7 +310,7 @@ public:
>>
>>  class Entry : public Command {
>>  public:
>> -  explicit Entry(Parser &ctx, StringRef entryName)
>> +  Entry(Parser &ctx, StringRef entryName)
>>        : Command(ctx, Kind::Entry), _entryName(entryName) {}
>>
>>    static bool classof(const Command *c) { return c->getKind() ==
>> Kind::Entry; }
>> @@ -327,7 +327,7 @@ private:
>>
>>  class SearchDir : public Command {
>>  public:
>> -  explicit SearchDir(Parser &ctx, StringRef searchPath)
>> +  SearchDir(Parser &ctx, StringRef searchPath)
>>        : Command(ctx, Kind::SearchDir), _searchPath(searchPath) {}
>>
>>    static bool classof(const Command *c) {
>> @@ -368,7 +368,7 @@ public:
>>    virtual ~Expression() {}
>>
>>  protected:
>> -  explicit Expression(class Parser &ctx, Kind k) : _ctx(ctx), _kind(k) {}
>> +  Expression(class Parser &ctx, Kind k) : _ctx(ctx), _kind(k) {}
>>
>>  private:
>>    Parser &_ctx;
>> @@ -380,7 +380,7 @@ private:
>>  /// with a constant.
>>  class Constant : public Expression {
>>  public:
>> -  explicit Constant(Parser &ctx, uint64_t num)
>> +  Constant(Parser &ctx, uint64_t num)
>>        : Expression(ctx, Kind::Constant), _num(num) {}
>>    void dump(raw_ostream &os) const override;
>>
>> @@ -586,7 +586,7 @@ public:
>>    virtual ~InputSection() {}
>>
>>  protected:
>> -  explicit InputSection(Parser &ctx, Kind k) : _ctx(ctx), _kind(k) {}
>> +  InputSection(Parser &ctx, Kind k) : _ctx(ctx), _kind(k) {}
>>
>>  private:
>>    Parser &_ctx;
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150220/245f1bc6/attachment.html>


More information about the llvm-commits mailing list