mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-11-04 05:17:07 +00:00 
			
		
		
		
	llvm-cov: Added constness property to methods.
Added constness to methods that shouldn't modify objects. Replaced operator[] lookup in maps with find() instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195151 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		@@ -196,7 +196,7 @@ public:
 | 
				
			|||||||
  GCOVFile() : Functions(), RunCount(0), ProgramCount(0) {}
 | 
					  GCOVFile() : Functions(), RunCount(0), ProgramCount(0) {}
 | 
				
			||||||
  ~GCOVFile();
 | 
					  ~GCOVFile();
 | 
				
			||||||
  bool read(GCOVBuffer &Buffer);
 | 
					  bool read(GCOVBuffer &Buffer);
 | 
				
			||||||
  void dump();
 | 
					  void dump() const;
 | 
				
			||||||
  void collectLineCounts(FileInfo &FI);
 | 
					  void collectLineCounts(FileInfo &FI);
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
  SmallVector<GCOVFunction *, 16> Functions;
 | 
					  SmallVector<GCOVFunction *, 16> Functions;
 | 
				
			||||||
@@ -211,7 +211,7 @@ public:
 | 
				
			|||||||
  ~GCOVFunction();
 | 
					  ~GCOVFunction();
 | 
				
			||||||
  bool read(GCOVBuffer &Buffer, GCOV::GCOVFormat Format);
 | 
					  bool read(GCOVBuffer &Buffer, GCOV::GCOVFormat Format);
 | 
				
			||||||
  StringRef getFilename() const { return Filename; }
 | 
					  StringRef getFilename() const { return Filename; }
 | 
				
			||||||
  void dump();
 | 
					  void dump() const;
 | 
				
			||||||
  void collectLineCounts(FileInfo &FI);
 | 
					  void collectLineCounts(FileInfo &FI);
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
  uint32_t Ident;
 | 
					  uint32_t Ident;
 | 
				
			||||||
@@ -230,8 +230,8 @@ public:
 | 
				
			|||||||
  void addEdge(uint32_t N) { Edges.push_back(N); }
 | 
					  void addEdge(uint32_t N) { Edges.push_back(N); }
 | 
				
			||||||
  void addLine(uint32_t N) { Lines.push_back(N); }
 | 
					  void addLine(uint32_t N) { Lines.push_back(N); }
 | 
				
			||||||
  void addCount(uint64_t N) { Counter += N; }
 | 
					  void addCount(uint64_t N) { Counter += N; }
 | 
				
			||||||
  size_t getNumEdges() { return Edges.size(); }
 | 
					  size_t getNumEdges() const { return Edges.size(); }
 | 
				
			||||||
  void dump();
 | 
					  void dump() const;
 | 
				
			||||||
  void collectLineCounts(FileInfo &FI);
 | 
					  void collectLineCounts(FileInfo &FI);
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
  GCOVFunction &Parent;
 | 
					  GCOVFunction &Parent;
 | 
				
			||||||
@@ -249,7 +249,7 @@ public:
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
  void setRunCount(uint32_t Runs) { RunCount = Runs; }
 | 
					  void setRunCount(uint32_t Runs) { RunCount = Runs; }
 | 
				
			||||||
  void setProgramCount(uint32_t Programs) { ProgramCount = Programs; }
 | 
					  void setProgramCount(uint32_t Programs) { ProgramCount = Programs; }
 | 
				
			||||||
  void print(raw_fd_ostream &OS, StringRef gcnoFile, StringRef gcdaFile);
 | 
					  void print(raw_fd_ostream &OS, StringRef gcnoFile, StringRef gcdaFile) const;
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
  StringMap<LineCounts> LineInfo;
 | 
					  StringMap<LineCounts> LineInfo;
 | 
				
			||||||
  uint32_t RunCount;
 | 
					  uint32_t RunCount;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -84,8 +84,8 @@ bool GCOVFile::read(GCOVBuffer &Buffer) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// dump - Dump GCOVFile content to dbgs() for debugging purposes.
 | 
					/// dump - Dump GCOVFile content to dbgs() for debugging purposes.
 | 
				
			||||||
