Use const_cast instead of a C-style cast to cast away const.
authorDan Gohman <gohman@apple.com>
Sat, 17 Apr 2010 16:43:55 +0000 (16:43 +0000)
committerDan Gohman <gohman@apple.com>
Sat, 17 Apr 2010 16:43:55 +0000 (16:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101639 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfDebug.cpp
lib/Target/X86/AsmPrinter/X86MCInstLower.cpp

index 07d60732d9e3c2b840397df65c6ae3dd1bc52fc4..454aa5633bd05251b6e7b710c3e290106b0849ec 100644 (file)
@@ -2068,8 +2068,9 @@ void DwarfDebug::collectVariableInfo() {
       // FIXME : Lift this restriction.
       if (MInsn->getNumOperands() != 3)
         continue;
-      DIVariable DV((MDNode*)(MInsn->getOperand(MInsn->getNumOperands()
-                                                - 1).getMetadata()));
+      DIVariable DV(
+        const_cast<MDNode *>(MInsn->getOperand(MInsn->getNumOperands() - 1)
+                               .getMetadata()));
       if (DV.getTag() == dwarf::DW_TAG_arg_variable)  {
         // FIXME Handle inlined subroutine arguments.
         DbgVariable *ArgVar = new DbgVariable(DV, MInsn, NULL);
index 9e6cf50b6a907697e2ca5c2a9ea86d075b32fb2c..4b95473db337909c427eebf040d6de74bdae3ca3 100644 (file)
@@ -344,7 +344,7 @@ void X86AsmPrinter::PrintDebugValueComment(const MachineInstr *MI,
   assert(NOps==7);
   O << '\t' << MAI->getCommentString() << "DEBUG_VALUE: ";
   // cast away const; DIetc do not take const operands for some reason.
-  DIVariable V((MDNode*)(MI->getOperand(NOps-1).getMetadata()));
+  DIVariable V(const_cast<MDNode *>(MI->getOperand(NOps-1).getMetadata()));
   O << V.getName();
   O << " <- ";
   // Frame address.  Currently handles register +- offset only.