[cfe-commits] patch: add gcov-compatible coverage support to clang

Chandler Carruth chandlerc at google.com
Wed Apr 20 21:44:33 PDT 2011


On Wed, Apr 20, 2011 at 7:06 PM, Nick Lewycky <nlewycky at google.com> wrote:

> This patch adds the -ftest-coverage flag, and wires it--along with
> -coverage and -fprofile-arcs--up to llvm's recently added support for
> emission of gcov data files. Please review!
>

Some comments:

Index: include/clang/Driver/Options.td
===================================================================
--- include/clang/Driver/Options.td (revision 129902)
+++ include/clang/Driver/Options.td (working copy)
@@ -280,6 +280,7 @@
 def feliminate_unused_debug_symbols :
Flag<"-feliminate-unused-debug-symbols">, Group<f_Group>;
 def femit_all_decls : Flag<"-femit-all-decls">, Group<f_Group>;
 def fencoding_EQ : Joined<"-fencoding=">, Group<f_Group>;
+def ferror_limit_EQ : Joined<"-ferror-limit=">, Group<f_Group>;

Was this intended to be part of the commit?

Index: lib/Frontend/CompilerInvocation.cpp
===================================================================
--- lib/Frontend/CompilerInvocation.cpp (revision 129902)
+++ lib/Frontend/CompilerInvocation.cpp (working copy)
@@ -123,6 +123,10 @@
     Res.push_back("-dwarf-debug-flags");
     Res.push_back(Opts.DwarfDebugFlags);
   }
+  if (Opts.EmitGcovArcs)
+    Res.push_back("-emit-coverage-data");
+  if (Opts.EmitGcovNotes)
+    Res.push_back("-emit-coverage-notes");

Er, where is the "f" in these flags?

@@ -81,7 +81,9 @@
                            ABI.getMangleContext());

   // If debug info generation is enabled, create the CGDebugInfo object.
-  DebugInfo = CodeGenOpts.DebugInfo ? new CGDebugInfo(*this) : 0;
+  if (CodeGenOpts.DebugInfo || CodeGenOpts.EmitGcovArcs ||
+      CodeGenOpts.EmitGcovNotes)
+    DebugInfo = new CGDebugInfo(*this);

The comment for this code needs updating

   Block.GlobalUniqueCount = 0;

@@ -590,7 +592,7 @@

     GlobalDecl D = DeferredDeclsToEmit.back();
     DeferredDeclsToEmit.pop_back();
-
+

Extraneous whitespace change...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110420/db8a64ef/attachment.html>


More information about the cfe-commits mailing list