void GCOVFile::dump() {
 | 
					void GCOVFile::dump() const {
 | 
				
			||||||
  for (SmallVectorImpl<GCOVFunction *>::iterator I = Functions.begin(),
 | 
					  for (SmallVectorImpl<GCOVFunction *>::const_iterator I = Functions.begin(),
 | 
				
			||||||
         E = Functions.end(); I != E; ++I)
 | 
					         E = Functions.end(); I != E; ++I)
 | 
				
			||||||
    (*I)->dump();
 | 
					    (*I)->dump();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -221,9 +221,9 @@ bool GCOVFunction::read(GCOVBuffer &Buff, GCOV::GCOVFormat Format) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// dump - Dump GCOVFunction content to dbgs() for debugging purposes.
 | 
					/// dump - Dump GCOVFunction content to dbgs() for debugging purposes.
 | 
				
			||||||
void GCOVFunction::dump() {
 | 
					void GCOVFunction::dump() const {
 | 
				
			||||||
  dbgs() <<  "===== " << Name << " @ " << Filename << ":" << LineNumber << "\n";
 | 
					  dbgs() <<  "===== " << Name << " @ " << Filename << ":" << LineNumber << "\n";
 | 
				
			||||||
  for (SmallVectorImpl<GCOVBlock *>::iterator I = Blocks.begin(),
 | 
					  for (SmallVectorImpl<GCOVBlock *>::const_iterator I = Blocks.begin(),
 | 
				
			||||||
         E = Blocks.end(); I != E; ++I)
 | 
					         E = Blocks.end(); I != E; ++I)
 | 
				
			||||||
    (*I)->dump();
 | 
					    (*I)->dump();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -254,18 +254,18 @@ void GCOVBlock::collectLineCounts(FileInfo &FI) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// dump - Dump GCOVBlock content to dbgs() for debugging purposes.
 | 
					/// dump - Dump GCOVBlock content to dbgs() for debugging purposes.
 | 
				
			||||||
void GCOVBlock::dump() {
 | 
					void GCOVBlock::dump() const {
 | 
				
			||||||
  dbgs() << "Block : " << Number << " Counter : " << Counter << "\n";
 | 
					  dbgs() << "Block : " << Number << " Counter : " << Counter << "\n";
 | 
				
			||||||
  if (!Edges.empty()) {
 | 
					  if (!Edges.empty()) {
 | 
				
			||||||
    dbgs() << "\tEdges : ";
 | 
					    dbgs() << "\tEdges : ";
 | 
				
			||||||
    for (SmallVectorImpl<uint32_t>::iterator I = Edges.begin(), E = Edges.end();
 | 
					    for (SmallVectorImpl<uint32_t>::const_iterator I = Edges.begin(), E = Edges.end();
 | 
				
			||||||
         I != E; ++I)
 | 
					         I != E; ++I)
 | 
				
			||||||
      dbgs() << (*I) << ",";
 | 
					      dbgs() << (*I) << ",";
 | 
				
			||||||
    dbgs() << "\n";
 | 
					    dbgs() << "\n";
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (!Lines.empty()) {
 | 
					  if (!Lines.empty()) {
 | 
				
			||||||
    dbgs() << "\tLines : ";
 | 
					    dbgs() << "\tLines : ";
 | 
				
			||||||
    for (SmallVectorImpl<uint32_t>::iterator I = Lines.begin(),
 | 
					    for (SmallVectorImpl<uint32_t>::const_iterator I = Lines.begin(),
 | 
				
			||||||
           E = Lines.end(); I != E; ++I)
 | 
					           E = Lines.end(); I != E; ++I)
 | 
				
			||||||
      dbgs() << (*I) << ",";
 | 
					      dbgs() << (*I) << ",";
 | 
				
			||||||
    dbgs() << "\n";
 | 
					    dbgs() << "\n";
 | 
				
			||||||
@@ -277,16 +277,16 @@ void GCOVBlock::dump() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// print -  Print source files with collected line count information.
 | 
					/// print -  Print source files with collected line count information.
 | 
				
			||||||
void FileInfo::print(raw_fd_ostream &OS, StringRef gcnoFile,
 | 
					void FileInfo::print(raw_fd_ostream &OS, StringRef gcnoFile,
 | 
				
			||||||
                     StringRef gcdaFile) {
 | 
					                     StringRef gcdaFile) const {
 | 
				
			||||||
  for (StringMap<LineCounts>::iterator I = LineInfo.begin(), E = LineInfo.end();
 | 
					  for (StringMap<LineCounts>::const_iterator I = LineInfo.begin(),
 | 
				
			||||||
       I != E; ++I) {
 | 
					         E = LineInfo.end(); I != E; ++I) {
 | 
				
			||||||
    StringRef Filename = I->first();
 | 
					    StringRef Filename = I->first();
 | 
				
			||||||
    OS << "        -:    0:Source:" << Filename << "\n";
 | 
					    OS << "        -:    0:Source:" << Filename << "\n";
 | 
				
			||||||
    OS << "        -:    0:Graph:" << gcnoFile << "\n";
 | 
					    OS << "        -:    0:Graph:" << gcnoFile << "\n";
 | 
				
			||||||
    OS << "        -:    0:Data:" << gcdaFile << "\n";
 | 
					    OS << "        -:    0:Data:" << gcdaFile << "\n";
 | 
				
			||||||
    OS << "        -:    0:Runs:" << RunCount << "\n";
 | 
					    OS << "        -:    0:Runs:" << RunCount << "\n";
 | 
				
			||||||
    OS << "        -:    0:Programs:" << ProgramCount << "\n";
 | 
					    OS << "        -:    0:Programs:" << ProgramCount << "\n";
 | 
				
			||||||
    LineCounts &L = LineInfo[Filename];
 | 
					    const LineCounts &L = I->second;
 | 
				
			||||||
    OwningPtr<MemoryBuffer> Buff;
 | 
					    OwningPtr<MemoryBuffer> Buff;
 | 
				
			||||||
    if (error_code ec = MemoryBuffer::getFileOrSTDIN(Filename, Buff)) {
 | 
					    if (error_code ec = MemoryBuffer::getFileOrSTDIN(Filename, Buff)) {
 | 
				
			||||||
      errs() << Filename << ": " << ec.message() << "\n";
 | 
					      errs() << Filename << ": " << ec.message() << "\n";
 | 
				
			||||||
@@ -295,11 +295,12 @@ void FileInfo::print(raw_fd_ostream &OS, StringRef gcnoFile,
 | 
				
			|||||||
    StringRef AllLines = Buff->getBuffer();
 | 
					    StringRef AllLines = Buff->getBuffer();
 | 
				
			||||||
    uint32_t i = 0;
 | 
					    uint32_t i = 0;
 | 
				
			||||||
    while (!AllLines.empty()) {
 | 
					    while (!AllLines.empty()) {
 | 
				
			||||||
      if (L.find(i) != L.end()) {
 | 
					      LineCounts::const_iterator CountIt = L.find(i);
 | 
				
			||||||
        if (L[i] == 0)
 | 
					      if (CountIt != L.end()) {
 | 
				
			||||||
 | 
					        if (CountIt->second == 0)
 | 
				
			||||||
          OS << "    #####:";
 | 
					          OS << "    #####:";
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
          OS << format("%9" PRIu64 ":", L[i]);
 | 
					          OS << format("%9" PRIu64 ":", CountIt->second);
 | 
				
			||||||
      } else {
 | 
					      } else {
 | 
				
			||||||
        OS << "        -:";
 | 
					        OS << "        -:";
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user