Index: include/llvm/Support/Allocator.h =================================================================== --- include/llvm/Support/Allocator.h +++ include/llvm/Support/Allocator.h @@ -22,13 +22,16 @@ #define LLVM_SUPPORT_ALLOCATOR_H #include "llvm/ADT/SmallVector.h" -#include "llvm/Support/DataTypes.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/MathExtras.h" -#include "llvm/Support/Memory.h" #include #include #include +#include #include +#include +#include +#include namespace llvm { @@ -113,7 +116,8 @@ // printing code uses Allocator.h in its implementation. void printBumpPtrAllocatorStats(unsigned NumSlabs, size_t BytesAllocated, size_t TotalMemory); -} // End namespace detail. + +} // end namespace detail /// \brief Allocate memory in an ever growing pool, as if by bump-pointer. /// @@ -365,7 +369,7 @@ BumpPtrAllocator Allocator; public: - SpecificBumpPtrAllocator() : Allocator() {} + SpecificBumpPtrAllocator() {} SpecificBumpPtrAllocator(SpecificBumpPtrAllocator &&Old) : Allocator(std::move(Old.Allocator)) {} ~SpecificBumpPtrAllocator() { DestroyAll(); } @@ -409,7 +413,7 @@ T *Allocate(size_t num = 1) { return Allocator.Allocate(num); } }; -} // end namespace llvm +} // end namespace llvm template void *operator new(size_t Size, Index: include/llvm/Support/GCOV.h =================================================================== --- include/llvm/Support/GCOV.h +++ include/llvm/Support/GCOV.h @@ -1,4 +1,4 @@ -//===- GCOV.h - LLVM coverage tool ----------------------------------------===// +//===- GCOV.h - LLVM coverage tool ------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -16,12 +16,20 @@ #define LLVM_SUPPORT_GCOV_H #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/iterator.h" +#include "llvm/ADT/iterator_range.h" #include "llvm/ADT/MapVector.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringMap.h" -#include "llvm/ADT/iterator.h" +#include "llvm/ADT/StringRef.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/raw_ostream.h" +#include +#include +#include +#include +#include +#include namespace llvm { @@ -30,6 +38,7 @@ class FileInfo; namespace GCOV { + enum GCOVVersion { V402, V404, V704 }; /// \brief A struct for passing gcov options between functions. @@ -47,7 +56,8 @@ bool LongFileNames; bool NoOutput; }; -} // end GCOV namespace + +} // end namespace GCOV /// GCOVBuffer - A wrapper around MemoryBuffer to provide GCOV specific /// read operations. @@ -232,8 +242,9 @@ class GCOVFile { public: GCOVFile() - : GCNOInitialized(false), Checksum(0), Functions(), RunCount(0), + : GCNOInitialized(false), Checksum(0), RunCount(0), ProgramCount(0) {} + bool readGCNO(GCOVBuffer &Buffer); bool readGCDA(GCOVBuffer &Buffer); uint32_t getChecksum() const { return Checksum; } @@ -312,9 +323,9 @@ typedef SmallVectorImpl::const_iterator EdgeIterator; GCOVBlock(GCOVFunction &P, uint32_t N) - : Parent(P), Number(N), Counter(0), DstEdgesAreSorted(true), SrcEdges(), - DstEdges(), Lines() {} + : Parent(P), Number(N), Counter(0), DstEdgesAreSorted(true) {} ~GCOVBlock(); + const GCOVFunction &getParent() const { return Parent; } void addLine(uint32_t N) { Lines.push_back(N); } uint32_t getLastLine() const { return Lines.back(); } @@ -325,6 +336,7 @@ assert(&Edge->Dst == this); // up to caller to ensure edge is valid SrcEdges.push_back(Edge); } + void addDstEdge(GCOVEdge *Edge) { assert(&Edge->Src == this); // up to caller to ensure edge is valid // Check if adding this edge causes list to become unsorted. @@ -332,6 +344,7 @@ DstEdgesAreSorted = false; DstEdges.push_back(Edge); } + size_t getNumSrcEdges() const { return SrcEdges.size(); } size_t getNumDstEdges() const { return DstEdges.size(); } void sortDstEdges(); @@ -396,19 +409,21 @@ public: FileInfo(const GCOV::Options &Options) - : Options(Options), LineInfo(), RunCount(0), ProgramCount(0) {} + : Options(Options), RunCount(0), ProgramCount(0) {} void addBlockLine(StringRef Filename, uint32_t Line, const GCOVBlock *Block) { if (Line > LineInfo[Filename].LastLine) LineInfo[Filename].LastLine = Line; LineInfo[Filename].Blocks[Line - 1].push_back(Block); } + void addFunctionLine(StringRef Filename, uint32_t Line, const GCOVFunction *Function) { if (Line > LineInfo[Filename].LastLine) LineInfo[Filename].LastLine = Line; LineInfo[Filename].Functions[Line - 1].push_back(Function); } + void setRunCount(uint32_t Runs) { RunCount = Runs; } void setProgramCount(uint32_t Programs) { ProgramCount = Programs; } void print(raw_ostream &OS, StringRef MainFilename, StringRef GCNOFile, @@ -440,6 +455,7 @@ FileCoverageList FileCoverages; FuncCoverageMap FuncCoverages; }; -} -#endif +} // end namespace llvm + +#endif // LLVM_SUPPORT_GCOV_H Index: include/llvm/Support/RWMutex.h =================================================================== --- include/llvm/Support/RWMutex.h +++ include/llvm/Support/RWMutex.h @@ -18,10 +18,9 @@ #include "llvm/Support/Threading.h" #include -namespace llvm -{ - namespace sys - { +namespace llvm { +namespace sys { + /// @brief Platform agnostic RWMutex class. class RWMutexImpl { @@ -90,8 +89,9 @@ class SmartRWMutex { RWMutexImpl impl; unsigned readers, writers; + public: - explicit SmartRWMutex() : impl(), readers(0), writers(0) { } + explicit SmartRWMutex() : readers(0), writers(0) {} bool lock_shared() { if (!mt_only || llvm_is_multithreaded()) @@ -140,6 +140,7 @@ SmartRWMutex(const SmartRWMutex & original); void operator=(const SmartRWMutex &); }; + typedef SmartRWMutex RWMutex; /// ScopedReader - RAII acquisition of a reader lock @@ -155,6 +156,7 @@ mutex.unlock_shared(); } }; + typedef SmartScopedReader ScopedReader; /// ScopedWriter - RAII acquisition of a writer lock @@ -170,8 +172,10 @@ mutex.unlock(); } }; + typedef SmartScopedWriter ScopedWriter; - } -} -#endif +} // end namespace sys +} // end namespace llvm + +#endif // LLVM_SUPPORT_RWMUTEX_H Index: include/llvm/Support/SMLoc.h =================================================================== --- include/llvm/Support/SMLoc.h +++ include/llvm/Support/SMLoc.h @@ -51,7 +51,7 @@ SMLoc Start, End; SMRange() {} - SMRange(NoneType) : Start(), End() {} + SMRange(NoneType) {} SMRange(SMLoc St, SMLoc En) : Start(St), End(En) { assert(Start.isValid() == End.isValid() && "Start and end should either both be valid or both be invalid!"); @@ -62,4 +62,4 @@ } // end namespace llvm -#endif +#endif // LLVM_SUPPORT_SMLOC_H