IR: Make DICompositeType mutators private
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 18 Dec 2014 00:54:39 +0000 (00:54 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 18 Dec 2014 00:54:39 +0000 (00:54 +0000)
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).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224486 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/DebugInfo.h

index a17ebbc0d3eb15a66aa6377697653bbf4286ddb6..00652a72d83f3ef878c7f290bd015aa1acbb1174 100644 (file)
@@ -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;