[llvm] r298308 - Make implementation details in DwarfExpression protected. (NFC)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 27 09:07:48 PDT 2017


On Mon, Mar 20, 2017 at 2:46 PM Adrian Prantl via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: adrian
> Date: Mon Mar 20 16:34:19 2017
> New Revision: 298308
>
> URL: http://llvm.org/viewvc/llvm-project?rev=298308&view=rev
> Log:
> Make implementation details in DwarfExpression protected. (NFC)
>
> Modified:
>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.h
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.h?rev=298308&r1=298307&r2=298308&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.h (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.h Mon Mar 20
> 16:34:19 2017
> @@ -102,13 +102,6 @@ protected:
>    /// Add masking operations to stencil out a subregister.
>    void maskSubRegister();
>
> -public:
> -  DwarfExpression(unsigned DwarfVersion) : DwarfVersion(DwarfVersion) {}
> -  virtual ~DwarfExpression() {};
> -
> -  /// This needs to be called last to commit any pending changes.
> -  void finalize();
> -
>    /// Output a dwarf operand and an optional assembler comment.
>    virtual void emitOp(uint8_t Op, const char *Comment = nullptr) = 0;
>    /// Emit a raw signed value.
> @@ -147,6 +140,13 @@ public:
>    /// expression.  See PR21176 for more details.
>    void addStackValue();
>
> +public:
> +  DwarfExpression(unsigned DwarfVersion) : DwarfVersion(DwarfVersion) {}
> +  virtual ~DwarfExpression() {};
>

Does this need to be virtual? Is a DwarfExpression ever owned/destroyed
polymorphically (a quick glance shows at least one that's owned by the
specific derived class (unique_ptr<DIEDwarfExpression in DwarfCompileUnit))
- so maybe it could be protected non-virtual in the base class (& derived
classes marked final/implicitly public non-virtual dtors)

Also an extraneous ';' on the end of that definition (& prefer = default
over {} when both are valid, I think (better chance of some operations
remaining trivial that way)).


> +
> +  /// This needs to be called last to commit any pending changes.
> +  void finalize();
> +
>    /// Emit an indirect dwarf register operation for the given machine
> register.
>    /// \return false if no DWARF register exists for MachineReg.
>    bool addMachineRegIndirect(const TargetRegisterInfo &TRI, unsigned
> MachineReg,
> @@ -206,15 +206,14 @@ public:
>  class DebugLocDwarfExpression : public DwarfExpression {
>    ByteStreamer &BS;
>
> -public:
> -  DebugLocDwarfExpression(unsigned DwarfVersion, ByteStreamer &BS)
> -      : DwarfExpression(DwarfVersion), BS(BS) {}
> -
>    void emitOp(uint8_t Op, const char *Comment = nullptr) override;
>    void emitSigned(int64_t Value) override;
>    void emitUnsigned(uint64_t Value) override;
>    bool isFrameRegister(const TargetRegisterInfo &TRI,
>                         unsigned MachineReg) override;
> +public:
> +  DebugLocDwarfExpression(unsigned DwarfVersion, ByteStreamer &BS)
> +      : DwarfExpression(DwarfVersion), BS(BS) {}
>  };
>
>  /// DwarfExpression implementation for singular DW_AT_location.
> @@ -223,13 +222,13 @@ const AsmPrinter &AP;
>    DwarfUnit &DU;
>    DIELoc &DIE;
>
> -public:
> -  DIEDwarfExpression(const AsmPrinter &AP, DwarfUnit &DU, DIELoc &DIE);
>    void emitOp(uint8_t Op, const char *Comment = nullptr) override;
>    void emitSigned(int64_t Value) override;
>    void emitUnsigned(uint64_t Value) override;
>    bool isFrameRegister(const TargetRegisterInfo &TRI,
>                         unsigned MachineReg) override;
> +public:
> +  DIEDwarfExpression(const AsmPrinter &AP, DwarfUnit &DU, DIELoc &DIE);
>    DIELoc *finalize() {
>      DwarfExpression::finalize();
>      return &DIE;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170327/cd7c2340/attachment.html>


More information about the llvm-commits mailing list