[llvm-commits] [llvm] r103295 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/Analysis/DebugInfo.cpp lib/CodeGen/AsmPrinter/DwarfDebug.cpp lib/CodeGen/AsmPrinter/DwarfDebug.h lib/Transforms/Utils/PromoteMemoryToRegister.cpp
Douglas Gregor
dgregor at apple.com
Fri May 7 15:28:08 PDT 2010
On May 7, 2010, at 1:54 PM, Devang Patel wrote:
> Author: dpatel
> Date: Fri May 7 15:54:48 2010
> New Revision: 103295
>
> URL: http://llvm.org/viewvc/llvm-project?rev=103295&view=rev
> Log:
> Wrap const MDNode * inside DIDescriptor.
>
> Modified:
> llvm/trunk/include/llvm/Analysis/DebugInfo.h
> llvm/trunk/lib/Analysis/DebugInfo.cpp
> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
> llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
>
> Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=103295&r1=103294&r2=103295&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original)
> +++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Fri May 7 15:54:48 2010
> @@ -41,7 +41,7 @@
> /// change in certain situations.
> class DIDescriptor {
> protected:
> - MDNode *DbgNode;
> + const MDNode *DbgNode;
>
> StringRef getStringField(unsigned Elt) const;
> unsigned getUnsignedField(unsigned Elt) const {
> @@ -59,12 +59,13 @@
>
> public:
> explicit DIDescriptor() : DbgNode(0) {}
> - explicit DIDescriptor(MDNode *N) : DbgNode(N) {}
> + explicit DIDescriptor(const MDNode *N) : DbgNode(N) {}
>
> bool Verify() const { return DbgNode != 0; }
>
> - operator MDNode *() const { return DbgNode; }
> - MDNode *operator ->() const { return DbgNode; }
> + operator const MDNode *() const { return DbgNode; }
> + operator MDNode *() const { return const_cast<MDNode*>(DbgNode); }
Clang is barfing on this. It's a Clang bug that I'm working on now, but for the moment I'm committing a workaround of removing the (extraneous, unnecessary) operator const MDNode *.
- Doug
More information about the llvm-commits
mailing list