[llvm] r224486 - IR: Make DICompositeType mutators private

Duncan P. N. Exon Smith dexonsmith at apple.com
Wed Dec 17 16:54:40 PST 2014


Author: dexonsmith
Date: Wed Dec 17 18:54:39 2014
New Revision: 224486

URL: http://llvm.org/viewvc/llvm-project?rev=224486&view=rev
Log:
IR: Make DICompositeType mutators private

Make `DICompositeType` mutators private to prevent misuse.  All calls to
`setArrays()` and `setContainingType()` should go through
`DIBuilder::replaceArrays()` and `DIBuilder::replaceVTableHolder()`.

This is a follow-up to r224482 (now that clang has been updated in
r224483).

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

Modified: llvm/trunk/include/llvm/IR/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfo.h?rev=224486&r1=224485&r2=224486&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/IR/DebugInfo.h Wed Dec 17 18:54:39 2014
@@ -500,6 +500,7 @@ public:
 // FIXME: Make this derive from DIType directly & just store the
 // base type in a single DIType field.
 class DICompositeType : public DIDerivedType {
+  friend class DIBuilder;
   friend class DIDescriptor;
   void printInternal(raw_ostream &OS) const;
 
@@ -513,6 +514,8 @@ public:
     assert(!isSubroutineType() && "no elements for DISubroutineType");
     return getFieldAs<DIArray>(4);
   }
+
+private:
   template <typename T>
   void setArrays(DITypedArray<T> Elements, DIArray TParams = DIArray()) {
     assert((!TParams || DbgNode->getNumOperands() == 8) &&
@@ -520,13 +523,18 @@ public:
            "for that!");
     setArraysHelper(Elements, TParams);
   }
+
+public:
   unsigned getRunTimeLang() const {
     return getHeaderFieldAs<unsigned>(7);
   }
   DITypeRef getContainingType() const { return getFieldAs<DITypeRef>(5); }
 
+private:
   /// \brief Set the containing type.
   void setContainingType(DICompositeType ContainingType);
+
+public:
   DIArray getTemplateParams() const { return getFieldAs<DIArray>(6); }
   MDString *getIdentifier() const;
 





More information about the llvm-commits mailing list