[llvm-commits] [lld] r171997 - /lld/trunk/include/lld/Core/File.h
Michael J. Spencer
bigcheesegs at gmail.com
Wed Jan 9 12:39:07 PST 2013
Author: mspencer
Date: Wed Jan 9 14:39:07 2013
New Revision: 171997
URL: http://llvm.org/viewvc/llvm-project?rev=171997&view=rev
Log:
Style fixes.
Modified:
lld/trunk/include/lld/Core/File.h
Modified: lld/trunk/include/lld/Core/File.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/File.h?rev=171997&r1=171996&r2=171997&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/File.h (original)
+++ lld/trunk/include/lld/Core/File.h Wed Jan 9 14:39:07 2013
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLD_CORE_FILE_H_
-#define LLD_CORE_FILE_H_
+#ifndef LLD_CORE_FILE_H
+#define LLD_CORE_FILE_H
#include "lld/Core/AbsoluteAtom.h"
#include "lld/Core/DefinedAtom.h"
@@ -21,7 +21,6 @@
#include <vector>
namespace lld {
-///
/// Every Atom is owned by some File. A common scenario is for a single
/// object file (.o) to be parsed by some reader and produce a single
/// File object that represents the content of that object file.
@@ -34,52 +33,47 @@
///
/// The Atom objects in a File are owned by the File object. The Atom objects
/// are destroyed when the File object is destroyed.
-///
class File {
public:
virtual ~File();
- /// Kinds of files that are supported.
+ /// \brief Kinds of files that are supported.
enum Kind {
kindObject, ///< object file (.o)
kindSharedLibrary, ///< shared library (.so)
kindArchiveLibrary, ///< archive (.a)
};
- /// Returns file kind. Need for dyn_cast<> on File objects.
+ /// \brief Returns file kind. Need for dyn_cast<> on File objects.
virtual Kind kind() const {
return kindObject;
}
- /// For error messages and debugging, this returns the path to the file
+ /// \brief For error messages and debugging, this returns the path to the file
/// which was used to create this object (e.g. "/tmp/foo.o").
StringRef path() const {
return _path;
}
- /// Returns the path of the source file used to create the object
+ /// \brief Returns the path of the source file used to create the object
/// file which this (File) object represents. This information is usually
/// parsed out of the DWARF debug information. If the source file cannot
/// be ascertained, this method returns the empty string.
virtual StringRef translationUnitSource() const;
- static inline bool classof(const File *) {
- return true;
- }
-
public:
template <typename T> class atom_iterator; // forward reference
- /// For use interating over DefinedAtoms in this File.
+ /// \brief For use interating over DefinedAtoms in this File.
typedef atom_iterator<DefinedAtom> defined_iterator;
- /// For use interating over UndefinedAtoms in this File.
+ /// \brief For use interating over UndefinedAtoms in this File.
typedef atom_iterator<UndefinedAtom> undefined_iterator;
- /// For use interating over SharedLibraryAtoms in this File.
+ /// \brief For use interating over SharedLibraryAtoms in this File.
typedef atom_iterator<SharedLibraryAtom> shared_library_iterator;
- /// For use interating over AbsoluteAtoms in this File.
+ /// \brief For use interating over AbsoluteAtoms in this File.
typedef atom_iterator<AbsoluteAtom> absolute_iterator;
/// Note: this method is not const. All File objects instantiated by reading
@@ -91,7 +85,7 @@
/// call this method when no longer iterating over the File's Atoms.
virtual void addAtom(const Atom&) = 0;
- /// Different object file readers may instantiate and manage atoms with
+ /// \brief Different object file readers may instantiate and manage atoms with
/// different data structures. This class is a collection abstraction.
/// Each concrete File instance must implement these atom_collection
/// methods to enable clients to interate the File's atoms.
@@ -105,60 +99,60 @@
virtual void next(const void *&it) const = 0;
};
- /// The class is the iterator type used to iterate through a File's Atoms.
- /// This iterator delegates the work to the associated atom_collection object.
- /// There are four kinds of Atoms, so this iterator is templated on
+ /// \brief The class is the iterator type used to iterate through a File's
+ /// Atoms. This iterator delegates the work to the associated atom_collection
+ /// object. There are four kinds of Atoms, so this iterator is templated on
/// the four base Atom kinds.
template <typename T>
class atom_iterator {
public:
- atom_iterator(const atom_collection<T>& c, const void* it)
+ atom_iterator(const atom_collection<T> &c, const void *it)
: _collection(c), _it(it) { }
- const T* operator*() const {
+ const T *operator*() const {
return _collection.deref(_it);
}
- const T* operator->() const {
+ const T *operator->() const {
return _collection.deref(_it);
}
- bool operator!=(const atom_iterator<T>& other) const {
+ bool operator!=(const atom_iterator<T> &other) const {
return (this->_it != other._it);
}
- atom_iterator<T>& operator++() {
+ atom_iterator<T> &operator++() {
_collection.next(_it);
return *this;
}
private:
- const atom_collection<T>& _collection;
- const void* _it;
+ const atom_collection<T> &_collection;
+ const void *_it;
};
- /// Must be implemented to return the atom_collection object for
+ /// \brief Must be implemented to return the atom_collection object for
/// all DefinedAtoms in this File.
- virtual const atom_collection<DefinedAtom>& defined() const = 0;
+ virtual const atom_collection<DefinedAtom> &defined() const = 0;
- /// Must be implemented to return the atom_collection object for
+ /// \brief Must be implemented to return the atom_collection object for
/// all UndefinedAtomw in this File.
- virtual const atom_collection<UndefinedAtom>& undefined() const = 0;
+ virtual const atom_collection<UndefinedAtom> &undefined() const = 0;
- /// Must be implemented to return the atom_collection object for
+ /// \brief Must be implemented to return the atom_collection object for
/// all SharedLibraryAtoms in this File.
- virtual const atom_collection<SharedLibraryAtom>& sharedLibrary() const = 0;
+ virtual const atom_collection<SharedLibraryAtom> &sharedLibrary() const = 0;
- /// Must be implemented to return the atom_collection object for
+ /// \brief Must be implemented to return the atom_collection object for
/// all AbsoluteAtoms in this File.
- virtual const atom_collection<AbsoluteAtom>& absolute() const = 0;
+ virtual const atom_collection<AbsoluteAtom> &absolute() const = 0;
protected:
- /// only subclasses of File can be instantiated
+ /// \brief only subclasses of File can be instantiated
File(StringRef p) : _path(p) {}
- /// This is a convenience class for File subclasses which manage their
+ /// \brief This is a convenience class for File subclasses which manage their
/// atoms as a simple std::vector<>.
template <typename T>
class atom_collection_vector : public atom_collection<T> {
@@ -171,19 +165,19 @@
return atom_iterator<T>(*this, reinterpret_cast<const void*>
(_atoms.data() + _atoms.size()));
}
- virtual const T* deref(const void* it) const {
+ virtual const T *deref(const void *it) const {
return *reinterpret_cast<const T* const*>(it);
}
- virtual void next(const void*& it) const {
- const T * const * p = reinterpret_cast<const T * const *>(it);
+ virtual void next(const void *&it) const {
+ const T *const *p = reinterpret_cast<const T *const*>(it);
++p;
it = reinterpret_cast<const void*>(p);
}
- std::vector<const T*> _atoms;
+ std::vector<const T*> _atoms;
};
- /// This is a convenience class for File subclasses which need to return
- /// an empty collection
+ /// \brief This is a convenience class for File subclasses which need to
+ /// return an empty collection.
template <typename T>
class atom_collection_empty : public atom_collection<T> {
public:
@@ -210,6 +204,6 @@
StringRef _path;
};
-} // namespace lld
+} // end namespace lld
-#endif // LLD_CORE_FILE_H_
+#endif
More information about the llvm-commits
mailing list