[clang] [Coverage][Expansion] handle nested macros in scratch space (PR #89869)

2024-05-23 Thread Wentao Zhang via cfe-commits
whentojump wrote: Thanks everyone! I notice that #87000 has been tagged with release milestone. I can handle the backport there. Maybe in a few days? Or sooner if that's needed. https://github.com/llvm/llvm-project/pull/89869 ___ cfe-commits mailing

[clang] [Coverage][Expansion] handle nested macros in scratch space (PR #89869)

2024-05-23 Thread Wentao Zhang via cfe-commits
https://github.com/whentojump updated https://github.com/llvm/llvm-project/pull/89869 >From 510e0f131ad11d7924f33fc4c4130dcf866bd8da Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Fri, 19 Apr 2024 15:16:05 +0900 Subject: [PATCH 1/9] [MC/DC][Coverage] Workaround for `##` conditions A

[clang] [Coverage][Expansion] handle nested macros in scratch space (PR #89869)

2024-05-23 Thread Wentao Zhang via cfe-commits
https://github.com/whentojump updated https://github.com/llvm/llvm-project/pull/89869 >From 510e0f131ad11d7924f33fc4c4130dcf866bd8da Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Fri, 19 Apr 2024 15:16:05 +0900 Subject: [PATCH 1/8] [MC/DC][Coverage] Workaround for `##` conditions A

[clang] [Coverage][Expansion] handle nested macros in scratch space (PR #89869)

2024-05-22 Thread Wentao Zhang via cfe-commits
@@ -517,7 +552,7 @@ class CoverageMappingBuilder { SourceRegionFilter Filter; for (const auto : FileIDMapping) { SourceLocation ExpandedLoc = FM.second.second; - SourceLocation ParentLoc = getIncludeOrExpansionLoc(ExpandedLoc); + SourceLocation

[clang] [Coverage][Expansion] handle nested macros in scratch space (PR #89869)

2024-05-22 Thread Wentao Zhang via cfe-commits
whentojump wrote: Sorry for getting back this late. I reverted the latest commit (using `SourceRange`) and addressed the earlier comment about updating region sloc only when they are changed. And yes if you have better ideas about `getNonScratchExpansion` implementation you can please post a

[clang] [Coverage][Expansion] handle nested macros in scratch space (PR #89869)

2024-05-22 Thread Wentao Zhang via cfe-commits
https://github.com/whentojump updated https://github.com/llvm/llvm-project/pull/89869 >From 968ef430dd09ee4545323426d0c5b550c6a0f690 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Fri, 19 Apr 2024 15:16:05 +0900 Subject: [PATCH 1/8] [MC/DC][Coverage] Workaround for `##` conditions A

[clang] [clang][CoverageMapping] do not emit gap when either end is an `ImplicitValueInitExpr` (PR #89564)

2024-04-27 Thread Wentao Zhang via cfe-commits
https://github.com/whentojump milestoned https://github.com/llvm/llvm-project/pull/89564 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][CoverageMapping] do not emit gap when either end is an `ImplicitValueInitExpr` (PR #89564)

2024-04-27 Thread Wentao Zhang via cfe-commits
whentojump wrote: /cherry-pick c1b6cca1214e7a9c14a30b81585dd8b81baeaa77 https://github.com/llvm/llvm-project/pull/89564 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Coverage][Expansion] handle nested macros in scratch space (PR #89869)

2024-04-25 Thread Wentao Zhang via cfe-commits
@@ -292,10 +292,36 @@ class CoverageMappingBuilder { return SM.getLocForEndOfFile(SM.getFileID(Loc)); } - /// Find out where the current file is included or macro is expanded. - SourceLocation getIncludeOrExpansionLoc(SourceLocation Loc) { -return Loc.isMacroID()

[clang] [Coverage][Expansion] handle nested macros in scratch space (PR #89869)

2024-04-24 Thread Wentao Zhang via cfe-commits
https://github.com/whentojump updated https://github.com/llvm/llvm-project/pull/89869 >From 968ef430dd09ee4545323426d0c5b550c6a0f690 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Fri, 19 Apr 2024 15:16:05 +0900 Subject: [PATCH 1/6] [MC/DC][Coverage] Workaround for `##` conditions A

[clang] [Coverage][Expansion] handle nested macros in scratch space (PR #89869)

2024-04-24 Thread Wentao Zhang via cfe-commits
https://github.com/whentojump updated https://github.com/llvm/llvm-project/pull/89869 >From 968ef430dd09ee4545323426d0c5b550c6a0f690 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Fri, 19 Apr 2024 15:16:05 +0900 Subject: [PATCH 1/5] [MC/DC][Coverage] Workaround for `##` conditions A

[clang] [Coverage][Expansion] handle nested macros in scratch space (PR #89869)

2024-04-24 Thread Wentao Zhang via cfe-commits
https://github.com/whentojump edited https://github.com/llvm/llvm-project/pull/89869 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Coverage][Expansion] handle nested macros in scratch space (PR #89869)

2024-04-24 Thread Wentao Zhang via cfe-commits
@@ -339,8 +355,18 @@ class CoverageMappingBuilder { llvm::SmallSet Visited; SmallVector, 8> FileLocs; -for (const auto : SourceRegions) { +for (auto : SourceRegions) { SourceLocation Loc = Region.getBeginLoc(); + + // Replace Region with its

[clang] [Coverage][Expansion] handle nested macros in scratch space (PR #89869)

2024-04-24 Thread Wentao Zhang via cfe-commits
https://github.com/whentojump updated https://github.com/llvm/llvm-project/pull/89869 >From 968ef430dd09ee4545323426d0c5b550c6a0f690 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Fri, 19 Apr 2024 15:16:05 +0900 Subject: [PATCH 1/4] [MC/DC][Coverage] Workaround for `##` conditions A

[clang] [Coverage][Expansion] handle nested macros in scratch space (PR #89869)

2024-04-24 Thread Wentao Zhang via cfe-commits
https://github.com/whentojump updated https://github.com/llvm/llvm-project/pull/89869 >From 968ef430dd09ee4545323426d0c5b550c6a0f690 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Fri, 19 Apr 2024 15:16:05 +0900 Subject: [PATCH 1/3] [MC/DC][Coverage] Workaround for `##` conditions A

[clang] [Coverage][Expansion] handle nested macros in scratch space (PR #89869)

2024-04-24 Thread Wentao Zhang via cfe-commits
https://github.com/whentojump edited https://github.com/llvm/llvm-project/pull/89869 ___ 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)

2024-04-24 Thread Wentao Zhang via cfe-commits
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] [Coverage][Expansion] handle nested macros in scratch space (PR #89869)

2024-04-24 Thread Wentao Zhang via cfe-commits
https://github.com/whentojump edited https://github.com/llvm/llvm-project/pull/89869 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Coverage][Expansion] handle nested macros in scratch space (PR #89869)

2024-04-24 Thread Wentao Zhang via cfe-commits
https://github.com/whentojump ready_for_review https://github.com/llvm/llvm-project/pull/89869 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Coverage][Expansion] handle nested macros in scratch space (PR #89869)

2024-04-24 Thread Wentao Zhang via cfe-commits
https://github.com/whentojump edited https://github.com/llvm/llvm-project/pull/89869 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Coverage][Expansion] handle nested macros in scratch space (PR #89869)

2024-04-23 Thread Wentao Zhang via cfe-commits
https://github.com/whentojump updated https://github.com/llvm/llvm-project/pull/89869 >From 968ef430dd09ee4545323426d0c5b550c6a0f690 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Fri, 19 Apr 2024 15:16:05 +0900 Subject: [PATCH 1/2] [MC/DC][Coverage] Workaround for `##` conditions A

[clang] [MC/DC][Coverage] Workaround for `##` conditions (PR #89573)

2024-04-23 Thread Wentao Zhang via cfe-commits
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

[clang] [Coverage][Expansion] handle nested macros in scratch space (PR #89869)

2024-04-23 Thread Wentao Zhang via cfe-commits
https://github.com/whentojump created https://github.com/llvm/llvm-project/pull/89869 None >From 968ef430dd09ee4545323426d0c5b550c6a0f690 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Fri, 19 Apr 2024 15:16:05 +0900 Subject: [PATCH 1/2] [MC/DC][Coverage] Workaround for `##` conditions

[clang] [MC/DC][Coverage] Workaround for `##` conditions (PR #89573)

2024-04-22 Thread Wentao Zhang via cfe-commits
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

[clang] [clang][CoverageMapping] do not emit gap when either end is an `ImplicitValueInitExpr` (PR #89564)

2024-04-22 Thread Wentao Zhang via cfe-commits
https://github.com/whentojump closed https://github.com/llvm/llvm-project/pull/89564 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][CoverageMapping] do not emit gap when either end is an `ImplicitValueInitExpr` (PR #89564)

2024-04-22 Thread Wentao Zhang via cfe-commits
whentojump wrote: Fwiw, I uncovered #86998 in the first place when I was compiling this file in Linux kernel: https://elixir.bootlin.com/linux/v6.8.1/source/fs/coredump.c#L545. I can confirm on my local side, with this patch, `fs/coredump.o` can be compiled and instrumented successfully. I

[clang] [clang][CoverageMapping] do not emit gap when either end is an `ImplicitValueInitExpr` (PR #89564)

2024-04-22 Thread Wentao Zhang via cfe-commits
whentojump wrote: Thanks for your suggestion! @ZequanWu Would you please take another look? https://github.com/llvm/llvm-project/pull/89564 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang][CoverageMapping] do not emit gap when either end is an `ImplicitValueInitExpr` (PR #89564)

2024-04-22 Thread Wentao Zhang via cfe-commits
https://github.com/whentojump ready_for_review https://github.com/llvm/llvm-project/pull/89564 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][CoverageMapping] do not emit gap when either end is an `ImplicitValueInitExpr` (PR #89564)

2024-04-22 Thread Wentao Zhang via cfe-commits
https://github.com/whentojump updated https://github.com/llvm/llvm-project/pull/89564 >From abbdb318d62bb2e5ab6f07e7d0fe11f4a06b5a11 Mon Sep 17 00:00:00 2001 From: Wentao Zhang Date: Sun, 21 Apr 2024 21:27:01 -0500 Subject: [PATCH 1/4] [clang][CoverageMapping] do not emit gap when either end

[clang] [clang][CoverageMapping] do not emit gap when either end is an `ImplicitValueInitExpr` (PR #89564)

2024-04-22 Thread Wentao Zhang via cfe-commits
https://github.com/whentojump updated https://github.com/llvm/llvm-project/pull/89564 >From abbdb318d62bb2e5ab6f07e7d0fe11f4a06b5a11 Mon Sep 17 00:00:00 2001 From: Wentao Zhang Date: Sun, 21 Apr 2024 21:27:01 -0500 Subject: [PATCH 1/2] [clang][CoverageMapping] do not emit gap when either end

[clang] [clang][CoverageMapping] do not emit gap when either end is an `ImplicitValueInitExpr` (PR #89564)

2024-04-22 Thread Wentao Zhang via cfe-commits
https://github.com/whentojump converted_to_draft https://github.com/llvm/llvm-project/pull/89564 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][CoverageMapping] do not emit gap when either end is an `ImplicitValueInitExpr` (PR #89564)

2024-04-21 Thread Wentao Zhang via cfe-commits
https://github.com/whentojump updated https://github.com/llvm/llvm-project/pull/89564 >From abbdb318d62bb2e5ab6f07e7d0fe11f4a06b5a11 Mon Sep 17 00:00:00 2001 From: Wentao Zhang Date: Sun, 21 Apr 2024 21:27:01 -0500 Subject: [PATCH] [clang][CoverageMapping] do not emit gap when either end is

[clang] [clang][CoverageMapping] do not emit gap when either end is an `ImplicitValueInitExpr` (PR #89564)

2024-04-21 Thread Wentao Zhang via cfe-commits
https://github.com/whentojump created https://github.com/llvm/llvm-project/pull/89564 Fixes #86998 Two compiler explorer examples:

[clang] [clang][CodeGen] Keep processing the rest of AST after encountering unsupported MC/DC expressions (PR #82464)

2024-02-22 Thread Wentao Zhang via cfe-commits
https://github.com/whentojump closed https://github.com/llvm/llvm-project/pull/82464 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][CodeGen] Keep processing the rest of AST after encountering unsupported MC/DC expressions (PR #82464)

2024-02-22 Thread Wentao Zhang via cfe-commits
@@ -292,7 +295,7 @@ struct MapRegionCounters : public RecursiveASTVisitor { "contains an operation with a nested boolean expression. " "Expression will not be covered"); Diag.Report(S->getBeginLoc(), DiagID); -return

[clang] [clang][CodeGen] Keep processing the rest of AST after encountering unsupported MC/DC expressions (PR #82464)

2024-02-20 Thread Wentao Zhang via cfe-commits
https://github.com/whentojump created https://github.com/llvm/llvm-project/pull/82464 Currently, upon seeing [unsupported decisions](https://clang.llvm.org/docs/SourceBasedCodeCoverage.html#mc-dc-instrumentation) (more than 6 conditions, or split nesting), the post-visitor hook

[llvm] [clang] `llvm-cov` assertion failure when handling MC/DC that involves macros (PR #80098)

2024-01-31 Thread Wentao Zhang via cfe-commits
@@ -1973,6 +1981,8 @@ struct CounterCoverageMappingBuilder void VisitBinLAnd(const BinaryOperator *E) { bool IsRootNode = MCDCBuilder.isIdle(); +MCDCDebugCounter++; whentojump wrote: Hi thanks again for taking the look! My intuition was to make the

[clang] [llvm] `llvm-cov` assertion failure when handling MC/DC that involves macros (PR #80098)

2024-01-30 Thread Wentao Zhang via cfe-commits
whentojump wrote: Hey @chapuni thanks for the comments! This is indeed a draft. Since there're already reports regarding this issue, let me close this one. I will try those linked patches and report if I have findings. Sorry for not searching for the ongoing effort and thanks for your work!

[llvm] [clang] `llvm-cov` assertion failure when handling MC/DC that involves macros (PR #80098)

2024-01-30 Thread Wentao Zhang via cfe-commits
https://github.com/whentojump closed https://github.com/llvm/llvm-project/pull/80098 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[llvm] [clang] `llvm-cov` assertion failure when handling MC/DC that involves macros (PR #80098)

2024-01-30 Thread Wentao Zhang via cfe-commits
whentojump wrote: Hi thanks for the prompt reply and the pointer! Will definitely check. https://github.com/llvm/llvm-project/pull/80098 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[llvm] [clang] `llvm-cov` assertion failure when handling MC/DC that involves macros (PR #80098)

2024-01-30 Thread Wentao Zhang via cfe-commits
https://github.com/whentojump created https://github.com/llvm/llvm-project/pull/80098 ## Problem The behavior is described with this tiny example: https://github.com/whentojump/llvm-mcdc-assertion-failure Essentially, current MC/DC implementation cannot properly handle decisions that