[CodeView] Improve the line table dumper
[oota-llvm.git] / include / llvm / Support / GCOV.h
index c0e1c454947aecd7c7ac225ef10132a59000b8ba..544434f036a4a8fb74a79d3a063db9c7fa0e65aa 100644 (file)
@@ -30,12 +30,11 @@ class GCOVBlock;
 class FileInfo;
 
 namespace GCOV {
-enum GCOVVersion { V402, V404 };
-} // end GCOV namespace
+enum GCOVVersion { V402, V404, V704 };
 
-/// GCOVOptions - A struct for passing gcov options between functions.
-struct GCOVOptions {
-  GCOVOptions(bool A, bool B, bool C, bool F, bool P, bool U, bool L, bool N)
+/// \brief A struct for passing gcov options between functions.
+struct Options {
+  Options(bool A, bool B, bool C, bool F, bool P, bool U, bool L, bool N)
       : AllBlocks(A), BranchInfo(B), BranchCount(C), FuncCoverage(F),
         PreservePaths(P), UncondBranch(U), LongFileNames(L), NoOutput(N) {}
 
@@ -48,6 +47,7 @@ struct GCOVOptions {
   bool LongFileNames;
   bool NoOutput;
 };
+} // end GCOV namespace
 
 /// GCOVBuffer - A wrapper around MemoryBuffer to provide GCOV specific
 /// read operations.
@@ -90,6 +90,11 @@ public:
       Version = GCOV::V404;
       return true;
     }
+    if (VersionStr == "*704") {
+      Cursor += 4;
+      Version = GCOV::V704;
+      return true;
+    }
     errs() << "Unexpected version: " << VersionStr << ".\n";
     return false;
   }
@@ -390,7 +395,7 @@ class FileInfo {
   };
 
 public:
-  FileInfo(const GCOVOptions &Options)
+  FileInfo(const GCOV::Options &Options)
       : Options(Options), LineInfo(), RunCount(0), ProgramCount(0) {}
 
   void addBlockLine(StringRef Filename, uint32_t Line, const GCOVBlock *Block) {
@@ -406,7 +411,8 @@ public:
   }
   void setRunCount(uint32_t Runs) { RunCount = Runs; }
   void setProgramCount(uint32_t Programs) { ProgramCount = Programs; }
-  void print(StringRef MainFilename, StringRef GCNOFile, StringRef GCDAFile);
+  void print(raw_ostream &OS, StringRef MainFilename, StringRef GCNOFile,
+             StringRef GCDAFile);
 
 private:
   std::string getCoveragePath(StringRef Filename, StringRef MainFilename);
@@ -419,11 +425,11 @@ private:
   void printUncondBranchInfo(raw_ostream &OS, uint32_t &EdgeNo,
                              uint64_t Count) const;
 
-  void printCoverage(const GCOVCoverage &Coverage) const;
-  void printFuncCoverage() const;
-  void printFileCoverage() const;
+  void printCoverage(raw_ostream &OS, const GCOVCoverage &Coverage) const;
+  void printFuncCoverage(raw_ostream &OS) const;
+  void printFileCoverage(raw_ostream &OS) const;
 
-  const GCOVOptions &Options;
+  const GCOV::Options &Options;
   StringMap<LineData> LineInfo;
   uint32_t RunCount;
   uint32_t ProgramCount;