[llvm-commits] [llvm] r141448 - in /llvm/trunk: include/llvm/Object/Archive.h lib/Object/Archive.cpp

Michael J. Spencer bigcheesegs at gmail.com
Fri Oct 7 17:17:45 PDT 2011


Author: mspencer
Date: Fri Oct  7 19:17:45 2011
New Revision: 141448

URL: http://llvm.org/viewvc/llvm-project?rev=141448&view=rev
Log:
Object: constize Archive.

Modified:
    llvm/trunk/include/llvm/Object/Archive.h
    llvm/trunk/lib/Object/Archive.cpp

Modified: llvm/trunk/include/llvm/Object/Archive.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/Archive.h?rev=141448&r1=141447&r2=141448&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/Archive.h (original)
+++ llvm/trunk/include/llvm/Object/Archive.h Fri Oct  7 19:17:45 2011
@@ -24,11 +24,11 @@
 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 @@
 
   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; }

Modified: llvm/trunk/lib/Object/Archive.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/Archive.cpp?rev=141448&r1=141447&r2=141448&view=diff
==============================================================================
--- llvm/trunk/lib/Object/Archive.cpp (original)
+++ llvm/trunk/lib/Object/Archive.cpp Fri Oct  7 19:17:45 2011
@@ -156,14 +156,14 @@
   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));
 }
 





More information about the llvm-commits mailing list