[PATCH] D144207: [llvm-cov] Create syntax to pass source w/o binary.
Daniel Thornburgh via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 16 11:00:14 PST 2023
mysterymath created this revision.
mysterymath added a reviewer: gulfem.
Herald added a subscriber: Enna1.
Herald added a project: All.
mysterymath requested review of this revision.
Herald added projects: Sanitizers, LLVM.
Herald added subscribers: llvm-commits, Sanitizers.
Since binary ID lookup makes CLI object arguments optional, it should be
possible to pass a list of source files without a binary. Unfortunately,
the current syntax will always interpret the first source file as a
binary. This change adds a `-sources` option to cause all later
positional arguments to be considered sources.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D144207
Files:
compiler-rt/test/profile/Linux/binary-id-lookup.c
llvm/docs/CommandGuide/llvm-cov.rst
llvm/tools/llvm-cov/CodeCoverage.cpp
Index: llvm/tools/llvm-cov/CodeCoverage.cpp
===================================================================
--- llvm/tools/llvm-cov/CodeCoverage.cpp
+++ llvm/tools/llvm-cov/CodeCoverage.cpp
@@ -636,7 +636,7 @@
"dump-collected-objects", cl::Optional, cl::Hidden,
cl::desc("Show the collected coverage object files"));
- cl::list<std::string> InputSourceFiles(cl::Positional,
+ cl::list<std::string> InputSourceFiles("sources", cl::Positional,
cl::desc("<Source files>"));
cl::opt<bool> DebugDumpCollectedPaths(
Index: llvm/docs/CommandGuide/llvm-cov.rst
===================================================================
--- llvm/docs/CommandGuide/llvm-cov.rst
+++ llvm/docs/CommandGuide/llvm-cov.rst
@@ -188,7 +188,7 @@
SYNOPSIS
^^^^^^^^
-:program:`llvm-cov show` [*options*] -instr-profile *PROFILE* *BIN* [*-object BIN,...*] [[*-object BIN*]] [*SOURCES*]
+:program:`llvm-cov show` [*options*] -instr-profile *PROFILE* [*BIN*] [*-object BIN*]... [*-sources*] [*SOURCE*]...
DESCRIPTION
^^^^^^^^^^^
@@ -370,7 +370,7 @@
SYNOPSIS
^^^^^^^^
-:program:`llvm-cov report` [*options*] -instr-profile *PROFILE* *BIN* [*-object BIN,...*] [[*-object BIN*]] [*SOURCES*]
+:program:`llvm-cov report` [*options*] -instr-profile *PROFILE* [*BIN*] [*-object BIN*]... [*-sources*] [*SOURCE*]...
DESCRIPTION
^^^^^^^^^^^
@@ -451,7 +451,7 @@
SYNOPSIS
^^^^^^^^
-:program:`llvm-cov export` [*options*] -instr-profile *PROFILE* *BIN* [*-object BIN,...*] [[*-object BIN*]] [*SOURCES*]
+:program:`llvm-cov export` [*options*] -instr-profile *PROFILE* [*BIN*] [*-object BIN*]... [*-sources*] [*SOURCE*]...
DESCRIPTION
^^^^^^^^^^^
Index: compiler-rt/test/profile/Linux/binary-id-lookup.c
===================================================================
--- compiler-rt/test/profile/Linux/binary-id-lookup.c
+++ compiler-rt/test/profile/Linux/binary-id-lookup.c
@@ -9,6 +9,7 @@
// RUN: cp %t.main %t/.build-id/ab/cd1234.debug
// RUN: llvm-profdata merge -o %t.profdata %t.profdir/default_*.profraw
// RUN: llvm-cov show -instr-profile %t.profdata -debug-file-directory %t | FileCheck %s
+// RUN: llvm-cov show -instr-profile %t.profdata -debug-file-directory %t -sources %t/foo.c | FileCheck %s --check-prefix=FOO-ONLY
// RUN: echo "bad" > %t/.build-id/ab/cd1234.debug
// RUN: llvm-cov show -instr-profile %t.profdata -debug-file-directory %t %t.main | FileCheck %s
// RUN: not llvm-cov show -instr-profile %t.profdata -debug-file-directory %t/empty 2>&1 | FileCheck %s --check-prefix=NODATA
@@ -17,6 +18,7 @@
// CHECK: 2| 1|void bar(void) {}
// CHECK: 3| 1|int main() {
+// FOO-ONLY: 1| 1|void foo(void) {}
// NODATA: error: Failed to load coverage: '': No coverage data found
//--- foo.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144207.498086.patch
Type: text/x-patch
Size: 2771 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230216/45598734/attachment.bin>
More information about the llvm-commits
mailing list