[PATCH] D25985: [analyzer] Export coverage information from the analyzer.

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 4 12:58:43 PDT 2016


xazax.hun added a comment.

In https://reviews.llvm.org/D25985#580270, @zaks.anna wrote:

> Please, add multi-file tests and tests where a line is covered more than once.


Ok, I will add it in the next iteration.



================
Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:262
+
+static void dumpCoverageInfo(llvm::SmallVectorImpl<char> &Path,
+                             SourceManager &SM) {
----------------
zaks.anna wrote:
> Can this be a debug checker?
You mean the dumping part or also collecting the coverage? It can be a debug checker if we add a new callback like "checkBasicBlockBegin". I did not want to add such callback just for a debug check. However, it is possible to move only the dumping part to a separate checker. What would you prefer?


================
Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:281
+    llvm::raw_os_ostream Out(OutFile);
+    Out << "-:0:Source:" << FE->getName() << '\n';
+    Out << "-:0:Runs:1\n";
----------------
zaks.anna wrote:
> What does '-' mean in this case? Why is it needed?
The `-` means lines without executable code. `######` means lines that contains executable code but unexecuted. The lines that has "0" as the line number are attributes to help the tools consume the gcov file.


================
Comment at: test/Analysis/record-coverage.cpp.expected:2
+// CHECK:      -:4:int main() {
+// CHECK-NEXT: -:5:  int i = 2;
+// CHECK-NEXT: 1:6:  ++i;
----------------
zaks.anna wrote:
> Does '-' mean not covered? If so, why the first 2 statements are not covered?
There was an off by one error that I fixed.


https://reviews.llvm.org/D25985





More information about the cfe-commits mailing list