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

Benjamin Kramer benny.kra at gmail.com
Thu Jul 18 01:37:36 PDT 2013


On 18.07.2013, at 01:29, 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;

Shouldn't this check if the nodes are equal rather than not equal?

- Ben

> +    }
> +    bool operator!=(DIDescriptor Other) const {
> +      return !operator==(Other);
> +    }
> +
>     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 << ": "
>                  << "\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