Update mclinker for LLVM rebase to r222494.
This corresponds to the following upstream mclinker change:
commit b2f1691276052c4215abf36715d43248d6337cf8
Author: Diana Chen <[email protected]>
Date: Tue Nov 25 14:03:29 2014 +0800
option: Allow `-hash-style' can be specified zero or more times
Change-Id: I332546680bb45cf9692adfa2c2d3dcdc84361afc
diff --git a/include/mcld/Support/Allocators.h b/include/mcld/Support/Allocators.h
index bb95bd6..c66b77e 100644
--- a/include/mcld/Support/Allocators.h
+++ b/include/mcld/Support/Allocators.h
@@ -1,4 +1,4 @@
-//===- Allocators.h ---------------------------------------------------------===//
+//===- Allocators.h -------------------------------------------------------===//
//
// The MCLinker Project
//
@@ -6,10 +6,10 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#ifndef MCLD_SUPPORT_ALLOCATORS_H
-#define MCLD_SUPPORT_ALLOCATORS_H
-#include <mcld/ADT/Uncopyable.h>
-#include <mcld/ADT/TypeTraits.h>
+#ifndef MCLD_SUPPORT_ALLOCATORS_H_
+#define MCLD_SUPPORT_ALLOCATORS_H_
+#include "mcld/ADT/TypeTraits.h"
+#include "mcld/Support/Compiler.h"
#include <cstddef>
#include <cstdlib>
@@ -21,44 +21,39 @@
*
* @see LinearAllocator
*/
-template<typename DataType, size_t ChunkSize>
-class Chunk
-{
-public:
+template <typename DataType, size_t ChunkSize>
+class Chunk {
+ public:
typedef DataType value_type;
-public:
- Chunk()
- : next(0), bound(0)
- { }
+
+ public:
+ Chunk() : next(NULL), bound(0) {}
static size_t size() { return ChunkSize; }
- static void construct(value_type* pPtr)
- { new (pPtr) value_type(); }
+ static void construct(value_type* pPtr) { new (pPtr) value_type(); }
- static void construct(value_type* pPtr, const value_type& pValue)
- { new (pPtr) value_type(pValue); }
+ static void construct(value_type* pPtr, const value_type& pValue) {
+ new (pPtr) value_type(pValue);
+ }
- static void destroy(value_type* pPtr)
- { }
+ static void destroy(value_type* pPtr) {}
-public:
+ public:
Chunk* next;
size_t bound;
DataType data[ChunkSize];
};
-template<typename DataType>
-class Chunk<DataType, 0>
-{
-public:
+template <typename DataType>
+class Chunk<DataType, 0> {
+ public:
typedef DataType value_type;
-public:
- Chunk()
- : next(0), bound(0) {
- if (0 != m_Size)
- data = (DataType*)malloc(sizeof(DataType)*m_Size);
+ public:
+ Chunk() : next(NULL), bound(0) {
+ if (m_Size != 0)
+ data = reinterpret_cast<DataType*>(malloc(sizeof(DataType) * m_Size));
else
data = 0;
}
@@ -72,79 +67,69 @@
static void setSize(size_t pSize) { m_Size = pSize; }
- static void construct(value_type* pPtr)
- { new (pPtr) value_type(); }
+ static void construct(value_type* pPtr) { new (pPtr) value_type(); }
- static void construct(value_type* pPtr, const value_type& pValue)
- { new (pPtr) value_type(pValue); }
+ static void construct(value_type* pPtr, const value_type& pValue) {
+ new (pPtr) value_type(pValue);
+ }
- static void destroy(value_type* pPtr)
- { pPtr->~value_type(); }
+ static void destroy(value_type* pPtr) { pPtr->~value_type(); }
-public:
+ public:
Chunk* next;
size_t bound;
- DataType *data;
+ DataType* data;
static size_t m_Size;
};
-template<typename DataType>
+template <typename DataType>
size_t Chunk<DataType, 0>::m_Size = 0;
-template<typename ChunkType>
-class LinearAllocatorBase : private Uncopyable
-{
-public:
- typedef ChunkType chunk_type;
- typedef typename ChunkType::value_type value_type;
- typedef typename ChunkType::value_type* pointer;
- typedef typename ChunkType::value_type& reference;
+template <typename ChunkType>
+class LinearAllocatorBase {
+ public:
+ typedef ChunkType chunk_type;
+ typedef typename ChunkType::value_type value_type;
+ typedef typename ChunkType::value_type* pointer;
+ typedef typename ChunkType::value_type& reference;
typedef const typename ChunkType::value_type* const_pointer;
typedef const typename ChunkType::value_type& const_reference;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef unsigned char byte_type;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef unsigned char byte_type;
-protected:
- LinearAllocatorBase()
- : m_pRoot(0),
- m_pCurrent(0),
- m_AllocatedNum(0) {
- }
+ protected:
+ LinearAllocatorBase() : m_pRoot(NULL), m_pCurrent(NULL), m_AllocatedNum(0) {}
// LinearAllocatorBase does NOT mean to destroy the allocated memory.
// If you want a memory allocator to release memory at destruction, please
// use GCFactory series.
- virtual ~LinearAllocatorBase()
- { }
+ virtual ~LinearAllocatorBase() {}
-public:
- pointer address(reference X) const
- { return &X; }
+ public:
+ pointer address(reference X) const { return &X; }
- const_pointer address(const_reference X) const
- { return &X; }
+ const_pointer address(const_reference X) const { return &X; }
/// standard construct - constructing an object on the location pointed by
// pPtr, and using its copy constructor to initialized its value to pValue.
//
// @param pPtr the address where the object to be constructed
// @param pValue the value to be constructed
- void construct(pointer pPtr, const_reference pValue)
- { chunk_type::construct(pPtr, pValue); }
+ void construct(pointer pPtr, const_reference pValue) {
+ chunk_type::construct(pPtr, pValue);
+ }
/// default construct - constructing an object on the location pointed by
// pPtr, and using its default constructor to initialized its value to
// pValue.
//
// @param pPtr the address where the object to be constructed
- void construct(pointer pPtr)
- { chunk_type::construct(pPtr); }
+ void construct(pointer pPtr) { chunk_type::construct(pPtr); }
/// standard destroy - destroy data on arbitrary address
// @para pPtr the address where the data to be destruected.
- void destroy(pointer pPtr)
- { chunk_type::destroy(pPtr); }
+ void destroy(pointer pPtr) { chunk_type::destroy(pPtr); }
/// allocate - allocate N data in order.
// - Disallow to allocate a chunk whose size is bigger than a chunk.
@@ -152,7 +137,7 @@
// @param N the number of allocated data.
// @return the start address of the allocated memory
pointer allocate(size_type N) {
- if (0 == N || N > chunk_type::size())
+ if (N == 0 || N > chunk_type::size())
return 0;
if (empty())
@@ -183,10 +168,8 @@
/// deallocate - deallocate N data from the pPtr
// - if we can simply release some memory, then do it. Otherwise, do
// nothing.
- void deallocate(pointer &pPtr, size_type N) {
- if (0 == N ||
- N > chunk_type::size() ||
- 0 == m_pCurrent->bound ||
+ void deallocate(pointer& pPtr, size_type N) {
+ if (N == 0 || N > chunk_type::size() || m_pCurrent->bound == 0 ||
N >= m_pCurrent->bound)
return;
if (!isAvailable(pPtr))
@@ -196,8 +179,8 @@
}
/// deallocate - clone function of deallocating one datum
- void deallocate(pointer &pPtr) {
- if (0 == m_pCurrent->bound)
+ void deallocate(pointer& pPtr) {
+ if (m_pCurrent->bound == 0)
return;
if (!isAvailable(pPtr))
return;
@@ -208,7 +191,7 @@
/// isIn - whether the pPtr is in the current chunk?
bool isIn(pointer pPtr) const {
if (pPtr >= &(m_pCurrent->data[0]) &&
- pPtr <= &(m_pCurrent->data[chunk_type::size()-1]))
+ pPtr <= &(m_pCurrent->data[chunk_type::size() - 1]))
return true;
return false;
}
@@ -216,7 +199,7 @@
/// isIn - whether the pPtr is allocated, and can be constructed.
bool isAvailable(pointer pPtr) const {
if (pPtr >= &(m_pCurrent->data[m_pCurrent->bound]) &&
- pPtr <= &(m_pCurrent->data[chunk_type::size()-1]))
+ pPtr <= &(m_pCurrent->data[chunk_type::size() - 1]))
return true;
return false;
}
@@ -229,8 +212,8 @@
/// clear - clear all chunks
void clear() {
- chunk_type *cur = m_pRoot, *prev;
- while (0 != cur) {
+ chunk_type* cur = m_pRoot, *prev;
+ while (cur != 0) {
prev = cur;
cur = cur->next;
for (unsigned int idx = 0; idx != prev->bound; ++idx)
@@ -241,32 +224,32 @@
}
// ----- observers ----- //
- bool empty() const {
- return (0 == m_pRoot);
- }
+ bool empty() const { return (m_pRoot == 0); }
- size_type max_size() const
- { return m_AllocatedNum; }
+ size_type max_size() const { return m_AllocatedNum; }
-protected:
+ protected:
inline void initialize() {
m_pRoot = new chunk_type();
m_pCurrent = m_pRoot;
m_AllocatedNum += chunk_type::size();
}
- inline chunk_type *getNewChunk() {
- chunk_type *result = new chunk_type();
+ inline chunk_type* getNewChunk() {
+ chunk_type* result = new chunk_type();
m_pCurrent->next = result;
m_pCurrent = result;
m_AllocatedNum += chunk_type::size();
return result;
}
-protected:
- chunk_type *m_pRoot;
- chunk_type *m_pCurrent;
- size_type m_AllocatedNum;
+ protected:
+ chunk_type* m_pRoot;
+ chunk_type* m_pCurrent;
+ size_type m_AllocatedNum;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(LinearAllocatorBase);
};
/** \class LinearAllocator
@@ -285,167 +268,145 @@
* template argument DataType is the DataType to be allocated
* template argument ChunkSize is the number of bytes of a chunk
*/
-template<typename DataType, size_t ChunkSize>
-class LinearAllocator : public LinearAllocatorBase<Chunk<DataType, ChunkSize> >
-{
-public:
- template<typename NewDataType>
+template <typename DataType, size_t ChunkSize>
+class LinearAllocator
+ : public LinearAllocatorBase<Chunk<DataType, ChunkSize> > {
+ public:
+ template <typename NewDataType>
struct rebind {
typedef LinearAllocator<NewDataType, ChunkSize> other;
};
-public:
- LinearAllocator()
- : LinearAllocatorBase<Chunk<DataType, ChunkSize> >() {
- }
+ public:
+ LinearAllocator() : LinearAllocatorBase<Chunk<DataType, ChunkSize> >() {}
- virtual ~LinearAllocator()
- { }
+ virtual ~LinearAllocator() {}
};
-template<typename DataType>
-class LinearAllocator<DataType, 0> : public LinearAllocatorBase<Chunk<DataType, 0> >
-{
-public:
- template<typename NewDataType>
+template <typename DataType>
+class LinearAllocator<DataType, 0>
+ : public LinearAllocatorBase<Chunk<DataType, 0> > {
+ public:
+ template <typename NewDataType>
struct rebind {
typedef LinearAllocator<NewDataType, 0> other;
};
-public:
+ public:
explicit LinearAllocator(size_t pNum)
- : LinearAllocatorBase<Chunk<DataType, 0> >() {
+ : LinearAllocatorBase<Chunk<DataType, 0> >() {
Chunk<DataType, 0>::setSize(pNum);
}
- virtual ~LinearAllocator()
- { }
+ virtual ~LinearAllocator() {}
};
-template<typename DataType>
-class MallocAllocator
-{
-public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef DataType* pointer;
+template <typename DataType>
+class MallocAllocator {
+ public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef DataType* pointer;
typedef const DataType* const_pointer;
- typedef DataType& reference;
+ typedef DataType& reference;
typedef const DataType& const_reference;
- typedef DataType value_type;
+ typedef DataType value_type;
- template<typename OtherDataType>
- struct rebind
- {
+ template <typename OtherDataType>
+ struct rebind {
typedef MallocAllocator<OtherDataType> other;
};
-public:
- MallocAllocator() throw()
- { }
+ public:
+ MallocAllocator() throw() {}
- MallocAllocator(const MallocAllocator&) throw()
- { }
+ MallocAllocator(const MallocAllocator&) throw() {}
- ~MallocAllocator() throw()
- { }
+ ~MallocAllocator() throw() {}
- pointer address(reference X) const
- { return &X; }
+ pointer address(reference X) const { return &X; }
- const_pointer address(const_reference X) const
- { return &X; }
+ const_pointer address(const_reference X) const { return &X; }
- pointer allocate(size_type pNumOfElements, const void* = 0)
- {
+ pointer allocate(size_type pNumOfElements, const void* = 0) {
return static_cast<DataType*>(
- std::malloc(pNumOfElements*sizeof(DataType)));
+ std::malloc(pNumOfElements * sizeof(DataType)));
}
- void deallocate(pointer pObject, size_type)
- { std::free(static_cast<void*>(pObject)); }
+ void deallocate(pointer pObject, size_type) {
+ std::free(static_cast<void*>(pObject));
+ }
- size_type max_size() const throw()
- { return size_t(-1) / sizeof(DataType); }
+ size_type max_size() const throw() { return size_t(-1) / sizeof(DataType); }
- void construct(pointer pObject, const DataType& pValue)
- { ::new((void *)pObject) value_type(pValue); }
+ void construct(pointer pObject, const DataType& pValue) {
+ ::new (reinterpret_cast<void*>(pObject)) value_type(pValue);
+ }
- void destroy(pointer pObject)
- { pObject->~DataType(); }
-
+ void destroy(pointer pObject) { pObject->~DataType(); }
};
-template<>
-class MallocAllocator<void>
-{
-public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef void* pointer;
+template <>
+class MallocAllocator<void> {
+ public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef void* pointer;
typedef const void* const_pointer;
- typedef void* reference;
+ typedef void* reference;
typedef const void* const_reference;
- typedef void* value_type;
+ typedef void* value_type;
- template<typename OtherDataType>
- struct rebind
- {
+ template <typename OtherDataType>
+ struct rebind {
typedef MallocAllocator<OtherDataType> other;
};
-public:
- MallocAllocator() throw()
- { }
+ public:
+ MallocAllocator() throw() {}
- MallocAllocator(const MallocAllocator&) throw()
- { }
+ MallocAllocator(const MallocAllocator&) throw() {}
- ~MallocAllocator() throw()
- { }
+ ~MallocAllocator() throw() {}
- size_type max_size() const throw()
- { return size_t(-1) / sizeof(void*); }
+ size_type max_size() const throw() { return size_t(-1) / sizeof(void*); }
- pointer address(reference X) const
- { return X; }
+ pointer address(reference X) const { return X; }
- const_pointer address(const_reference X) const
- { return X; }
+ const_pointer address(const_reference X) const { return X; }
- template<typename DataType>
+ template <typename DataType>
DataType* allocate(size_type pNumOfElements, const void* = 0) {
return static_cast<DataType*>(
- std::malloc(pNumOfElements*sizeof(DataType)));
+ std::malloc(pNumOfElements * sizeof(DataType)));
}
pointer allocate(size_type pNumOfElements, const void* = 0) {
return std::malloc(pNumOfElements);
}
- template<typename DataType>
- void deallocate(DataType* pObject, size_type)
- { std::free(static_cast<void*>(pObject)); }
+ template <typename DataType>
+ void deallocate(DataType* pObject, size_type) {
+ std::free(static_cast<void*>(pObject));
+ }
- void deallocate(pointer pObject, size_type)
- { std::free(pObject); }
+ void deallocate(pointer pObject, size_type) { std::free(pObject); }
- template<typename DataType>
- void construct(DataType* pObject, const DataType& pValue)
- { /* do nothing */ }
+ template <typename DataType>
+ void construct(DataType* pObject, const DataType& pValue) { /* do nothing */
+ }
- void construct(pointer pObject, const_reference pValue)
- { /* do nothing */ }
+ void construct(pointer pObject, const_reference pValue) { /* do nothing */
+ }
- template<typename DataType>
- void destroy(DataType* pObject)
- { /* do nothing */ }
+ template <typename DataType>
+ void destroy(DataType* pObject) { /* do nothing */
+ }
- void destroy(pointer pObject)
- { /* do nothing */ }
+ void destroy(pointer pObject) { /* do nothing */
+ }
};
-} // namespace mcld
+} // namespace mcld
-#endif
-
+#endif // MCLD_SUPPORT_ALLOCATORS_H_
diff --git a/include/mcld/Support/CommandLine.h b/include/mcld/Support/CommandLine.h
index 1801354..8c10b91 100644
--- a/include/mcld/Support/CommandLine.h
+++ b/include/mcld/Support/CommandLine.h
@@ -6,10 +6,10 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#ifndef MCLD_SUPPORT_COMMANDLINE_H
-#define MCLD_SUPPORT_COMMANDLINE_H
-#include <mcld/Support/FileSystem.h>
-#include <mcld/MC/ZOption.h>
+#ifndef MCLD_SUPPORT_COMMANDLINE_H_
+#define MCLD_SUPPORT_COMMANDLINE_H_
+#include "mcld/MC/ZOption.h"
+#include "mcld/Support/FileSystem.h"
#include <llvm/ADT/StringRef.h>
#include <llvm/ADT/Triple.h>
@@ -23,18 +23,17 @@
//===----------------------------------------------------------------------===//
// SearchDirParser
//===----------------------------------------------------------------------===//
-class SearchDirParser : public llvm::cl::basic_parser<std::string>
-{
-public:
+class SearchDirParser : public llvm::cl::basic_parser<std::string> {
+ public:
// parse - Return true on error.
- bool parse(Option &pOption,
+ bool parse(Option& pOption,
StringRef pArgName,
StringRef pArg,
- std::string &pValue);
+ std::string& pValue);
- const char *getValueName() const { return "searchdir"; }
+ const char* getValueName() const { return "searchdir"; }
- void printOptionDiff(const Option &pOption,
+ void printOptionDiff(const Option& pOption,
StringRef pValue,
OptVal pDefault,
size_t pGlobalWidth) const;
@@ -45,11 +44,10 @@
//===----------------------------------------------------------------------===//
// FalseParser
//===----------------------------------------------------------------------===//
-class FalseParser : public cl::parser<bool>
-{
-public:
+class FalseParser : public cl::parser<bool> {
+ public:
// parse - Return true on error.
- bool parse(cl::Option &O, StringRef ArgName, StringRef Arg, bool &Val) {
+ bool parse(cl::Option& O, StringRef ArgName, StringRef Arg, bool& Val) {
if (cl::parser<bool>::parse(O, ArgName, Arg, Val))
return false;
Val = false;
@@ -60,18 +58,17 @@
//===----------------------------------------------------------------------===//
// parser<mcld::sys::fs::Path>
//===----------------------------------------------------------------------===//
-template<>
-class parser<mcld::sys::fs::Path> : public basic_parser<mcld::sys::fs::Path>
-{
-public:
- bool parse(Option &O,
+template <>
+class parser<mcld::sys::fs::Path> : public basic_parser<mcld::sys::fs::Path> {
+ public:
+ bool parse(Option& O,
StringRef ArgName,
StringRef Arg,
- mcld::sys::fs::Path &Val);
+ mcld::sys::fs::Path& Val);
- virtual const char *getValueName() const { return "path"; }
- void printOptionDiff(const Option &O,
- const mcld::sys::fs::Path &V,
+ virtual const char* getValueName() const { return "path"; }
+ void printOptionDiff(const Option& O,
+ const mcld::sys::fs::Path& V,
OptVal Default,
size_t GlobalWidth) const;
virtual void anchor();
@@ -80,22 +77,20 @@
//===----------------------------------------------------------------------===//
// parser<mcld::ZOption>
//===----------------------------------------------------------------------===//
-template<>
-class parser<mcld::ZOption> : public llvm::cl::basic_parser<mcld::ZOption>
-{
-public:
- bool parse(Option &O, StringRef ArgName, StringRef Arg, mcld::ZOption &Val);
+template <>
+class parser<mcld::ZOption> : public llvm::cl::basic_parser<mcld::ZOption> {
+ public:
+ bool parse(Option& O, StringRef ArgName, StringRef Arg, mcld::ZOption& Val);
- virtual const char *getValueName() const { return "z-option"; }
- void printOptionDiff(const Option &O,
- const mcld::ZOption &V,
+ virtual const char* getValueName() const { return "z-option"; }
+ void printOptionDiff(const Option& O,
+ const mcld::ZOption& V,
OptVal Default,
size_t GlobalWidth) const;
virtual void anchor();
};
-} // namespace of cl
-} // namespace of llvm
+} // namespace cl
+} // namespace llvm
-#endif
-
+#endif // MCLD_SUPPORT_COMMANDLINE_H_
diff --git a/include/mcld/Support/Compiler.h b/include/mcld/Support/Compiler.h
new file mode 100644
index 0000000..9a0d738
--- /dev/null
+++ b/include/mcld/Support/Compiler.h
@@ -0,0 +1,30 @@
+//===- Compiler.h ---------------------------------------------------------===//
+//
+// The MCLinker Project
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#ifndef MCLD_SUPPORT_COMPILER_H_
+#define MCLD_SUPPORT_COMPILER_H_
+
+#include <llvm/Support/Compiler.h>
+
+// DISALLOW_COPY_AND_ASSIGN disallows the copy and operator= functions. It goes
+// in the private: declarations in a class.
+#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
+ TypeName(const TypeName&) = delete; \
+ void operator=(const TypeName&) = delete
+
+// A macro to disallow all the implicit constructors, namely the default
+// constructor, copy constructor and operator= functions.
+//
+// This should be used in the private: declarations for a class that wants to
+// prevent anyone from instantiating it. This is especially useful for classes
+// containing only static methods.
+#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
+ TypeName() = delete; \
+ DISALLOW_COPY_AND_ASSIGN(TypeName)
+
+#endif // MCLD_SUPPORT_COMPILER_H_
diff --git a/include/mcld/Support/Demangle.h b/include/mcld/Support/Demangle.h
index b6f7412..6f671b9 100644
--- a/include/mcld/Support/Demangle.h
+++ b/include/mcld/Support/Demangle.h
@@ -6,8 +6,8 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#ifndef MCLD_SUPPORT_DEMANGLE_H
-#define MCLD_SUPPORT_DEMANGLE_H
+#ifndef MCLD_SUPPORT_DEMANGLE_H_
+#define MCLD_SUPPORT_DEMANGLE_H_
#include <string>
@@ -17,6 +17,6 @@
bool isCtorOrDtor(const char* pName, size_t pLength);
-} // namespace mcld
+} // namespace mcld
-#endif
+#endif // MCLD_SUPPORT_DEMANGLE_H_
diff --git a/include/mcld/Support/Directory.h b/include/mcld/Support/Directory.h
index 09b7221..00ba531 100644
--- a/include/mcld/Support/Directory.h
+++ b/include/mcld/Support/Directory.h
@@ -6,17 +6,17 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#ifndef MCLD_SUPPORT_DIRECTORY_H
-#define MCLD_SUPPORT_DIRECTORY_H
+#ifndef MCLD_SUPPORT_DIRECTORY_H_
+#define MCLD_SUPPORT_DIRECTORY_H_
-#include <mcld/ADT/TypeTraits.h>
-#include <mcld/Support/FileSystem.h>
-#include <mcld/Support/Path.h>
+#include "mcld/ADT/TypeTraits.h"
+#include "mcld/Support/FileSystem.h"
+#include "mcld/Support/Path.h"
+#include "mcld/Support/PathCache.h"
+
#include <llvm/Support/Allocator.h>
#include <cstddef>
-#include "PathCache.h"
-
namespace mcld {
namespace sys {
namespace fs {
@@ -28,18 +28,19 @@
* non-symbolic link status, and a FileStatus object for symbolic link
* status. The FileStatus objects act as value caches.
*/
-class Directory
-{
-friend mcld::sys::fs::PathCache::entry_type* detail::bring_one_into_cache(DirIterator& pIter);
-friend void detail::open_dir(Directory& pDir);
-friend void detail::close_dir(Directory& pDir);
-private:
+class Directory {
+ friend mcld::sys::fs::PathCache::entry_type* detail::bring_one_into_cache(
+ DirIterator& pIter);
+ friend void detail::open_dir(Directory& pDir);
+ friend void detail::close_dir(Directory& pDir);
+
+ private:
friend class DirIterator;
-public:
+ public:
typedef DirIterator iterator;
-public:
+ public:
/// default constructor
Directory();
@@ -48,6 +49,10 @@
FileStatus st = FileStatus(),
FileStatus symlink_st = FileStatus());
+ explicit Directory(const char* pPath,
+ FileStatus st = FileStatus(),
+ FileStatus symlink_st = FileStatus());
+
/// copy constructor
/// when a copying construction happens, the cache is not copied.
Directory(const Directory& pCopy);
@@ -70,8 +75,7 @@
bool isGood() const;
/// path - the path of the directory
- const Path& path() const
- { return m_Path; }
+ const Path& path() const { return m_Path; }
FileStatus status() const;
FileStatus symlinkStatus() const;
@@ -82,7 +86,7 @@
iterator begin();
iterator end();
-protected:
+ protected:
mcld::sys::fs::Path m_Path;
mutable FileStatus m_FileStatus;
mutable FileStatus m_SymLinkStatus;
@@ -102,28 +106,28 @@
*
* @see Directory
*/
-class DirIterator
-{
-friend mcld::sys::fs::PathCache::entry_type* detail::bring_one_into_cache(DirIterator& pIter);
-friend class Directory;
-public:
- typedef mcld::sys::fs::PathCache DirCache;
+class DirIterator {
+ friend mcld::sys::fs::PathCache::entry_type* detail::bring_one_into_cache(
+ DirIterator& pIter);
+ friend class Directory;
-public:
- typedef Directory value_type;
- typedef ConstTraits<Directory> const_traits;
- typedef NonConstTraits<Directory> non_const_traits;
- typedef std::input_iterator_tag iterator_category;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
+ public:
+ typedef mcld::sys::fs::PathCache DirCache;
-private:
- explicit DirIterator(Directory* pParent,
- const DirCache::iterator& pIter);
+ public:
+ typedef Directory value_type;
+ typedef ConstTraits<Directory> const_traits;
+ typedef NonConstTraits<Directory> non_const_traits;
+ typedef std::input_iterator_tag iterator_category;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
-public:
+ private:
+ explicit DirIterator(Directory* pParent, const DirCache::iterator& pIter);
+
+ public:
// Since StringMapIterator has no default constructor, we also have none.
- DirIterator(const DirIterator &X);
+ DirIterator(const DirIterator& X);
~DirIterator();
DirIterator& operator=(const DirIterator& pCopy);
@@ -138,14 +142,14 @@
bool operator==(const DirIterator& y) const;
bool operator!=(const DirIterator& y) const;
-private:
- Directory* m_pParent; // get handler
- DirCache::iterator m_Iter; // for full situation
+ private:
+ Directory* m_pParent; // get handler
+ DirCache::iterator m_Iter; // for full situation
DirCache::entry_type* m_pEntry;
};
-} // namespace of fs
-} // namespace of sys
-} // namespace of mcld
+} // namespace fs
+} // namespace sys
+} // namespace mcld
-#endif
+#endif // MCLD_SUPPORT_DIRECTORY_H_
diff --git a/include/mcld/Support/ELF.h b/include/mcld/Support/ELF.h
index 321c3c6..d1cdc0c 100644
--- a/include/mcld/Support/ELF.h
+++ b/include/mcld/Support/ELF.h
@@ -6,8 +6,8 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#ifndef MCLD_SUPPORT_ELF_H
-#define MCLD_SUPPORT_ELF_H
+#ifndef MCLD_SUPPORT_ELF_H_
+#define MCLD_SUPPORT_ELF_H_
namespace mcld {
namespace ELF {
@@ -18,17 +18,11 @@
// other sections of the same type.
SHF_ORDERED = 0x40000000,
- // This section is excluded from input of an executable or shared object.
- // Ignore this flag if SHF_ALLOC is also set or if a relocation refers to
- // the section
- SHF_EXCLUDE = 0x80000000,
-
// Section with data that is GP relative addressable.
SHF_MIPS_GPREL = 0x10000000
-}; // enum SHF
+}; // enum SHF
-} // namespace of ELF
-} // namespace of mcld
+} // namespace ELF
+} // namespace mcld
-#endif
-
+#endif // MCLD_SUPPORT_ELF_H_
diff --git a/include/mcld/Support/FileHandle.h b/include/mcld/Support/FileHandle.h
index ecd335c..96467f1 100644
--- a/include/mcld/Support/FileHandle.h
+++ b/include/mcld/Support/FileHandle.h
@@ -6,10 +6,10 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#ifndef MCLD_SUPPORT_FILEHANDLE_H
-#define MCLD_SUPPORT_FILEHANDLE_H
-#include <mcld/Support/Path.h>
-#include <mcld/ADT/Flags.h>
+#ifndef MCLD_SUPPORT_FILEHANDLE_H_
+#define MCLD_SUPPORT_FILEHANDLE_H_
+#include "mcld/ADT/Flags.h"
+#include "mcld/Support/Path.h"
#include <errno.h>
@@ -22,50 +22,46 @@
* Operators of FileHandle should neither throw exceptions nor call expressive
* diagnostic output.
*/
-class FileHandle
-{
-public:
- enum IOState
- {
- GoodBit = 0, // no error
- BadBit = 1L << 0, // error due to the inappropriate operation
- EOFBit = 1L << 1, // reached End-Of-File
- FailBit = 1L << 2, // internal logic fail
- DeputedBit = 1L << 3, // the file descriptor is delegated
+class FileHandle {
+ public:
+ enum IOState {
+ GoodBit = 0, // no error
+ BadBit = 1L << 0, // error due to the inappropriate operation
+ EOFBit = 1L << 1, // reached End-Of-File
+ FailBit = 1L << 2, // internal logic fail
+ DeputedBit = 1L << 3, // the file descriptor is delegated
IOStateEnd = 1L << 16
};
- enum OpenModeEnum
- {
- NotOpen = 0x00,
- ReadOnly = 0x01,
+ enum OpenModeEnum {
+ NotOpen = 0x00,
+ ReadOnly = 0x01,
WriteOnly = 0x02,
ReadWrite = ReadOnly | WriteOnly,
- Append = 0x04,
- Create = 0x08,
- Truncate = 0x10,
- Unknown = 0xFF
+ Append = 0x04,
+ Create = 0x08,
+ Truncate = 0x10,
+ Unknown = 0xFF
};
typedef Flags<OpenModeEnum> OpenMode;
- enum PermissionEnum
- {
- ReadOwner = 0x0400,
- WriteOwner = 0x0200,
- ExeOwner = 0x0100,
- ReadGroup = 0x0040,
- WriteGroup = 0x0020,
- ExeGroup = 0x0010,
- ReadOther = 0x0004,
- WriteOther = 0x0002,
- ExeOther = 0x0001,
- System = 0xFFFF
+ enum PermissionEnum {
+ ReadOwner = 0x0400,
+ WriteOwner = 0x0200,
+ ExeOwner = 0x0100,
+ ReadGroup = 0x0040,
+ WriteGroup = 0x0020,
+ ExeGroup = 0x0010,
+ ReadOther = 0x0004,
+ WriteOther = 0x0002,
+ ExeOther = 0x0001,
+ System = 0xFFFF
};
typedef Flags<PermissionEnum> Permission;
-public:
+ public:
FileHandle();
~FileHandle();
@@ -73,11 +69,9 @@
/// open - open the file.
/// @return if we meet any trouble during opening the file, return false.
/// use rdstate() to see what happens.
- bool open(const sys::fs::Path& pPath,
- OpenMode pMode,
- Permission pPerm = System);
+ bool open(const sys::fs::Path& pPath, OpenMode pMode, Permission pPerm);
- bool delegate(int pFD, OpenMode pMode = Unknown);
+ bool delegate(int pFD, OpenModeEnum pMode = Unknown);
bool close();
@@ -97,17 +91,13 @@
bool munmap(void* pMemBuffer, size_t pLength);
// ----- observers ----- //
- const sys::fs::Path& path() const
- { return m_Path; }
+ const sys::fs::Path& path() const { return m_Path; }
- size_t size() const
- { return m_Size; }
+ size_t size() const { return m_Size; }
- int handler() const
- { return m_Handler; }
+ int handler() const { return m_Handler; }
- uint16_t rdstate() const
- { return m_State; }
+ uint16_t rdstate() const { return m_State; }
bool isOpened() const;
@@ -127,7 +117,7 @@
int error() const { return errno; }
-private:
+ private:
sys::fs::Path m_Path;
int m_Handler;
unsigned int m_Size;
@@ -135,7 +125,6 @@
OpenMode m_OpenMode;
};
-} // namespace of mcld
+} // namespace mcld
-#endif
-
+#endif // MCLD_SUPPORT_FILEHANDLE_H_
diff --git a/include/mcld/Support/FileOutputBuffer.h b/include/mcld/Support/FileOutputBuffer.h
index 6b48e14..afe670f 100644
--- a/include/mcld/Support/FileOutputBuffer.h
+++ b/include/mcld/Support/FileOutputBuffer.h
@@ -6,13 +6,15 @@
// license. see license.txt for details.
//
//===----------------------------------------------------------------------===//
-#ifndef MCLD_SUPPORT_FILEOUTPUTBUFFER_H
-#define MCLD_SUPPORT_FILEOUTPUTBUFFER_H
+#ifndef MCLD_SUPPORT_FILEOUTPUTBUFFER_H_
+#define MCLD_SUPPORT_FILEOUTPUTBUFFER_H_
-#include <mcld/Support/MemoryRegion.h>
+#include "mcld/Support/MemoryRegion.h"
+
#include <llvm/ADT/StringRef.h>
#include <llvm/Support/DataTypes.h>
#include <llvm/Support/FileSystem.h>
+
#include <system_error>
namespace mcld {
@@ -22,7 +24,7 @@
/// FileOutputBuffer - This interface is borrowed from llvm bassically, and we
/// may use ostream to emit output later.
class FileOutputBuffer {
-public:
+ public:
/// Factory method to create an OutputBuffer object which manages a read/write
/// buffer of the specified size. When committed, the buffer will be written
/// to the file at the specified path.
@@ -32,18 +34,16 @@
/// Returns a pointer to the start of the buffer.
uint8_t* getBufferStart() {
- return (uint8_t*)m_pRegion->data();
+ return reinterpret_cast<uint8_t*>(m_pRegion->data());
}
/// Returns a pointer to the end of the buffer.
uint8_t* getBufferEnd() {
- return (uint8_t*)m_pRegion->data() + m_pRegion->size();
+ return reinterpret_cast<uint8_t*>(m_pRegion->data()) + m_pRegion->size();
}
/// Returns size of the buffer.
- size_t getBufferSize() const {
- return m_pRegion->size();
- }
+ size_t getBufferSize() const { return m_pRegion->size(); }
MemoryRegion request(size_t pOffset, size_t pLength);
@@ -52,9 +52,9 @@
~FileOutputBuffer();
-private:
- FileOutputBuffer(const FileOutputBuffer &);
- FileOutputBuffer &operator=(const FileOutputBuffer &);
+ private:
+ FileOutputBuffer(const FileOutputBuffer&);
+ FileOutputBuffer& operator=(const FileOutputBuffer&);
FileOutputBuffer(llvm::sys::fs::mapped_file_region* pRegion,
FileHandle& pFileHandle);
@@ -63,6 +63,6 @@
FileHandle& m_FileHandle;
};
-} // namespace mcld
+} // namespace mcld
-#endif
+#endif // MCLD_SUPPORT_FILEOUTPUTBUFFER_H_
diff --git a/include/mcld/Support/FileSystem.h b/include/mcld/Support/FileSystem.h
index ba4edff..15b33f9 100644
--- a/include/mcld/Support/FileSystem.h
+++ b/include/mcld/Support/FileSystem.h
@@ -10,23 +10,22 @@
// filesystem (v3), but modified to remove exception handling and the
// path class.
//===----------------------------------------------------------------------===//
+#ifndef MCLD_SUPPORT_FILESYSTEM_H_
+#define MCLD_SUPPORT_FILESYSTEM_H_
-#ifndef MCLD_SUPPORT_FILESYSTEM_H
-#define MCLD_SUPPORT_FILESYSTEM_H
-
+#include "mcld/Config/Config.h"
#include "mcld/Support/PathCache.h"
-#include <mcld/Config/Config.h>
-#include <string>
+
#include <iosfwd>
#include <locale>
+#include <string>
namespace mcld {
namespace sys {
namespace fs {
-enum FileType
-{
+enum FileType {
StatusError,
StatusUnknown = StatusError,
FileNotFound,
@@ -46,19 +45,16 @@
/** \class FileStatus
* \brief FileStatus
*/
-class FileStatus
-{
-public:
- FileStatus()
- : m_Value(StatusError) {}
+class FileStatus {
+ public:
+ FileStatus() : m_Value(StatusError) {}
- explicit FileStatus(FileType v)
- : m_Value(v) {}
+ explicit FileStatus(FileType v) : m_Value(v) {}
- void setType(FileType v) { m_Value = v; }
- FileType type() const { return m_Value; }
+ void setType(FileType v) { m_Value = v; }
+ FileType type() const { return m_Value; }
-private:
+ private:
FileType m_Value;
};
@@ -66,7 +62,7 @@
return rhs.type() == lhs.type();
}
-inline bool operator!=(const FileStatus& rhs, const FileStatus& lhs ) {
+inline bool operator!=(const FileStatus& rhs, const FileStatus& lhs) {
return !(rhs == lhs);
}
@@ -74,8 +70,8 @@
class DirIterator;
class Directory;
-bool exists(const Path &pPath);
-bool is_directory(const Path &pPath);
+bool exists(const Path& pPath);
+bool is_directory(const Path& pPath);
namespace detail {
@@ -100,14 +96,17 @@
ssize_t pread(int pFD, void* pBuf, size_t pCount, off_t pOffset);
ssize_t pwrite(int pFD, const void* pBuf, size_t pCount, off_t pOffset);
int ftruncate(int pFD, size_t pLength);
-void* mmap(void *pAddr, size_t pLen,
- int pProt, int pFlags, int pFD, off_t pOffset);
-int munmap(void *pAddr, size_t pLen);
+void* mmap(void* pAddr,
+ size_t pLen,
+ int pProt,
+ int pFlags,
+ int pFD,
+ off_t pOffset);
+int munmap(void* pAddr, size_t pLen);
-} // namespace of detail
-} // namespace of fs
-} // namespace of sys
-} // namespace of mcld
+} // namespace detail
+} // namespace fs
+} // namespace sys
+} // namespace mcld
-#endif
-
+#endif // MCLD_SUPPORT_FILESYSTEM_H_
diff --git a/include/mcld/Support/GCFactory.h b/include/mcld/Support/GCFactory.h
index 452f539..fd86cdd 100644
--- a/include/mcld/Support/GCFactory.h
+++ b/include/mcld/Support/GCFactory.h
@@ -6,8 +6,8 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#ifndef MCLD_SUPPORT_GCFACTORY_H
-#define MCLD_SUPPORT_GCFACTORY_H
+#ifndef MCLD_SUPPORT_GCFACTORY_H_
+#define MCLD_SUPPORT_GCFACTORY_H_
#include "mcld/ADT/TypeTraits.h"
#include "mcld/Support/Allocators.h"
@@ -15,24 +15,21 @@
#include <cstddef>
#include <iterator>
-namespace mcld
-{
+namespace mcld {
/** \class DataIteratorBase
* \brief DataIteratorBase provides the basic functions of DataIterator
* @see DataIterator
*/
-template<typename ChunkType>
-struct DataIteratorBase
-{
-public:
+template <typename ChunkType>
+struct DataIteratorBase {
+ public:
ChunkType* m_pChunk;
unsigned int m_Pos;
-public:
+ public:
DataIteratorBase(ChunkType* X, unsigned int pPos)
- : m_pChunk(X), m_Pos(pPos)
- { }
+ : m_pChunk(X), m_Pos(pPos) {}
inline void advance() {
++m_Pos;
@@ -44,55 +41,49 @@
}
}
- bool operator==(const DataIteratorBase& y) const
- { return ((this->m_pChunk == y.m_pChunk) && (this->m_Pos == y.m_Pos)); }
+ bool operator==(const DataIteratorBase& y) const {
+ return ((this->m_pChunk == y.m_pChunk) && (this->m_Pos == y.m_Pos));
+ }
- bool operator!=(const DataIteratorBase& y) const
- { return ((this->m_pChunk != y.m_pChunk) || (this->m_Pos != y.m_Pos)); }
+ bool operator!=(const DataIteratorBase& y) const {
+ return ((this->m_pChunk != y.m_pChunk) || (this->m_Pos != y.m_Pos));
+ }
};
/** \class DataIterator
* \brief DataIterator provides STL compatible iterator for allocators
*/
-template<typename ChunkType, class Traits>
-class DataIterator : public DataIteratorBase<ChunkType>
-{
-public:
- typedef typename ChunkType::value_type value_type;
- typedef Traits traits;
- typedef typename traits::pointer pointer;
- typedef typename traits::reference reference;
+template <typename ChunkType, class Traits>
+class DataIterator : public DataIteratorBase<ChunkType> {
+ public:
+ typedef typename ChunkType::value_type value_type;
+ typedef Traits traits;
+ typedef typename traits::pointer pointer;
+ typedef typename traits::reference reference;
typedef DataIterator<ChunkType, Traits> Self;
- typedef DataIteratorBase<ChunkType> Base;
+ typedef DataIteratorBase<ChunkType> Base;
- typedef typename traits::nonconst_traits nonconst_traits;
+ typedef typename traits::nonconst_traits nonconst_traits;
typedef DataIterator<ChunkType, nonconst_traits> iterator;
- typedef typename traits::const_traits const_traits;
- typedef DataIterator<ChunkType, const_traits> const_iterator;
- typedef std::forward_iterator_tag iterator_category;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
+ typedef typename traits::const_traits const_traits;
+ typedef DataIterator<ChunkType, const_traits> const_iterator;
+ typedef std::forward_iterator_tag iterator_category;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
-public:
- DataIterator()
- : Base(0, 0)
- { }
+ public:
+ DataIterator() : Base(NULL, 0) {}
- DataIterator(ChunkType* pChunk, unsigned int pPos)
- : Base(pChunk, pPos)
- { }
+ DataIterator(ChunkType* pChunk, unsigned int pPos) : Base(pChunk, pPos) {}
- DataIterator(const DataIterator& pCopy)
- : Base(pCopy.m_pChunk, pCopy.m_Pos)
- { }
+ DataIterator(const DataIterator& pCopy) : Base(pCopy.m_pChunk, pCopy.m_Pos) {}
- ~DataIterator()
- { }
+ ~DataIterator() {}
// ----- operators ----- //
reference operator*() {
- if (0 == this->m_pChunk)
- assert(0 && "data iterator goes to a invalid position");
+ assert(this->m_pChunk != NULL &&
+ "data iterator goes to a invalid position");
return this->m_pChunk->data[Base::m_Pos];
}
@@ -108,39 +99,31 @@
}
};
-template<typename Alloc>
-class GCFactoryBase : public Alloc
-{
-public:
+template <typename Alloc>
+class GCFactoryBase : public Alloc {
+ public:
typedef DataIterator<typename Alloc::chunk_type,
- NonConstTraits<
- typename Alloc::value_type> > iterator;
+ NonConstTraits<typename Alloc::value_type> > iterator;
typedef DataIterator<typename Alloc::chunk_type,
- ConstTraits<
- typename Alloc::value_type> > const_iterator;
+ ConstTraits<typename Alloc::value_type> > const_iterator;
typedef typename Alloc::value_type value_type;
- typedef typename Alloc::pointer pointer;
- typedef typename Alloc::reference reference;
- typedef typename Alloc::size_type size_type;
+ typedef typename Alloc::pointer pointer;
+ typedef typename Alloc::reference reference;
+ typedef typename Alloc::size_type size_type;
-protected:
- GCFactoryBase()
- : Alloc(), m_NumAllocData(0)
- { }
+ protected:
+ GCFactoryBase() : Alloc(), m_NumAllocData(0) {}
- GCFactoryBase(size_t pNum)
- : Alloc(pNum), m_NumAllocData(0)
- { }
+ explicit GCFactoryBase(size_t pNum) : Alloc(pNum), m_NumAllocData(0) {}
-public:
- virtual ~GCFactoryBase()
- { Alloc::clear(); }
+ public:
+ virtual ~GCFactoryBase() { Alloc::clear(); }
// ----- modifiers ----- //
value_type* allocate(size_t N) {
value_type* result = Alloc::allocate(N);
- if (0 != result)
+ if (result != NULL)
m_NumAllocData += N;
return result;
}
@@ -150,15 +133,15 @@
return Alloc::allocate();
}
- void deallocate(pointer &pPtr, size_type N) {
+ void deallocate(pointer& pPtr, size_type N) {
Alloc::deallocate(pPtr, N);
- if (0 == pPtr)
+ if (pPtr == NULL)
m_NumAllocData -= N;
}
- void deallocate(pointer &pPtr) {
+ void deallocate(pointer& pPtr) {
Alloc::deallocate(pPtr);
- if (0 == pPtr)
+ if (pPtr == NULL)
--m_NumAllocData;
}
@@ -168,35 +151,30 @@
}
// ----- iterators ----- //
- iterator begin()
- { return iterator(Alloc::m_pRoot, 0); }
+ iterator begin() { return iterator(Alloc::m_pRoot, 0); }
- const_iterator begin() const
- { return const_iterator(Alloc::m_pRoot, 0); }
+ const_iterator begin() const { return const_iterator(Alloc::m_pRoot, 0); }
iterator end() {
- return (0 == Alloc::m_pCurrent)?
- begin():
- iterator(Alloc::m_pCurrent, Alloc::m_pCurrent->bound);
+ return (Alloc::m_pCurrent) == 0
+ ? begin()
+ : iterator(Alloc::m_pCurrent, Alloc::m_pCurrent->bound);
}
const_iterator end() const {
- return (0 == Alloc::m_pCurrent)?
- begin():
- const_iterator(Alloc::m_pCurrent, Alloc::m_pCurrent->bound);
+ return (Alloc::m_pCurrent) == 0
+ ? begin()
+ : const_iterator(Alloc::m_pCurrent, Alloc::m_pCurrent->bound);
}
// ----- observers ----- //
- bool empty() const
- { return Alloc::empty(); }
+ bool empty() const { return Alloc::empty(); }
- unsigned int capacity() const
- { return Alloc::max_size(); }
+ unsigned int capacity() const { return Alloc::max_size(); }
- unsigned int size() const
- { return m_NumAllocData; }
+ unsigned int size() const { return m_NumAllocData; }
-protected:
+ protected:
unsigned int m_NumAllocData;
};
@@ -204,25 +182,20 @@
* \brief GCFactory provides a factory that guaratees to remove all allocated
* data.
*/
-template<typename DataType, size_t ChunkSize>
-class GCFactory : public GCFactoryBase<LinearAllocator<DataType, ChunkSize> >
-{
-public:
- GCFactory()
- : GCFactoryBase<LinearAllocator<DataType, ChunkSize> >()
- { }
+template <typename DataType, size_t ChunkSize>
+class GCFactory : public GCFactoryBase<LinearAllocator<DataType, ChunkSize> > {
+ public:
+ GCFactory() : GCFactoryBase<LinearAllocator<DataType, ChunkSize> >() {}
};
-template<typename DataType>
-class GCFactory<DataType, 0> : public GCFactoryBase<LinearAllocator<DataType, 0> >
-{
-public:
- GCFactory(size_t pNum)
- : GCFactoryBase<LinearAllocator<DataType, 0> >(pNum)
- { }
+template <typename DataType>
+class GCFactory<DataType, 0>
+ : public GCFactoryBase<LinearAllocator<DataType, 0> > {
+ public:
+ explicit GCFactory(size_t pNum)
+ : GCFactoryBase<LinearAllocator<DataType, 0> >(pNum) {}
};
-} // namespace of mcld
+} // namespace mcld
-#endif
-
+#endif // MCLD_SUPPORT_GCFACTORY_H_
diff --git a/include/mcld/Support/GCFactoryListTraits.h b/include/mcld/Support/GCFactoryListTraits.h
index 7a8871c..b8afe81 100644
--- a/include/mcld/Support/GCFactoryListTraits.h
+++ b/include/mcld/Support/GCFactoryListTraits.h
@@ -6,11 +6,11 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#ifndef MCLD_SUPPORT_GCFACTORYLISTTRAITS_H
-#define MCLD_SUPPORT_GCFACTORYLISTTRAITS_H
+#ifndef MCLD_SUPPORT_GCFACTORYLISTTRAITS_H_
+#define MCLD_SUPPORT_GCFACTORYLISTTRAITS_H_
-#include <llvm/ADT/ilist_node.h>
#include <llvm/ADT/ilist.h>
+#include <llvm/ADT/ilist_node.h>
#include <assert.h>
@@ -20,44 +20,41 @@
* \brief GCFactoryListTraits provides trait class for llvm::iplist when
* the nodes in the list is produced by GCFactory.
*/
-template<typename DataType>
-class GCFactoryListTraits : public llvm::ilist_default_traits<DataType>
-{
-private:
- class SentinelNode : public DataType
- {
- public:
- SentinelNode() { }
+template <typename DataType>
+class GCFactoryListTraits : public llvm::ilist_default_traits<DataType> {
+ private:
+ class SentinelNode : public DataType {
+ public:
+ SentinelNode() {}
};
-public:
+ public:
// override the traits provided in llvm::ilist_sentinel_traits since we've
// defined our own sentinel.
- DataType *createSentinel() const
- { return reinterpret_cast<DataType*>(&mSentinel); }
+ DataType* createSentinel() const {
+ return reinterpret_cast<DataType*>(&mSentinel);
+ }
- static void destroySentinel(DataType*) { }
+ static void destroySentinel(DataType* pData) {}
- DataType *provideInitialHead() const
- { return createSentinel(); }
+ DataType* provideInitialHead() const { return createSentinel(); }
- DataType *ensureHead(DataType*) const
- { return createSentinel(); }
+ DataType* ensureHead(DataType* pData) const { return createSentinel(); }
- static void noteHead(DataType*, DataType*) { }
+ static void noteHead(DataType* pNew, DataType* pSentinel) {}
// override the traits provided in llvm::ilist_node_traits since
- static DataType *createNode(const DataType &V) {
+ static DataType* createNode(const DataType& V) {
assert(false && "Only GCFactory knows how to create a node.");
}
- static void deleteNode(DataType *V) {
+ static void deleteNode(DataType* V) {
// No action. GCFactory will handle it by itself.
}
-private:
+ private:
mutable SentinelNode mSentinel;
};
-} // namespace of mcld
+} // namespace mcld
-#endif
+#endif // MCLD_SUPPORT_GCFACTORYLISTTRAITS_H_
diff --git a/include/mcld/Support/LEB128.h b/include/mcld/Support/LEB128.h
index e90980f..2c6c1c8 100644
--- a/include/mcld/Support/LEB128.h
+++ b/include/mcld/Support/LEB128.h
@@ -6,9 +6,8 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-
-#ifndef MCLD_SUPPORT_LEB128_H
-#define MCLD_SUPPORT_LEB128_H
+#ifndef MCLD_SUPPORT_LEB128_H_
+#define MCLD_SUPPORT_LEB128_H_
#include <stdint.h>
#include <sys/types.h>
@@ -20,20 +19,20 @@
typedef unsigned char ByteType;
/* Forward declarations */
-template<typename IntType>
-size_t encode(ByteType *&pBuf, IntType pValue);
+template <typename IntType>
+size_t encode(ByteType*& pBuf, IntType pValue);
-template<typename IntType>
-IntType decode(const ByteType *pBuf, size_t &pSize);
+template <typename IntType>
+IntType decode(const ByteType* pBuf, size_t& pSize);
-template<typename IntType>
-IntType decode(const ByteType *&pBuf);
+template <typename IntType>
+IntType decode(const ByteType*& pBuf);
/*
* Given an integer, this function returns the number of bytes required to
* encode it in ULEB128 format.
*/
-template<typename IntType>
+template <typename IntType>
size_t size(IntType pValue) {
size_t size = 1;
while (pValue > 0x80) {
@@ -49,66 +48,66 @@
* given buffer pointer to the point just past the end of the write value and
* return the number of bytes being written.
*/
-template<>
-size_t encode<uint64_t>(ByteType *&pBuf, uint64_t pValue);
+template <>
+size_t encode<uint64_t>(ByteType*& pBuf, uint64_t pValue);
-template<>
-size_t encode<uint32_t>(ByteType *&pBuf, uint32_t pValue);
+template <>
+size_t encode<uint32_t>(ByteType*& pBuf, uint32_t pValue);
/*
* Encoding functions for signed LEB128.
*/
-template<>
-size_t encode<int64_t>(ByteType *&pBuf, int64_t pValue);
+template <>
+size_t encode<int64_t>(ByteType*& pBuf, int64_t pValue);
-template<>
-size_t encode<int32_t>(ByteType *&pBuf, int32_t pValue);
+template <>
+size_t encode<int32_t>(ByteType*& pBuf, int32_t pValue);
/*
* Read an integer encoded in ULEB128 format from the given buffer. pSize will
* contain the number of bytes used in the buffer to encode the returned
* integer.
*/
-template<>
-uint64_t decode<uint64_t>(const ByteType *pBuf, size_t &pSize);
+template <>
+uint64_t decode<uint64_t>(const ByteType* pBuf, size_t& pSize);
/*
* Read an integer encoded in ULEB128 format from the given buffer. Update the
* given buffer pointer to the point just past the end of the read value.
*/
-template<>
-uint64_t decode<uint64_t>(const ByteType *&pBuf);
+template <>
+uint64_t decode<uint64_t>(const ByteType*& pBuf);
/*
* Decoding functions for signed LEB128.
*/
-template<>
-int64_t decode<int64_t>(const ByteType *pBuf, size_t &pSize);
+template <>
+int64_t decode<int64_t>(const ByteType* pBuf, size_t& pSize);
-template<>
-int64_t decode<int64_t>(const ByteType *&pBuf);
+template <>
+int64_t decode<int64_t>(const ByteType*& pBuf);
/*
* The functions below handle the signed byte stream. This helps the user to get
* rid of annoying type conversions when using the LEB128 encoding/decoding APIs
* defined above.
*/
-template<typename IntType>
-size_t encode(char *&pBuf, IntType pValue) {
+template <typename IntType>
+size_t encode(char*& pBuf, IntType pValue) {
return encode<IntType>(reinterpret_cast<ByteType*&>(pBuf), pValue);
}
-template<typename IntType>
-IntType decode(const char *pBuf, size_t &pSize) {
+template <typename IntType>
+IntType decode(const char* pBuf, size_t& pSize) {
return decode<IntType>(reinterpret_cast<const ByteType*>(pBuf), pSize);
}
-template<typename IntType>
-IntType decode(const char *&pBuf) {
+template <typename IntType>
+IntType decode(const char*& pBuf) {
return decode<IntType>(reinterpret_cast<const ByteType*&>(pBuf));
}
-} // namespace of leb128
-} // namespace of mcld
+} // namespace leb128
+} // namespace mcld
-#endif
+#endif // MCLD_SUPPORT_LEB128_H_
diff --git a/include/mcld/Support/MemoryArea.h b/include/mcld/Support/MemoryArea.h
index 570e293..105b23a 100644
--- a/include/mcld/Support/MemoryArea.h
+++ b/include/mcld/Support/MemoryArea.h
@@ -6,10 +6,10 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#ifndef MCLD_SUPPORT_MEMORYAREA_H
-#define MCLD_SUPPORT_MEMORYAREA_H
+#ifndef MCLD_SUPPORT_MEMORYAREA_H_
+#define MCLD_SUPPORT_MEMORYAREA_H_
-#include <mcld/ADT/Uncopyable.h>
+#include "mcld/Support/Compiler.h"
#include <llvm/ADT/StringRef.h>
#include <llvm/Support/MemoryBuffer.h>
@@ -19,10 +19,10 @@
/** \class MemoryArea
* \brief MemoryArea is used to manage input read-only memory space.
*/
-class MemoryArea : private Uncopyable
-{
+class MemoryArea {
friend class MemoryAreaFactory;
-public:
+
+ public:
// constructor by file handler.
// If the given file handler is read-only, client can not request a region
// that out of the file size.
@@ -39,10 +39,13 @@
size_t size() const;
-private:
+ private:
std::unique_ptr<llvm::MemoryBuffer> m_pMemoryBuffer;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(MemoryArea);
};
-} // namespace of mcld
+} // namespace mcld
-#endif
+#endif // MCLD_SUPPORT_MEMORYAREA_H_
diff --git a/include/mcld/Support/MemoryAreaFactory.h b/include/mcld/Support/MemoryAreaFactory.h
index 8b6d879..348169b 100644
--- a/include/mcld/Support/MemoryAreaFactory.h
+++ b/include/mcld/Support/MemoryAreaFactory.h
@@ -6,16 +6,16 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#ifndef MCLD_SUPPORT_MEMORYAREAFACTORY_H
-#define MCLD_SUPPORT_MEMORYAREAFACTORY_H
-#include <mcld/Support/GCFactory.h>
-#include <mcld/Support/MemoryArea.h>
-#include <mcld/Support/Path.h>
-#include <mcld/Support/FileHandle.h>
+#ifndef MCLD_SUPPORT_MEMORYAREAFACTORY_H_
+#define MCLD_SUPPORT_MEMORYAREAFACTORY_H_
+#include "mcld/Support/FileHandle.h"
+#include "mcld/Support/GCFactory.h"
+#include "mcld/Support/MemoryArea.h"
+#include "mcld/Support/Path.h"
+
#include <llvm/ADT/StringMap.h>
-namespace mcld
-{
+namespace mcld {
/** \class MemoryAreaFactory
* \brief MemoryAreaFactory avoids creating duplicated MemoryAreas of the
@@ -35,16 +35,14 @@
*
* @see MemoryRegion
*/
-class MemoryAreaFactory : public GCFactory<MemoryArea, 0>
-{
-public:
+class MemoryAreaFactory : public GCFactory<MemoryArea, 0> {
+ public:
explicit MemoryAreaFactory(size_t pNum);
virtual ~MemoryAreaFactory();
// produce - create a MemoryArea and open its file.
- MemoryArea* produce(const sys::fs::Path& pPath,
- FileHandle::OpenMode pMode);
+ MemoryArea* produce(const sys::fs::Path& pPath, FileHandle::OpenMode pMode);
// produce - create a MemoryArea and open its file.
MemoryArea* produce(const sys::fs::Path& pPath,
@@ -60,10 +58,11 @@
MemoryArea* produce(int pFD, FileHandle::OpenMode pMode);
void destruct(MemoryArea* pArea);
-private:
+
+ private:
llvm::StringMap<MemoryArea*> m_AreaMap;
};
-} // namespace of mcld
+} // namespace mcld
-#endif
+#endif // MCLD_SUPPORT_MEMORYAREAFACTORY_H_
diff --git a/include/mcld/Support/MemoryRegion.h b/include/mcld/Support/MemoryRegion.h
index ff81a30..28205f1 100644
--- a/include/mcld/Support/MemoryRegion.h
+++ b/include/mcld/Support/MemoryRegion.h
@@ -6,10 +6,11 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#ifndef MCLD_SUPPORT_MEMORYREGION_H
-#define MCLD_SUPPORT_MEMORYREGION_H
+#ifndef MCLD_SUPPORT_MEMORYREGION_H_
+#define MCLD_SUPPORT_MEMORYREGION_H_
-#include <mcld/ADT/TypeTraits.h>
+#include "mcld/ADT/TypeTraits.h"
+
#include <llvm/ADT/ArrayRef.h>
#include <llvm/Support/DataTypes.h>
@@ -21,6 +22,6 @@
typedef llvm::ArrayRef<uint8_t> ConstMemoryRegion;
typedef llvm::MutableArrayRef<uint8_t> MemoryRegion;
-} // namespace mcld
+} // namespace mcld
-#endif
+#endif // MCLD_SUPPORT_MEMORYREGION_H_
diff --git a/include/mcld/Support/MsgHandling.h b/include/mcld/Support/MsgHandling.h
index 71d173e..5720ce5 100644
--- a/include/mcld/Support/MsgHandling.h
+++ b/include/mcld/Support/MsgHandling.h
@@ -6,9 +6,9 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#ifndef MCLD_SUPPORT_MSGHANDLING_H
-#define MCLD_SUPPORT_MSGHANDLING_H
-#include <mcld/LD/MsgHandler.h>
+#ifndef MCLD_SUPPORT_MSGHANDLING_H_
+#define MCLD_SUPPORT_MSGHANDLING_H_
+#include "mcld/LD/MsgHandler.h"
namespace mcld {
@@ -33,45 +33,37 @@
MsgHandler note(unsigned int pID);
MsgHandler ignore(unsigned int pID);
-} // namespace of mcld
+} // namespace mcld
//===----------------------------------------------------------------------===//
// Inline functions
//===----------------------------------------------------------------------===//
-inline mcld::MsgHandler mcld::unreachable(unsigned int pID)
-{
+inline mcld::MsgHandler mcld::unreachable(unsigned int pID) {
return getDiagnosticEngine().report(pID, DiagnosticEngine::Unreachable);
}
-inline mcld::MsgHandler mcld::fatal(unsigned int pID)
-{
+inline mcld::MsgHandler mcld::fatal(unsigned int pID) {
return getDiagnosticEngine().report(pID, DiagnosticEngine::Fatal);
}
-inline mcld::MsgHandler mcld::error(unsigned int pID)
-{
+inline mcld::MsgHandler mcld::error(unsigned int pID) {
return getDiagnosticEngine().report(pID, DiagnosticEngine::Error);
}
-inline mcld::MsgHandler mcld::warning(unsigned int pID)
-{
+inline mcld::MsgHandler mcld::warning(unsigned int pID) {
return getDiagnosticEngine().report(pID, DiagnosticEngine::Warning);
}
-inline mcld::MsgHandler mcld::debug(unsigned int pID)
-{
+inline mcld::MsgHandler mcld::debug(unsigned int pID) {
return getDiagnosticEngine().report(pID, DiagnosticEngine::Debug);
}
-inline mcld::MsgHandler mcld::note(unsigned int pID)
-{
+inline mcld::MsgHandler mcld::note(unsigned int pID) {
return getDiagnosticEngine().report(pID, DiagnosticEngine::Note);
}
-inline mcld::MsgHandler mcld::ignore(unsigned int pID)
-{
+inline mcld::MsgHandler mcld::ignore(unsigned int pID) {
return getDiagnosticEngine().report(pID, DiagnosticEngine::Ignore);
}
-#endif
-
+#endif // MCLD_SUPPORT_MSGHANDLING_H_
diff --git a/include/mcld/Support/Path.h b/include/mcld/Support/Path.h
index 9fdb95c..33f4705 100644
--- a/include/mcld/Support/Path.h
+++ b/include/mcld/Support/Path.h
@@ -10,11 +10,12 @@
// filesystem (v3), but modified to remove exception handling and the
// path class.
//===----------------------------------------------------------------------===//
-#ifndef MCLD_SUPPORT_PATH_H
-#define MCLD_SUPPORT_PATH_H
+#ifndef MCLD_SUPPORT_PATH_H_
+#define MCLD_SUPPORT_PATH_H_
+
+#include "mcld/Config/Config.h"
#include <llvm/Support/raw_ostream.h>
-#include <mcld/Config/Config.h>
#include <iosfwd>
#include <functional>
@@ -22,8 +23,8 @@
#include <locale>
namespace mcld {
-namespace sys {
-namespace fs {
+namespace sys {
+namespace fs {
#if defined(MCLD_ON_WIN32)
const char preferred_separator = '/';
@@ -40,29 +41,29 @@
* \brief Path provides an abstraction for the path to a file or directory in
* the operating system's filesystem.
*/
-class Path
-{
-public:
- typedef char ValueType;
- typedef std::string StringType;
+class Path {
+ public:
+ typedef char ValueType;
+ typedef std::string StringType;
-public:
+ public:
Path();
- Path(const ValueType* s);
- Path(const StringType &s);
+ explicit Path(const ValueType* s);
+ explicit Path(const StringType& s);
Path(const Path& pCopy);
virtual ~Path();
// ----- assignments ----- //
template <class InputIterator>
Path& assign(InputIterator begin, InputIterator end);
- Path& assign(const StringType &s);
+ Path& assign(const StringType& s);
Path& assign(const ValueType* s, unsigned int length);
// ----- appends ----- //
template <class InputIterator>
Path& append(InputIterator begin, InputIterator end);
Path& append(const Path& pPath);
+ Path& append(const StringType& pPath);
// ----- observers ----- //
bool empty() const;
@@ -71,10 +72,9 @@
bool isFromPWD() const;
const StringType& native() const { return m_PathName; }
- StringType& native() { return m_PathName; }
+ StringType& native() { return m_PathName; }
- const ValueType* c_str() const
- { return m_PathName.c_str(); }
+ const ValueType* c_str() const { return m_PathName.c_str(); }
// ----- decomposition ----- //
Path parent_path() const;
@@ -86,42 +86,41 @@
StringType generic_string() const;
bool canonicalize();
-public:
+ public:
StringType::size_type m_append_separator_if_needed();
void m_erase_redundant_separator(StringType::size_type sep_pos);
-protected:
+ protected:
StringType m_PathName;
};
-bool operator==(const Path& pLHS,const Path& pRHS);
-bool operator!=(const Path& pLHS,const Path& pRHS);
+bool operator==(const Path& pLHS, const Path& pRHS);
+bool operator!=(const Path& pLHS, const Path& pRHS);
Path operator+(const Path& pLHS, const Path& pRHS);
//===----------------------------------------------------------------------===//
// Non-member Functions
//===----------------------------------------------------------------------===//
-bool exists(const Path &pPath);
+bool exists(const Path& pPath);
-bool is_directory(const Path &pPath);
+bool is_directory(const Path& pPath);
template <class Char, class Traits>
-inline std::basic_ostream<Char, Traits>&
-operator<<(std::basic_ostream<Char, Traits>& pOS, const Path& pPath)
-{
+inline std::basic_ostream<Char, Traits>& operator<<(
+ std::basic_ostream<Char, Traits>& pOS,
+ const Path& pPath) {
return pOS << pPath.native();
}
template <class Char, class Traits>
-inline std::basic_istream<Char, Traits>&
-operator>>(std::basic_istream<Char, Traits>& pOS, Path& pPath)
-{
+inline std::basic_istream<Char, Traits>& operator>>(
+ std::basic_istream<Char, Traits>& pOS,
+ Path& pPath) {
return pOS >> pPath.native();
}
-inline llvm::raw_ostream&
-operator<<(llvm::raw_ostream& pOS, const Path& pPath)
-{
+inline llvm::raw_ostream& operator<<(llvm::raw_ostream& pOS,
+ const Path& pPath) {
return pOS << pPath.native();
}
@@ -129,8 +128,7 @@
// class path member template implementation
//===----------------------------------------------------------------------===//
template <class InputIterator>
-Path& Path::assign(InputIterator begin, InputIterator end)
-{
+Path& Path::assign(InputIterator begin, InputIterator end) {
m_PathName.clear();
if (begin != end)
m_PathName.append<InputIterator>(begin, end);
@@ -138,8 +136,7 @@
}
template <class InputIterator>
-Path& Path::append(InputIterator begin, InputIterator end)
-{
+Path& Path::append(InputIterator begin, InputIterator end) {
if (begin == end)
return *this;
StringType::size_type sep_pos(m_append_separator_if_needed());
@@ -149,28 +146,26 @@
return *this;
}
-} // namespace of fs
-} // namespace of sys
-} // namespace of mcld
+} // namespace fs
+} // namespace sys
+} // namespace mcld
//===----------------------------------------------------------------------===//
// STL compatible functions
//===----------------------------------------------------------------------===//
namespace std {
-template<>
-struct less<mcld::sys::fs::Path> : public binary_function<mcld::sys::fs::Path,
- mcld::sys::fs::Path,
- bool>
-{
- bool operator() (const mcld::sys::fs::Path& pX,const mcld::sys::fs::Path& pY) const {
+template <>
+struct less<mcld::sys::fs::Path>
+ : public binary_function<mcld::sys::fs::Path, mcld::sys::fs::Path, bool> {
+ bool operator()(const mcld::sys::fs::Path& pX,
+ const mcld::sys::fs::Path& pY) const {
if (pX.generic_string().size() < pY.generic_string().size())
return true;
return (pX.generic_string() < pY.generic_string());
}
};
-} // namespace of std
+} // namespace std
-#endif
-
+#endif // MCLD_SUPPORT_PATH_H_
diff --git a/include/mcld/Support/PathCache.h b/include/mcld/Support/PathCache.h
index aca49fb..8b61556 100644
--- a/include/mcld/Support/PathCache.h
+++ b/include/mcld/Support/PathCache.h
@@ -6,29 +6,28 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#ifndef MCLD_SUPPORT_PATHCACHE_H
-#define MCLD_SUPPORT_PATHCACHE_H
+#ifndef MCLD_SUPPORT_PATHCACHE_H_
+#define MCLD_SUPPORT_PATHCACHE_H_
-#include <mcld/ADT/HashEntry.h>
-#include <mcld/ADT/HashTable.h>
-#include <mcld/ADT/StringHash.h>
-#include <mcld/Support/Path.h>
+#include "mcld/ADT/HashEntry.h"
+#include "mcld/ADT/HashTable.h"
+#include "mcld/ADT/StringHash.h"
+#include "mcld/Support/Path.h"
namespace mcld {
-namespace sys {
-namespace fs {
+namespace sys {
+namespace fs {
-namespace {
- typedef HashEntry<llvm::StringRef,
- mcld::sys::fs::Path,
- hash::StringCompare<llvm::StringRef> > HashEntryType;
-} // anonymous namespace
+typedef HashEntry<llvm::StringRef,
+ mcld::sys::fs::Path,
+ hash::StringCompare<llvm::StringRef> > HashEntryType;
-typedef HashTable<HashEntryType, hash::StringHash<hash::BKDR>, EntryFactory<HashEntryType> > PathCache;
+typedef HashTable<HashEntryType,
+ hash::StringHash<hash::DJB>,
+ EntryFactory<HashEntryType> > PathCache;
-} // namespace of fs
-} // namespace of sys
-} // namespace of mcld
+} // namespace fs
+} // namespace sys
+} // namespace mcld
-#endif
-
+#endif // MCLD_SUPPORT_PATHCACHE_H_
diff --git a/include/mcld/Support/RealPath.h b/include/mcld/Support/RealPath.h
index b630fd6..b5edc76 100644
--- a/include/mcld/Support/RealPath.h
+++ b/include/mcld/Support/RealPath.h
@@ -6,64 +6,61 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#ifndef MCLD_SUPPORT_REALPATH_H
-#define MCLD_SUPPORT_REALPATH_H
+#ifndef MCLD_SUPPORT_REALPATH_H_
+#define MCLD_SUPPORT_REALPATH_H_
#include "mcld/Support/Path.h"
+
#include <string>
namespace mcld {
-namespace sys {
-namespace fs {
+namespace sys {
+namespace fs {
/** \class RealPath
* \brief The canonicalized absolute pathname.
*
*/
-class RealPath : public Path
-{
-public:
- typedef Path::ValueType ValueType;
+class RealPath : public Path {
+ public:
+ typedef Path::ValueType ValueType;
typedef Path::StringType StringType;
-public:
+ public:
RealPath();
- explicit RealPath(const ValueType* s );
- explicit RealPath(const StringType &s );
+ explicit RealPath(const ValueType* s);
+ explicit RealPath(const StringType& s);
explicit RealPath(const Path& pPath);
~RealPath();
RealPath& assign(const Path& pPath);
-protected:
+ protected:
void initialize();
};
-} // namespace of fs
-} // namespace of sys
-} // namespace of mcld
+} // namespace fs
+} // namespace sys
+} // namespace mcld
-//-------------------------------------------------------------------------//
-// STL compatible functions //
-//-------------------------------------------------------------------------//
+//----------------------------------------------------------------------------//
+// STL compatible functions //
+//----------------------------------------------------------------------------//
namespace std {
-template<>
-struct less<mcld::sys::fs::RealPath> : public binary_function<
- mcld::sys::fs::RealPath,
- mcld::sys::fs::RealPath,
- bool>
-{
- bool operator() (const mcld::sys::fs::RealPath& pX,
- const mcld::sys::fs::RealPath& pY) const {
+template <>
+struct less<mcld::sys::fs::RealPath>
+ : public binary_function<mcld::sys::fs::RealPath,
+ mcld::sys::fs::RealPath,
+ bool> {
+ bool operator()(const mcld::sys::fs::RealPath& pX,
+ const mcld::sys::fs::RealPath& pY) const {
if (pX.native().size() < pY.native().size())
return true;
return (pX.native() < pY.native());
}
};
-} // namespace of std
+} // namespace std
-
-#endif
-
+#endif // MCLD_SUPPORT_REALPATH_H_
diff --git a/include/mcld/Support/SystemUtils.h b/include/mcld/Support/SystemUtils.h
index 7057110..4502e20 100644
--- a/include/mcld/Support/SystemUtils.h
+++ b/include/mcld/Support/SystemUtils.h
@@ -6,11 +6,13 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#ifndef MCLD_SUPPORT_SYSTEMUTILS_H
-#define MCLD_SUPPORT_SYSTEMUTILS_H
+#ifndef MCLD_SUPPORT_SYSTEMUTILS_H_
+#define MCLD_SUPPORT_SYSTEMUTILS_H_
+
+#include "mcld/Config/Config.h"
#include <llvm/Support/DataTypes.h>
-#include <mcld/Config/Config.h>
+
#include <string>
namespace mcld {
@@ -22,7 +24,7 @@
/** \fn strerror
* \brief system error message
*/
-char *strerror(int pErrnum);
+char* strerror(int pErrnum);
std::string getDefaultTargetTriple();
@@ -34,8 +36,7 @@
/// SetRandomSeed - set the initial seed value for future calls to random().
void SetRandomSeed(unsigned pSeed);
-} // namespace of sys
-} // namespace of mcld
+} // namespace sys
+} // namespace mcld
-#endif
-
+#endif // MCLD_SUPPORT_SYSTEMUTILS_H_
diff --git a/include/mcld/Support/Target.h b/include/mcld/Support/Target.h
index 021fc2e..703dc82 100644
--- a/include/mcld/Support/Target.h
+++ b/include/mcld/Support/Target.h
@@ -6,16 +6,15 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#ifndef MCLD_SUPPORT_TARGET_H
-#define MCLD_SUPPORT_TARGET_H
+#ifndef MCLD_SUPPORT_TARGET_H_
+#define MCLD_SUPPORT_TARGET_H_
#include <string>
-#include <list>
namespace llvm {
class Target;
class Triple;
class TargetMachine;
-} // namespace of llvm
+} // namespace llvm
namespace mcld {
@@ -32,32 +31,31 @@
/** \class Target
* \brief Target collects target specific information
*/
-class Target
-{
+class Target {
friend class mcld::MCLDTargetMachine;
friend class mcld::TargetRegistry;
-public:
+ public:
typedef unsigned int (*TripleMatchQualityFnTy)(const llvm::Triple& pTriple);
- typedef MCLDTargetMachine *(*TargetMachineCtorTy)(const llvm::Target &,
- const mcld::Target &,
- llvm::TargetMachine &,
+ typedef MCLDTargetMachine* (*TargetMachineCtorTy)(const llvm::Target&,
+ const mcld::Target&,
+ llvm::TargetMachine&,
const std::string&);
- typedef MCLinker *(*MCLinkerCtorTy)(const std::string& pTriple,
+ typedef MCLinker* (*MCLinkerCtorTy)(const std::string& pTriple,
LinkerConfig&,
Module&,
FileHandle& pFileHandle);
typedef bool (*EmulationFnTy)(LinkerScript&, LinkerConfig&);
- typedef TargetLDBackend *(*TargetLDBackendCtorTy)(const LinkerConfig&);
+ typedef TargetLDBackend* (*TargetLDBackendCtorTy)(const LinkerConfig&);
- typedef DiagnosticLineInfo *(*DiagnosticLineInfoCtorTy)(const mcld::Target&,
+ typedef DiagnosticLineInfo* (*DiagnosticLineInfoCtorTy)(const mcld::Target&,
const std::string&);
-public:
+ public:
Target();
/// getName - get the target name
@@ -71,7 +69,7 @@
llvm::TargetMachine& pTM) const;
/// createMCLinker - create target-specific MCLinker
- MCLinker *createMCLinker(const std::string &pTriple,
+ MCLinker* createMCLinker(const std::string& pTriple,
LinkerConfig& pConfig,
Module& pModule,
FileHandle& pFileHandle) const;
@@ -84,10 +82,11 @@
TargetLDBackend* createLDBackend(const LinkerConfig& pConfig) const;
/// createDiagnosticLineInfo - create target-specific DiagnosticLineInfo
- DiagnosticLineInfo* createDiagnosticLineInfo(const mcld::Target& pTarget,
- const std::string& pTriple) const;
+ DiagnosticLineInfo* createDiagnosticLineInfo(
+ const mcld::Target& pTarget,
+ const std::string& pTriple) const;
-private:
+ private:
/// Name - The target name
const char* Name;
@@ -99,7 +98,6 @@
DiagnosticLineInfoCtorTy DiagnosticLineInfoCtorFn;
};
-} //end namespace mcld
+} // namespace mcld
-#endif
-
+#endif // MCLD_SUPPORT_TARGET_H_
diff --git a/include/mcld/Support/TargetRegistry.h b/include/mcld/Support/TargetRegistry.h
index 1ae6245..c76ff74 100644
--- a/include/mcld/Support/TargetRegistry.h
+++ b/include/mcld/Support/TargetRegistry.h
@@ -6,36 +6,36 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#ifndef MCLD_SUPPORT_TARGETREGISTRY_H
-#define MCLD_SUPPORT_TARGETREGISTRY_H
-#include <mcld/Support/Target.h>
+#ifndef MCLD_SUPPORT_TARGETREGISTRY_H_
+#define MCLD_SUPPORT_TARGETREGISTRY_H_
+#include "mcld/Support/Target.h"
+
#include <llvm/ADT/Triple.h>
-#include <string>
#include <list>
+#include <string>
namespace llvm {
class TargetMachine;
class MCCodeEmitter;
class MCContext;
class AsmPrinter;
-} // namespace of llvm
+} // namespace llvm
namespace mcld {
/** \class TargetRegistry
* \brief TargetRegistry is an object adapter of llvm::TargetRegistry
*/
-class TargetRegistry
-{
-public:
+class TargetRegistry {
+ public:
typedef std::list<mcld::Target*> TargetListTy;
typedef TargetListTy::iterator iterator;
-private:
+ private:
static TargetListTy s_TargetList;
-public:
+ public:
static iterator begin() { return s_TargetList.begin(); }
static iterator end() { return s_TargetList.end(); }
@@ -54,36 +54,13 @@
const char* pName,
Target::TripleMatchQualityFnTy pQualityFn);
- /// RegisterTargetMachine - Register a TargetMachine implementation for the
- /// given target.
- ///
- /// @param T - The target being registered.
- /// @param Fn - A function to construct a TargetMachine for the target.
- static void RegisterTargetMachine(mcld::Target &T, mcld::Target::TargetMachineCtorTy Fn)
- {
- // Ignore duplicate registration.
- if (!T.TargetMachineCtorFn)
- T.TargetMachineCtorFn = Fn;
- }
-
- /// RegisterMCLinker - Register a MCLinker implementation for the given
- /// target.
- ///
- /// @param T - the target being registered
- /// @param Fn - A function to create MCLinker for the target
- static void RegisterMCLinker(mcld::Target &T, mcld::Target::MCLinkerCtorTy Fn)
- {
- if (!T.MCLinkerCtorFn)
- T.MCLinkerCtorFn = Fn;
- }
-
/// RegisterEmulation - Register a emulation function for the target.
/// target.
///
/// @param T - the target being registered
/// @param Fn - A emulation function
- static void RegisterEmulation(mcld::Target &T, mcld::Target::EmulationFnTy Fn)
- {
+ static void RegisterEmulation(mcld::Target& T,
+ mcld::Target::EmulationFnTy Fn) {
if (!T.EmulationFn)
T.EmulationFn = Fn;
}
@@ -93,8 +70,8 @@
///
/// @param T - The target being registered
/// @param Fn - A function to create TargetLDBackend for the target
- static void RegisterTargetLDBackend(mcld::Target &T, mcld::Target::TargetLDBackendCtorTy Fn)
- {
+ static void RegisterTargetLDBackend(mcld::Target& T,
+ mcld::Target::TargetLDBackendCtorTy Fn) {
if (!T.TargetLDBackendCtorFn)
T.TargetLDBackendCtorFn = Fn;
}
@@ -104,10 +81,9 @@
///
/// @param T - The target being registered
/// @param Fn - A function to create DiagnosticLineInfo for the target
- static void
- RegisterDiagnosticLineInfo(mcld::Target &T,
- mcld::Target::DiagnosticLineInfoCtorTy Fn)
- {
+ static void RegisterDiagnosticLineInfo(
+ mcld::Target& T,
+ mcld::Target::DiagnosticLineInfoCtorTy Fn) {
if (!T.DiagnosticLineInfoCtorFn)
T.DiagnosticLineInfoCtorFn = Fn;
}
@@ -116,7 +92,7 @@
///
/// @param Triple - The Triple string
/// @param Error - The returned error message
- static const mcld::Target *lookupTarget(const std::string& pTriple,
+ static const mcld::Target* lookupTarget(const std::string& pTriple,
std::string& pError);
/// lookupTarget - Look up MCLinker target by an architecture name
@@ -127,9 +103,9 @@
/// @param pArch - The architecture name
/// @param pTriple - The target triple
/// @param pError - The returned error message
- static const mcld::Target *lookupTarget(const std::string& pArchName,
+ static const mcld::Target* lookupTarget(const std::string& pArchName,
llvm::Triple& pTriple,
- std::string &Error);
+ std::string& Error);
};
/// RegisterTarget - Helper function for registering a target, for use in the
@@ -140,15 +116,14 @@
/// extern "C" void MCLDInitializeFooTargetInfo() {
/// RegisterTarget<llvm::Foo> X(TheFooTarget, "foo", "Foo description");
/// }
-template<llvm::Triple::ArchType TargetArchType = llvm::Triple::UnknownArch>
-struct RegisterTarget
-{
-public:
- RegisterTarget(mcld::Target &pTarget, const char* pName) {
+template <llvm::Triple::ArchType TargetArchType = llvm::Triple::UnknownArch>
+struct RegisterTarget {
+ public:
+ RegisterTarget(mcld::Target& pTarget, const char* pName) {
// if we've registered one, then return immediately.
TargetRegistry::iterator target, ie = TargetRegistry::end();
for (target = TargetRegistry::begin(); target != ie; ++target) {
- if (0 == strcmp((*target)->name(), pName))
+ if (strcmp((*target)->name(), pName) == 0)
return;
}
@@ -162,31 +137,6 @@
}
};
-/// RegisterTargetMachine - Helper template for registering a target machine
-/// implementation, for use in the target machine initialization
-/// function. Usage:
-///
-/// extern "C" void MCLDInitializeFooTarget() {
-/// extern mcld::Target TheFooTarget;
-/// RegisterTargetMachine<mcld::FooTargetMachine> X(TheFooTarget);
-/// }
-template<class TargetMachineImpl>
-struct RegisterTargetMachine
-{
- RegisterTargetMachine(mcld::Target &T) {
- TargetRegistry::RegisterTargetMachine(T, &Allocator);
- }
+} // namespace mcld
-private:
- static MCLDTargetMachine *Allocator(const llvm::Target& pLLVMTarget,
- const mcld::Target& pMCLDTarget,
- llvm::TargetMachine& pTM,
- const std::string& pTriple) {
- return new TargetMachineImpl(pTM, pLLVMTarget, pMCLDTarget, pTriple);
- }
-};
-
-} //end namespace mcld
-
-#endif
-
+#endif // MCLD_SUPPORT_TARGETREGISTRY_H_
diff --git a/include/mcld/Support/TargetSelect.h b/include/mcld/Support/TargetSelect.h
index 32e568b..96bd510 100644
--- a/include/mcld/Support/TargetSelect.h
+++ b/include/mcld/Support/TargetSelect.h
@@ -6,94 +6,69 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#ifndef MCLD_SUPPORT_TARGETSELECT_H
-#define MCLD_SUPPORT_TARGETSELECT_H
+#ifndef MCLD_SUPPORT_TARGETSELECT_H_
+#define MCLD_SUPPORT_TARGETSELECT_H_
extern "C" {
- // Declare all of the target-initialization functions that are available.
+// Declare all of the target-initialization functions that are available.
#define MCLD_TARGET(TargetName) void MCLDInitialize##TargetName##LDTargetInfo();
-#include "mcld/Config/Targets.def"
+#include "mcld/Config/Targets.def" // NOLINT [build/include] [4]
- // Declare all of the target-dependent functions that are available.
-#define MCLD_TARGET(TargetName) void MCLDInitialize##TargetName##LDTarget();
-#include "mcld/Config/Targets.def"
-
- // Declare all of the target-depedent linker information
-#define MCLD_LINKER(TargetName) void MCLDInitialize##TargetName##LDInfo();
-#include "mcld/Config/Linkers.def"
-
- // Declare all of the available linker environment.
-#define MCLD_LINKER(TargetName) void MCLDInitialize##TargetName##MCLinker();
-#include "mcld/Config/Linkers.def"
-
- // Declare all of the available emulators.
+// Declare all of the available emulators.
#define MCLD_TARGET(TargetName) void MCLDInitialize##TargetName##Emulation();
-#include "mcld/Config/Targets.def"
+#include "mcld/Config/Targets.def" // NOLINT [build/include] [4]
- // Declare all of the available target-specific linker
+// Declare all of the available target-specific linker
#define MCLD_LINKER(TargetName) void MCLDInitialize##TargetName##LDBackend();
-#include "mcld/Config/Linkers.def"
+#include "mcld/Config/Linkers.def" // NOLINT [build/include] [4]
- // Declare all of the available target-specific diagnostic line infomation
-#define MCLD_LINKER(TargetName) void MCLDInitialize##TargetName##DiagnosticLineInfo();
-#include "mcld/Config/Linkers.def"
+// Declare all of the available target-specific diagnostic line infomation
+#define MCLD_LINKER(TargetName) \
+ void MCLDInitialize##TargetName##DiagnosticLineInfo();
+#include "mcld/Config/Linkers.def" // NOLINT [build/include] [4]
-} // extern "C"
+} // extern "C"
-namespace mcld
-{
- /// InitializeAllTargetInfos - The main program should call this function if
- /// it wants access to all available targets that MCLD is configured to
- /// support, to make them available via the TargetRegistry.
- ///
- /// It is legal for a client to make multiple calls to this function.
- inline void InitializeAllTargetInfos() {
+namespace mcld {
+/// InitializeAllTargetInfos - The main program should call this function if
+/// it wants access to all available targets that MCLD is configured to
+/// support, to make them available via the TargetRegistry.
+///
+/// It is legal for a client to make multiple calls to this function.
+inline void InitializeAllTargetInfos() {
#define MCLD_TARGET(TargetName) MCLDInitialize##TargetName##LDTargetInfo();
-#include "mcld/Config/Targets.def"
- }
+#include "mcld/Config/Targets.def" // NOLINT [build/include] [4]
+}
- /// InitializeAllTargets - The main program should call this function if it
- /// wants access to all available target machines that MCLD is configured to
- /// support, to make them available via the TargetRegistry.
- ///
- /// It is legal for a client to make multiple calls to this function.
- inline void InitializeAllTargets() {
- mcld::InitializeAllTargetInfos();
+/// InitializeAllTargets - The main program should call this function if it
+/// wants access to all available target machines that MCLD is configured to
+/// support, to make them available via the TargetRegistry.
+///
+/// It is legal for a client to make multiple calls to this function.
+inline void InitializeAllTargets() {
+ mcld::InitializeAllTargetInfos();
#define MCLD_TARGET(TargetName) MCLDInitialize##TargetName##LDBackend();
-#include "mcld/Config/Targets.def"
- }
+#include "mcld/Config/Targets.def" // NOLINT [build/include] [4]
+}
- /// InitializeAllEmulations - The main program should call this function if
- /// it wants all emulations to be configured to support. This function makes
- /// all emulations available via the TargetRegistry.
- inline void InitializeAllEmulations() {
+/// InitializeAllEmulations - The main program should call this function if
+/// it wants all emulations to be configured to support. This function makes
+/// all emulations available via the TargetRegistry.
+inline void InitializeAllEmulations() {
#define MCLD_TARGET(TargetName) MCLDInitialize##TargetName##Emulation();
-#include "mcld/Config/Targets.def"
- }
+#include "mcld/Config/Targets.def" // NOLINT [build/include] [4]
+}
- /// InitializeAllLinkers - The main program should call this function if it
- /// wants all linkers that is configured to support, to make them
- /// available via the TargetRegistry.
- ///
- /// It is legal for a client to make multiple calls to this function.
- inline void InitializeAllLinkers() {
-#define MCLD_TARGET(TargetName) MCLDInitialize##TargetName##LDTarget();
-#include "mcld/Config/Targets.def"
+/// InitializeMsgHandler - The main program should call this function if it
+/// wants to print linker-specific messages. To make them available via the
+/// TargetRegistry.
+inline void InitializeAllDiagnostics() {
+#define MCLD_LINKER(TargetName) \
+ MCLDInitialize##TargetName##DiagnosticLineInfo();
+#include "mcld/Config/Linkers.def" // NOLINT [build/include] [4]
+}
-#define MCLD_LINKER(TargetName) MCLDInitialize##TargetName##MCLinker();
-#include "mcld/Config/Linkers.def"
- }
+} // namespace mcld
- /// InitializeMsgHandler - The main program should call this function if it
- /// wants to print linker-specific messages. To make them available via the
- /// TargetRegistry.
- inline void InitializeAllDiagnostics() {
-#define MCLD_LINKER(TargetName) MCLDInitialize##TargetName##DiagnosticLineInfo();
-#include "mcld/Config/Linkers.def"
- }
-
-} // namespace of mcld
-
-#endif
-
+#endif // MCLD_SUPPORT_TARGETSELECT_H_
diff --git a/include/mcld/Support/UniqueGCFactory.h b/include/mcld/Support/UniqueGCFactory.h
index 8d7927b..a0d5a8f 100644
--- a/include/mcld/Support/UniqueGCFactory.h
+++ b/include/mcld/Support/UniqueGCFactory.h
@@ -6,39 +6,36 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#ifndef MCLD_SUPPORT_UNIQUEGCFACTORY_H
-#define MCLD_SUPPORT_UNIQUEGCFACTORY_H
+#ifndef MCLD_SUPPORT_UNIQUEGCFACTORY_H_
+#define MCLD_SUPPORT_UNIQUEGCFACTORY_H_
#include "mcld/Support/GCFactory.h"
+
#include <map>
#include <utility>
-namespace mcld
-{
+namespace mcld {
/** \class UniqueGCFactoryBase
* \brief UniqueGCFactories are unique associative factories, meaning that
* no two elements have the same key.
*/
-template<typename KeyType, typename DataType, size_t ChunkSize>
-class UniqueGCFactoryBase : public GCFactoryBase<LinearAllocator<DataType, ChunkSize> >
-{
-protected:
+template <typename KeyType, typename DataType, size_t ChunkSize>
+class UniqueGCFactoryBase
+ : public GCFactoryBase<LinearAllocator<DataType, ChunkSize> > {
+ protected:
typedef GCFactoryBase<LinearAllocator<DataType, ChunkSize> > Alloc;
typedef std::map<KeyType, DataType*> KeyMap;
-protected:
+ protected:
UniqueGCFactoryBase()
- : GCFactoryBase<LinearAllocator<DataType, ChunkSize> >()
- { }
+ : GCFactoryBase<LinearAllocator<DataType, ChunkSize> >() {}
- UniqueGCFactoryBase(size_t pNum)
- : GCFactoryBase<LinearAllocator<DataType, ChunkSize> >(pNum)
- { }
+ explicit UniqueGCFactoryBase(size_t pNum)
+ : GCFactoryBase<LinearAllocator<DataType, ChunkSize> >(pNum) {}
-public:
- virtual ~UniqueGCFactoryBase()
- { f_KeyMap.clear(); }
+ public:
+ virtual ~UniqueGCFactoryBase() { f_KeyMap.clear(); }
DataType* find(const KeyType& pKey) {
typename KeyMap::iterator dataIter = f_KeyMap.find(pKey);
@@ -80,12 +77,10 @@
return data;
}
-protected:
+ protected:
KeyMap f_KeyMap;
-
};
-} // namespace of mcld
+} // namespace mcld
-#endif
-
+#endif // MCLD_SUPPORT_UNIQUEGCFACTORY_H_
diff --git a/include/mcld/Support/raw_ostream.h b/include/mcld/Support/raw_ostream.h
index aae2336..b3a9f83 100644
--- a/include/mcld/Support/raw_ostream.h
+++ b/include/mcld/Support/raw_ostream.h
@@ -6,17 +6,17 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#ifndef MCLD_SUPPORT_RAWOSTREAM_H
-#define MCLD_SUPPORT_RAWOSTREAM_H
-#include <string>
+#ifndef MCLD_SUPPORT_RAW_OSTREAM_H_
+#define MCLD_SUPPORT_RAW_OSTREAM_H_
#include <llvm/Support/FileSystem.h>
#include <llvm/Support/raw_ostream.h>
+#include <string>
+
namespace mcld {
-class raw_fd_ostream : public llvm::raw_fd_ostream
-{
-public:
+class raw_fd_ostream : public llvm::raw_fd_ostream {
+ public:
/// raw_fd_ostream - Open the specified file for writing. If an error occurs,
/// information about the error is put into ErrorInfo, and the stream should
/// be immediately destroyed; the string will be empty if no error occurred.
@@ -27,44 +27,41 @@
/// itself to own the file descriptor. In particular, it will close the
/// file descriptor when it is done (this is necessary to detect
/// output errors).
- raw_fd_ostream(const char *pFilename,
- std::string &pErrorInfo,
+ raw_fd_ostream(const char* pFilename,
+ std::error_code& pErrorCode,
llvm::sys::fs::OpenFlags pFlags = llvm::sys::fs::F_None);
/// raw_fd_ostream ctor - FD is the file descriptor that this writes to. If
/// ShouldClose is true, this closes the file when the stream is destroyed.
- raw_fd_ostream(int pFD, bool pShouldClose, bool pUnbuffered=false);
+ raw_fd_ostream(int pFD, bool pShouldClose, bool pUnbuffered = false);
virtual ~raw_fd_ostream();
void setColor(bool pEnable = true);
+ llvm::raw_ostream& changeColor(enum llvm::raw_ostream::Colors pColors,
+ bool pBold = false,
+ bool pBackground = false);
- llvm::raw_ostream &changeColor(enum llvm::raw_ostream::Colors pColors,
- bool pBold=false,
- bool pBackground=false);
+ llvm::raw_ostream& resetColor();
- llvm::raw_ostream &resetColor();
-
- llvm::raw_ostream &reverseColor();
+ llvm::raw_ostream& reverseColor();
bool is_displayed() const;
-private:
+ private:
bool m_bConfigColor : 1;
bool m_bSetColor : 1;
-
};
/// outs() - This returns a reference to a raw_ostream for standard output.
/// Use it like: outs() << "foo" << "bar";
-mcld::raw_fd_ostream &outs();
+mcld::raw_fd_ostream& outs();
/// errs() - This returns a reference to a raw_ostream for standard error.
/// Use it like: errs() << "foo" << "bar";
-mcld::raw_fd_ostream &errs();
+mcld::raw_fd_ostream& errs();
-} // namespace of mcld
+} // namespace mcld
-#endif
-
+#endif // MCLD_SUPPORT_RAW_OSTREAM_H_