[llvm] r178090 - DebugInfo: more support for mutating DICompositeType to reduce magic number usage in Clang

David Blaikie dblaikie at gmail.com
Tue Mar 26 16:46:36 PDT 2013


Author: dblaikie
Date: Tue Mar 26 18:46:36 2013
New Revision: 178090

URL: http://llvm.org/viewvc/llvm-project?rev=178090&view=rev
Log:
DebugInfo: more support for mutating DICompositeType to reduce magic number usage in Clang

Modified:
    llvm/trunk/include/llvm/DebugInfo.h
    llvm/trunk/lib/IR/DebugInfo.cpp

Modified: llvm/trunk/include/llvm/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo.h?rev=178090&r1=178089&r2=178090&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/DebugInfo.h Tue Mar 26 18:46:36 2013
@@ -359,6 +359,7 @@ namespace llvm {
     DICompositeType getContainingType() const {
       return getFieldAs<DICompositeType>(12);
     }
+    void setContainingType(DICompositeType ContainingType);
     DIArray getTemplateParams() const { return getFieldAs<DIArray>(13); }
 
     /// Verify - Verify that a composite type descriptor is well formed.

Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=178090&r1=178089&r2=178090&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Tue Mar 26 18:46:36 2013
@@ -616,7 +616,7 @@ MDNode *DIDerivedType::getObjCProperty()
   return dyn_cast_or_null<MDNode>(DbgNode->getOperand(10));
 }
 
-/// \brief Set the array of member DITypes
+/// \brief Set the array of member DITypes.
 void DICompositeType::setTypeArray(DIArray Elements, DIArray TParams) {
   assert(!TParams || DbgNode->getNumOperands() == 14 && "If you're setting the template parameters this should include a slot for that");
   TrackingVH<MDNode> N(*this);
@@ -626,6 +626,13 @@ void DICompositeType::setTypeArray(DIArr
   DbgNode = N;
 }
 
+/// \brief Set the containing type.
+void DICompositeType::setContainingType(DICompositeType ContainingType) {
+  TrackingVH<MDNode> N(*this);
+  N->replaceOperandWith(12, ContainingType);
+  DbgNode = N;
+}
+
 /// isInlinedFnArgument - Return true if this variable provides debugging
 /// information for an inlined function arguments.
 bool DIVariable::isInlinedFnArgument(const Function *CurFn) {





More information about the llvm-commits mailing list