Object: constize Archive.
authorMichael J. Spencer <bigcheesegs@gmail.com>
Sat, 8 Oct 2011 00:17:45 +0000 (00:17 +0000)
committerMichael J. Spencer <bigcheesegs@gmail.com>
Sat, 8 Oct 2011 00:17:45 +0000 (00:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141448 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Object/Archive.h
lib/Object/Archive.cpp

index c6b6ed087e87d539f0b6a001395bdfacadad82f8..4f081206c5bc547adee96a08f83c6553d2ce801c 100644 (file)
@@ -24,11 +24,11 @@ namespace object {
 class Archive : public Binary {
 public:
   class Child {
-    Archive *Parent;
+    const Archive *Parent;
     StringRef Data;
 
   public:
-    Child(Archive *p, StringRef d) : Parent(p), Data(d) {}
+    Child(const Archive *p, StringRef d) : Parent(p), Data(d) {}
 
     bool operator ==(const Child &other) const {
       return (Parent == other.Parent) && (Data.begin() == other.Data.begin());
@@ -71,8 +71,8 @@ public:
 
   Archive(MemoryBuffer *source, error_code &ec);
 
-  child_iterator begin_children();
-  child_iterator end_children();
+  child_iterator begin_children() const;
+  child_iterator end_children() const;
 
   // Cast methods.
   static inline bool classof(Archive const *v) { return true; }
index 80343e3200e9765a2b77b9e892bbe91b277eff16..aeb629b7f23ffd0248a9133c5ff9e0c2254d719d 100644 (file)
@@ -156,14 +156,14 @@ Archive::Archive(MemoryBuffer *source, error_code &ec)
   ec = object_error::success;
 }
 
-Archive::child_iterator Archive::begin_children() {
+Archive::child_iterator Archive::begin_children() const {
   const char *Loc = Data->getBufferStart() + Magic.size();
   size_t Size = sizeof(ArchiveMemberHeader) +
     ToHeader(Loc)->getSize();
   return Child(this, StringRef(Loc, Size));
 }
 
-Archive::child_iterator Archive::end_children() {
+Archive::child_iterator Archive::end_children() const {
   return Child(this, StringRef(0, 0));
 }