ReleaseNotes: fix typo, reported by Eugene
[oota-llvm.git] / docs / CoverageMappingFormat.rst
index 8fcffb838a3fa369865c23698c45521f49c86d3c..84cddff5ed9ed9b12b455d235bba4f57104bab53 100644 (file)
@@ -241,15 +241,25 @@ For example, let’s consider a C file and how it gets compiled to LLVM:
     return 13;
   }
 
-The coverage mapping variable generated by Clang is:
+The coverage mapping variable generated by Clang has 3 fields:
+
+* Coverage mapping header.
+
+* An array of function records.
+
+* Coverage mapping data which is an array of bytes. Zero paddings are added at the end to force 8 byte alignment.
 
 .. code-block:: llvm
 
-  @__llvm_coverage_mapping = internal constant { i32, i32, i32, i32, [2 x { i8*, i32, i32 }], [40 x i8] }
-  { i32 2,  ; The number of function records
-    i32 20, ; The length of the string that contains the encoded translation unit filenames
-    i32 20, ; The length of the string that contains the encoded coverage mapping data
-    i32 0,  ; Coverage mapping format version
+  @__llvm_coverage_mapping = internal constant { { i32, i32, i32, i32 }, [2 x { i8*, i32, i32 }], [40 x i8] }
+  { 
+    { i32, i32, i32, i32 } ; Coverage map header
+    {
+      i32 2,  ; The number of function records
+      i32 20, ; The length of the string that contains the encoded translation unit filenames
+      i32 20, ; The length of the string that contains the encoded coverage mapping data
+      i32 0,  ; Coverage mapping format version
+    },
     [2 x { i8*, i32, i32 }] [ ; Function records
      { i8*, i32, i32 } { i8* getelementptr inbounds ([3 x i8]* @__llvm_profile_name_foo, i32 0, i32 0), ; Function's name
        i32 3, ; Function's name length
@@ -262,12 +272,18 @@ The coverage mapping variable generated by Clang is:
    [40 x i8] c"..." ; Encoded data (dissected later)
   }, section "__llvm_covmap", align 8
 
-Version:
---------
+Coverage Mapping Header:
+------------------------
+
+The coverage mapping header has the following fields:
+
+* The number of function records.
+
+* The length of the string in the third field of *__llvm_coverage_mapping* that contains the encoded translation unit filenames.
 
-The coverage mapping version number can have the following values:
+* The length of the string in the third field of *__llvm_coverage_mapping* that contains the encoded coverage mapping data.
 
-* 0 — The first (current) version of the coverage mapping format.
+* The format version. 0 is the first (current) version of the coverage mapping format.
 
 .. _function records:
 
@@ -331,7 +347,7 @@ IR for the `coverage mapping sample`_ that was shown earlier:
 * The length of the substring that contains the encoded coverage mapping data
   for the first function is the value of the third field in the first
   structure in an array of `function records`_ stored in the
-  fifth field of the *__llvm_coverage_mapping* structure, which is the 9.
+  third field of the *__llvm_coverage_mapping* structure, which is the 9.
   Therefore, the coverage mapping for the first function record is encoded
   in this string:
 
@@ -351,7 +367,7 @@ IR for the `coverage mapping sample`_ that was shown earlier:
   | ``0x01`` | The number of mapping regions that are stored in an array for the function's file id #0.                                |
   +----------+-------------------------------------------------------------------------------------------------------------------------+
   | ``0x01`` | The coverage mapping counter for the first region in this function. The value of 1 tells us that it's a coverage        |
-  |          | mapping counter that is a reference ot the profile instrumentation counter with an index of 0.                          |
+  |          | mapping counter that is a reference to the profile instrumentation counter with an index of 0.                          |
   +----------+-------------------------------------------------------------------------------------------------------------------------+
   | ``0x01`` | The starting line of the first mapping region in this function.                                                         |
   +----------+-------------------------------------------------------------------------------------------------------------------------+
@@ -405,7 +421,7 @@ LEB128 is an unsigned interger value that is encoded using DWARF's LEB128
 encoding, optimizing for the case where values are small
 (1 byte for values less than 128).
 
-.. _strings:
+.. _Strings:
 
 Strings
 ^^^^^^^