[llvm] r237976 - unique_ptrify LoadedObjectInfo::clone
Justin Bogner
mail at justinbogner.com
Thu May 21 23:02:47 PDT 2015
David Blaikie <dblaikie at gmail.com> writes:
> Author: dblaikie
> Date: Thu May 21 19:05:05 2015
> New Revision: 237976
>
> URL: http://llvm.org/viewvc/llvm-project?rev=237976&view=rev
> Log:
> unique_ptrify LoadedObjectInfo::clone
>
> As noted in the original review, this is unused in tree & is used by
> Julia... that's problematic. This API coudl easily be deleted/modified
> by accident without any validation that it remains correct.
This worries me. Can we get a unit test or something, so that it's at
least noticeable that this code matters? Dead-in-tree code is very
likely to be removed.
> Modified:
> llvm/trunk/include/llvm/DebugInfo/DIContext.h
> llvm/trunk/include/llvm/ExecutionEngine/RuntimeDyld.h
>
> Modified: llvm/trunk/include/llvm/DebugInfo/DIContext.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DIContext.h?rev=237976&r1=237975&r2=237976&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/DIContext.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/DIContext.h Thu May 21 19:05:05 2015
> @@ -22,6 +22,7 @@
> #include "llvm/Support/Casting.h"
> #include "llvm/Support/DataTypes.h"
> #include <string>
> +#include <memory>
>
> namespace llvm {
>
> @@ -165,11 +166,7 @@ public:
> virtual bool getLoadedSectionContents(StringRef Name, StringRef &Data) const {
> return false;
> }
> -
> - /// Obtain a copy of this LoadedObjectInfo.
> - ///
> - /// The caller is responsible for deallocation once the copy is no longer required.
> - virtual LoadedObjectInfo *clone() const = 0;
> + virtual std::unique_ptr<LoadedObjectInfo> clone() const = 0;
> };
>
> }
>
> Modified: llvm/trunk/include/llvm/ExecutionEngine/RuntimeDyld.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/RuntimeDyld.h?rev=237976&r1=237975&r2=237976&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/ExecutionEngine/RuntimeDyld.h (original)
> +++ llvm/trunk/include/llvm/ExecutionEngine/RuntimeDyld.h Thu May 21 19:05:05 2015
> @@ -16,6 +16,7 @@
>
> #include "JITSymbolFlags.h"
> #include "llvm/ADT/StringRef.h"
> +#include "llvm/ADT/STLExtras.h"
> #include "llvm/Support/Memory.h"
> #include "llvm/DebugInfo/DIContext.h"
> #include <memory>
> @@ -80,8 +81,8 @@ public:
> LoadedObjectInfoHelper(RuntimeDyldImpl &RTDyld, unsigned BeginIdx,
> unsigned EndIdx)
> : LoadedObjectInfo(RTDyld, BeginIdx, EndIdx) {}
> - llvm::LoadedObjectInfo *clone() const override {
> - return new Derived(static_cast<const Derived &>(*this));
> + std::unique_ptr<llvm::LoadedObjectInfo> clone() const override {
> + return llvm::make_unique<Derived>(static_cast<const Derived &>(*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