[llvm] r186544 - Add comparison operators for DIDescriptors to fix c++98 fallout

David Blaikie dblaikie at gmail.com
Wed Jul 17 16:34:03 PDT 2013


On Wed, Jul 17, 2013 at 4:25 PM, Eric Christopher <echristo at gmail.com> wrote:
> Author: echristo
> Date: Wed Jul 17 18:25:22 2013
> New Revision: 186544
>
> URL: http://llvm.org/viewvc/llvm-project?rev=186544&view=rev
> Log:
> Add comparison operators for DIDescriptors to fix c++98 fallout
> of operator bool change.
>
> Also convert a variable in DebugIR.
>
> Modified:
>     llvm/trunk/include/llvm/DebugInfo.h
>     llvm/trunk/lib/Transforms/Instrumentation/DebugIR.cpp
>
> Modified: llvm/trunk/include/llvm/DebugInfo.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo.h?rev=186544&r1=186543&r2=186544&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo.h Wed Jul 17 18:25:22 2013
> @@ -109,6 +109,13 @@ namespace llvm {
>      // implicitly convertable to pointer.
>      LLVM_EXPLICIT operator bool() const { return DbgNode != 0; }
>
> +    bool operator==(DIDescriptor Other) const {
> +      return DbgNode != Other.DbgNode;
> +    }
> +    bool operator!=(DIDescriptor Other) const {
> +      return !operator==(Other);

FWIW I usually write this as: return !(*this == Other); in case that's
something you might prefer.

> +    }
> +
>      unsigned getTag() const {
>        return getUnsignedField(0) & ~LLVMDebugVersionMask;
>      }
>
> Modified: llvm/trunk/lib/Transforms/Instrumentation/DebugIR.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/DebugIR.cpp?rev=186544&r1=186543&r2=186544&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Instrumentation/DebugIR.cpp (original)
> +++ llvm/trunk/lib/Transforms/Instrumentation/DebugIR.cpp Wed Jul 17 18:25:22 2013
> @@ -220,7 +220,7 @@ public:
>          DICompileUnit(CUNode), F.getName(), MangledName, DIFile(FileNode), Line,
>          Sig, Local, IsDefinition, ScopeLine, FuncFlags, IsOptimized, &F);
>      assert(Sub.isSubprogram());
> -    DEBUG(dbgs() << "create subprogram mdnode " << Sub << ": "
> +    DEBUG(dbgs() << "create subprogram mdnode " << *Sub << ": "

Curious - how'd you come across this while doing the other thing?

>                   << "\n");
>
>      SubprogramDescriptors.insert(std::make_pair(&F, Sub));
>
>
> _______________________________________________
> 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