[llvm] r237975 - Fix Clang -Wmissing-override warning
Alexei Starovoitov
alexei.starovoitov at gmail.com
Thu May 21 19:47:21 PDT 2015
This commit r237975 breaks the build with errors like:
/w/llvm/include/llvm/DebugInfo/DIContext.h:170:45: error: overriding
‘virtual std::unique_ptr<llvm::LoadedObjectInfo>
llvm::LoadedObjectInfo::clone() const’
I've reverted it locally for now. Please fix it.
Thanks
On Thu, May 21, 2015 at 5:00 PM, David Blaikie <dblaikie at gmail.com> wrote:
> Author: dblaikie
> Date: Thu May 21 19:00:00 2015
> New Revision: 237975
>
> URL: http://llvm.org/viewvc/llvm-project?rev=237975&view=rev
> Log:
> Fix Clang -Wmissing-override warning
>
> & remove the duplication by introducing a CRTP base to implement the
> clone behavior.
>
> Modified:
> llvm/trunk/include/llvm/DebugInfo/DIContext.h
> llvm/trunk/include/llvm/ExecutionEngine/RuntimeDyld.h
> llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCOFF.cpp
> llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
> llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
>
> Modified: llvm/trunk/include/llvm/DebugInfo/DIContext.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DIContext.h?rev=237975&r1=237974&r2=237975&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/DIContext.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/DIContext.h Thu May 21 19:00:00 2015
> @@ -141,8 +141,7 @@ private:
> /// on the fly.
> class LoadedObjectInfo {
> public:
> - LoadedObjectInfo() {}
> - virtual ~LoadedObjectInfo() {}
> + virtual ~LoadedObjectInfo() = default;
>
> /// Obtain the Load Address of a section by Name.
> ///
>
> Modified: llvm/trunk/include/llvm/ExecutionEngine/RuntimeDyld.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/RuntimeDyld.h?rev=237975&r1=237974&r2=237975&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/ExecutionEngine/RuntimeDyld.h (original)
> +++ llvm/trunk/include/llvm/ExecutionEngine/RuntimeDyld.h Thu May 21 19:00:00 2015
> @@ -62,7 +62,7 @@ public:
> unsigned EndIdx)
> : RTDyld(RTDyld), BeginIdx(BeginIdx), EndIdx(EndIdx) { }
>
> - virtual ~LoadedObjectInfo() {}
> + virtual ~LoadedObjectInfo() = default;
>
> virtual object::OwningBinary<object::ObjectFile>
> getObjectForDebug(const object::ObjectFile &Obj) const = 0;
> @@ -76,6 +76,15 @@ public:
> unsigned BeginIdx, EndIdx;
> };
>
> + template <typename Derived> struct LoadedObjectInfoHelper : LoadedObjectInfo {
> + LoadedObjectInfoHelper(RuntimeDyldImpl &RTDyld, unsigned BeginIdx,
> + unsigned EndIdx)
> + : LoadedObjectInfo(RTDyld, BeginIdx, EndIdx) {}
> + llvm::LoadedObjectInfo *clone() const override {
> + return new Derived(static_cast<const Derived &>(*this));
> + }
> + };
> +
> /// \brief Memory Management.
> class MemoryManager {
> public:
>
> Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCOFF.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCOFF.cpp?rev=237975&r1=237974&r2=237975&view=diff
> ==============================================================================
> --- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCOFF.cpp (original)
> +++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCOFF.cpp Thu May 21 19:00:00 2015
> @@ -24,18 +24,17 @@ using namespace llvm::object;
>
> namespace {
>
> -class LoadedCOFFObjectInfo : public RuntimeDyld::LoadedObjectInfo {
> +class LoadedCOFFObjectInfo
> + : public RuntimeDyld::LoadedObjectInfoHelper<LoadedCOFFObjectInfo> {
> public:
> LoadedCOFFObjectInfo(RuntimeDyldImpl &RTDyld, unsigned BeginIdx,
> unsigned EndIdx)
> - : RuntimeDyld::LoadedObjectInfo(RTDyld, BeginIdx, EndIdx) {}
> + : LoadedObjectInfoHelper(RTDyld, BeginIdx, EndIdx) {}
>
> OwningBinary<ObjectFile>
> getObjectForDebug(const ObjectFile &Obj) const override {
> return OwningBinary<ObjectFile>();
> }
> -
> - RuntimeDyld::LoadedObjectInfo *clone() const { return new LoadedCOFFObjectInfo(*this); }
> };
> }
>
>
> Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp?rev=237975&r1=237974&r2=237975&view=diff
> ==============================================================================
> --- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp (original)
> +++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp Thu May 21 19:00:00 2015
> @@ -104,16 +104,15 @@ void DyldELFObject<ELFT>::updateSymbolAd
> sym->st_value = static_cast<addr_type>(Addr);
> }
>
> -class LoadedELFObjectInfo : public RuntimeDyld::LoadedObjectInfo {
> +class LoadedELFObjectInfo
> + : public RuntimeDyld::LoadedObjectInfoHelper<LoadedELFObjectInfo> {
> public:
> LoadedELFObjectInfo(RuntimeDyldImpl &RTDyld, unsigned BeginIdx,
> unsigned EndIdx)
> - : RuntimeDyld::LoadedObjectInfo(RTDyld, BeginIdx, EndIdx) {}
> + : LoadedObjectInfoHelper(RTDyld, BeginIdx, EndIdx) {}
>
> OwningBinary<ObjectFile>
> getObjectForDebug(const ObjectFile &Obj) const override;
> -
> - RuntimeDyld::LoadedObjectInfo *clone() const { return new LoadedELFObjectInfo(*this); }
> };
>
> template <typename ELFT>
>
> Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp?rev=237975&r1=237974&r2=237975&view=diff
> ==============================================================================
> --- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp (original)
> +++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp Thu May 21 19:00:00 2015
> @@ -26,18 +26,17 @@ using namespace llvm::object;
>
> namespace {
>
> -class LoadedMachOObjectInfo : public RuntimeDyld::LoadedObjectInfo {
> +class LoadedMachOObjectInfo
> + : public RuntimeDyld::LoadedObjectInfoHelper<LoadedMachOObjectInfo> {
> public:
> LoadedMachOObjectInfo(RuntimeDyldImpl &RTDyld, unsigned BeginIdx,
> unsigned EndIdx)
> - : RuntimeDyld::LoadedObjectInfo(RTDyld, BeginIdx, EndIdx) {}
> + : LoadedObjectInfoHelper(RTDyld, BeginIdx, EndIdx) {}
>
> OwningBinary<ObjectFile>
> getObjectForDebug(const ObjectFile &Obj) const override {
> return OwningBinary<ObjectFile>();
> }
> -
> - RuntimeDyld::LoadedObjectInfo *clone() const { return new LoadedMachOObjectInfo(*this); }
> };
>
> }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list