[clang] [MC/DC][Coverage] Workaround for `##` conditions (PR #89573)
https://github.com/chapuni closed https://github.com/llvm/llvm-project/pull/89573 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [MC/DC][Coverage] Workaround for `##` conditions (PR #89573)
chapuni wrote: See #89869 . https://github.com/llvm/llvm-project/pull/89573 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [MC/DC][Coverage] Workaround for `##` conditions (PR #89573)
whentojump wrote: Yes I can do it. Thank you as well!! https://github.com/llvm/llvm-project/pull/89573 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [MC/DC][Coverage] Workaround for `##` conditions (PR #89573)
chapuni wrote: @whentojump Thanks. Would you like to take this over? Then I will close this. https://github.com/llvm/llvm-project/pull/89573 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [MC/DC][Coverage] Workaround for `##` conditions (PR #89573)
whentojump wrote: @chapuni Would you please take a look at #89869? Specifically, the extra one commit atop yours. Essentially I did similar things to `getIncludeOrExpansionLoc()`. https://github.com/llvm/llvm-project/pull/89573 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [MC/DC][Coverage] Workaround for `##` conditions (PR #89573)
whentojump wrote: Hi, thanks for the fix. I can confirm it addressed your test case (https://godbolt.org/z/sMscqWeq7). But unfortunately it doesn't fix the one in my original post of #87000 ([compiler explorer link](https://godbolt.org/#z:OYLghAFBqd5QCxAYwPYBMCmBRdBLAF1QCcAaPECAMzwBtMA7AQwFtMQByARg9KtQYEAysib0QXACx8BBAKoBnTAAUAHpwAMvAFYTStJg1DIApACYAQuYukl9ZATwDKjdAGFUtAK4sGIM6SuADJ4DJgAcj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XAQgKuF5XFJYlY0lUgdYzY7s3Y0gIUvc/soMw42wEAE4rci464iAJAIgTwR4o1TSIk3gJocU9/fOIQI2OUtEu4l48IdiTgEcscic4AZACiLgMwYEMwXgB4Vc0MvQBU4QUQcQVUpCjUtQfYnUw8gQZCVAFcogYgMaPiCwTARgQ4BaVAGUxgB4FkhmPCgikgain8nC5gNABofAFisYTis87i0ID8moL8vWFi%2B82gOFdAc0S0FgGSLWBcgE8pFSYU7s3sk8g4jgTWbWCAN4owWWBgP5IsYC8cyc2sachqR8C8P4xc5c/AQihY3U/YDw
[clang] [MC/DC][Coverage] Workaround for `##` conditions (PR #89573)
llvmbot wrote: @llvm/pr-subscribers-clang-codegen Author: NAKAMURA Takumi (chapuni) Changes A synthesized identifier with `##` is emitted to ``. `llvm-cov` cannot handle ` since it doesn't have actual files. As a workaround, peel ` ` to the actual definition if the definition is present. This affects predefined built-in macros, like __LINE__. Fixes #87000 --- Full diff: https://github.com/llvm/llvm-project/pull/89573.diff 4 Files Affected: - (modified) clang/lib/CodeGen/CoverageMappingGen.cpp (+11-1) - (modified) clang/test/CoverageMapping/builtinmacro.c (+1-1) - (modified) clang/test/CoverageMapping/macros.c (+5-3) - (added) clang/test/CoverageMapping/mcdc-scratch-space.c (+39) ``diff diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp index 71215da362d3d0..643f3c5ab8d349 100644 --- a/clang/lib/CodeGen/CoverageMappingGen.cpp +++ b/clang/lib/CodeGen/CoverageMappingGen.cpp @@ -339,8 +339,18 @@ class CoverageMappingBuilder { llvm::SmallSet Visited; SmallVector, 8> FileLocs; -for (const auto &Region : SourceRegions) { +for (auto &Region : SourceRegions) { SourceLocation Loc = Region.getBeginLoc(); + + // Replace Region with its definition if it is in . + while (Loc.isMacroID() && + SM.isWrittenInScratchSpace(SM.getSpellingLoc(Loc))) { +auto ExpansionRange = SM.getImmediateExpansionRange(Loc); +Loc = ExpansionRange.getBegin(); +Region.setStartLoc(Loc); +Region.setEndLoc(ExpansionRange.getEnd()); + } + FileID File = SM.getFileID(Loc); if (!Visited.insert(File).second) continue; diff --git a/clang/test/CoverageMapping/builtinmacro.c b/clang/test/CoverageMapping/builtinmacro.c index abcdc191523a5d..5d5a176aa7d87e 100644 --- a/clang/test/CoverageMapping/builtinmacro.c +++ b/clang/test/CoverageMapping/builtinmacro.c @@ -4,7 +4,7 @@ // CHECK: filename const char *filename (const char *name) { // CHECK-NEXT: File 0, [[@LINE]]:41 -> [[@LINE+3]]:2 = #0 - static const char this_file[] = __FILE__; + static const char this_file[] = __FILE__; // CHECK-NEXT: File 0, [[@LINE]]:35 -> [[@LINE]]:35 = #0 return this_file; } diff --git a/clang/test/CoverageMapping/macros.c b/clang/test/CoverageMapping/macros.c index 6bd3be434139a2..fcf21170ef135c 100644 --- a/clang/test/CoverageMapping/macros.c +++ b/clang/test/CoverageMapping/macros.c @@ -80,12 +80,14 @@ void func7(void) { // CHECK-NEXT: File 0, [[@LINE]]:18 -> [[@LINE+6]]:2 = #0 int kk,ll; // CHECK-NEXT: File 0, [[@LINE+1]]:7 -> [[@LINE+1]]:8 = #0 if (k) // CHECK-NEXT: Branch,File 0, [[@LINE]]:7 -> [[@LINE]]:8 = #1 m(k); // CHECK-NEXT: Gap,File 0, [[@LINE-1]]:9 -> [[@LINE]]:5 = #1 - else // CHECK-NEXT: Expansion,File 0, [[@LINE-1]]:5 -> [[@LINE-1]]:6 = #0 + else // CHECK-NEXT: Expansion,File 0, [[@LINE-1]]:5 -> [[@LINE-1]]:6 = #1 l = m(l); // CHECK-NEXT: Gap,File 0, [[@LINE-2]]:7 -> [[@LINE]]:5 = (#0 - #1) } // CHECK-NEXT: File 0, [[@LINE-1]]:5 -> [[@LINE-1]]:10 = (#0 - #1) // CHECK-NEXT: Expansion,File 0, [[@LINE-2]]:9 -> [[@LINE-2]]:10 = (#0 - #1) - // CHECK-NEXT: File 1, [[@LINE-9]]:14 -> [[@LINE-9]]:18 = #0 - // CHECK-NEXT: File 2, [[@LINE-10]]:14 -> [[@LINE-10]]:15 = (#0 - #1) + // CHECK-NEXT: File 1, [[@LINE-9]]:14 -> [[@LINE-9]]:17 = #1 + // CHECK-NEXT: File 1, [[@LINE-10]]:14 -> [[@LINE-10]]:18 = #0 + // CHECK-NEXT: File 2, [[@LINE-11]]:14 -> [[@LINE-11]]:17 = (#0 - #1) + // CHECK-NEXT: File 2, [[@LINE-12]]:14 -> [[@LINE-12]]:15 = (#0 - #1) int main(int argc, const char *argv[]) { func(); diff --git a/clang/test/CoverageMapping/mcdc-scratch-space.c b/clang/test/CoverageMapping/mcdc-scratch-space.c new file mode 100644 index 00..1b8735cd27445a --- /dev/null +++ b/clang/test/CoverageMapping/mcdc-scratch-space.c @@ -0,0 +1,39 @@ +// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c99 -fcoverage-mcdc -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only %s | FileCheck %s + +// CHECK: builtin_macro0: +int builtin_macro0(int a) { + // CHECK: Decision,File 0, [[@LINE+1]]:11 -> [[@LINE+2]]:15 = M:0, C:2 + return (__LINE__ // CHECK: Branch,File 0, [[@LINE]]:11 -> [[@LINE]]:11 = 0, 0 [1,2,0] + && a); // CHECK: Branch,File 0, [[@LINE]]:14 -> [[@LINE]]:15 = #2, (#1 - #2) [2,0,0] +} + +// CHECK: builtin_macro1: +int builtin_macro1(int a) { + // CHECK: Decision,File 0, [[@LINE+1]]:11 -> [[@LINE+2]]:22 = M:0, C:2 + return (a // CHECK: Branch,File 0, [[@LINE]]:11 -> [[@LINE]]:12 = (#0 - #1), #1 [1,0,2] + || __LINE__); // CHECK: Branch,File 0, [[@LINE]]:14 -> [[@LINE]]:14 = 0, 0 [2,0,0] +} + +#define PRE(x) pre_##x + +// CHECK: pre0: +int
[clang] [MC/DC][Coverage] Workaround for `##` conditions (PR #89573)
https://github.com/chapuni created https://github.com/llvm/llvm-project/pull/89573 A synthesized identifier with `##` is emitted to ``. `llvm-cov` cannot handle ` since it doesn't have actual files. As a workaround, peel `` to the actual definition if the definition is present. This affects predefined built-in macros, like __LINE__. Fixes #87000 >From f1214b72c842d08cb843e90a7b1cace0aa6e0260 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Fri, 19 Apr 2024 15:16:05 +0900 Subject: [PATCH] [MC/DC][Coverage] Workaround for `##` conditions A synthesized identifier with `##` is emitted to ``. `llvm-cov` cannot handle ` since it doesn't have actual files. As a workaround, peel `` to the actual definition if the definition is present. This affects predefined built-in macros, like __LINE__. Fixes #87000 --- clang/lib/CodeGen/CoverageMappingGen.cpp | 12 +- clang/test/CoverageMapping/builtinmacro.c | 2 +- clang/test/CoverageMapping/macros.c | 8 ++-- .../test/CoverageMapping/mcdc-scratch-space.c | 39 +++ 4 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 clang/test/CoverageMapping/mcdc-scratch-space.c diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp index 71215da362d3d0..643f3c5ab8d349 100644 --- a/clang/lib/CodeGen/CoverageMappingGen.cpp +++ b/clang/lib/CodeGen/CoverageMappingGen.cpp @@ -339,8 +339,18 @@ class CoverageMappingBuilder { llvm::SmallSet Visited; SmallVector, 8> FileLocs; -for (const auto &Region : SourceRegions) { +for (auto &Region : SourceRegions) { SourceLocation Loc = Region.getBeginLoc(); + + // Replace Region with its definition if it is in . + while (Loc.isMacroID() && + SM.isWrittenInScratchSpace(SM.getSpellingLoc(Loc))) { +auto ExpansionRange = SM.getImmediateExpansionRange(Loc); +Loc = ExpansionRange.getBegin(); +Region.setStartLoc(Loc); +Region.setEndLoc(ExpansionRange.getEnd()); + } + FileID File = SM.getFileID(Loc); if (!Visited.insert(File).second) continue; diff --git a/clang/test/CoverageMapping/builtinmacro.c b/clang/test/CoverageMapping/builtinmacro.c index abcdc191523a5d..5d5a176aa7d87e 100644 --- a/clang/test/CoverageMapping/builtinmacro.c +++ b/clang/test/CoverageMapping/builtinmacro.c @@ -4,7 +4,7 @@ // CHECK: filename const char *filename (const char *name) { // CHECK-NEXT: File 0, [[@LINE]]:41 -> [[@LINE+3]]:2 = #0 - static const char this_file[] = __FILE__; + static const char this_file[] = __FILE__; // CHECK-NEXT: File 0, [[@LINE]]:35 -> [[@LINE]]:35 = #0 return this_file; } diff --git a/clang/test/CoverageMapping/macros.c b/clang/test/CoverageMapping/macros.c index 6bd3be434139a2..fcf21170ef135c 100644 --- a/clang/test/CoverageMapping/macros.c +++ b/clang/test/CoverageMapping/macros.c @@ -80,12 +80,14 @@ void func7(void) { // CHECK-NEXT: File 0, [[@LINE]]:18 -> [[@LINE+6]]:2 = #0 int kk,ll; // CHECK-NEXT: File 0, [[@LINE+1]]:7 -> [[@LINE+1]]:8 = #0 if (k) // CHECK-NEXT: Branch,File 0, [[@LINE]]:7 -> [[@LINE]]:8 = #1 m(k); // CHECK-NEXT: Gap,File 0, [[@LINE-1]]:9 -> [[@LINE]]:5 = #1 - else // CHECK-NEXT: Expansion,File 0, [[@LINE-1]]:5 -> [[@LINE-1]]:6 = #0 + else // CHECK-NEXT: Expansion,File 0, [[@LINE-1]]:5 -> [[@LINE-1]]:6 = #1 l = m(l); // CHECK-NEXT: Gap,File 0, [[@LINE-2]]:7 -> [[@LINE]]:5 = (#0 - #1) } // CHECK-NEXT: File 0, [[@LINE-1]]:5 -> [[@LINE-1]]:10 = (#0 - #1) // CHECK-NEXT: Expansion,File 0, [[@LINE-2]]:9 -> [[@LINE-2]]:10 = (#0 - #1) - // CHECK-NEXT: File 1, [[@LINE-9]]:14 -> [[@LINE-9]]:18 = #0 - // CHECK-NEXT: File 2, [[@LINE-10]]:14 -> [[@LINE-10]]:15 = (#0 - #1) + // CHECK-NEXT: File 1, [[@LINE-9]]:14 -> [[@LINE-9]]:17 = #1 + // CHECK-NEXT: File 1, [[@LINE-10]]:14 -> [[@LINE-10]]:18 = #0 + // CHECK-NEXT: File 2, [[@LINE-11]]:14 -> [[@LINE-11]]:17 = (#0 - #1) + // CHECK-NEXT: File 2, [[@LINE-12]]:14 -> [[@LINE-12]]:15 = (#0 - #1) int main(int argc, const char *argv[]) { func(); diff --git a/clang/test/CoverageMapping/mcdc-scratch-space.c b/clang/test/CoverageMapping/mcdc-scratch-space.c new file mode 100644 index 00..1b8735cd27445a --- /dev/null +++ b/clang/test/CoverageMapping/mcdc-scratch-space.c @@ -0,0 +1,39 @@ +// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c99 -fcoverage-mcdc -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only %s | FileCheck %s + +// CHECK: builtin_macro0: +int builtin_macro0(int a) { + // CHECK: Decision,File 0, [[@LINE+1]]:11 -> [[@LINE+2]]:15 = M:0, C:2 + return (__LINE__ // CHECK: Branch,File 0, [[@LINE]]:11 -> [[@LINE]]:11 = 0, 0 [1,2,0] + && a); // CHECK: Branch,File 0, [[@LINE]