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

2024-05-23 Thread NAKAMURA Takumi via cfe-commits
chapuni wrote: @whentojump AFAIK, both of them missed boarding 18.1.6. I'll wait for opportunities. https://github.com/llvm/llvm-project/pull/89869 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[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 NAKAMURA Takumi via cfe-commits
https://github.com/chapuni closed 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-05-23 Thread Hana Dusíková via cfe-commits
https://github.com/hanickadot approved this pull request. lgtm 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-05-23 Thread NAKAMURA Takumi via cfe-commits
https://github.com/chapuni approved this pull request. I'd like other approvals by clang guys. @AaronBallman Could you nominate anyone? https://github.com/llvm/llvm-project/pull/89869 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[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-23 Thread NAKAMURA Takumi via cfe-commits
@@ -0,0 +1,65 @@ +// 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 chapuni wrote: You may overwrite 896bceb with this.

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

2024-05-22 Thread Jessica Paquette 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 NAKAMURA Takumi via cfe-commits
@@ -339,8 +365,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-05-22 Thread NAKAMURA Takumi 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-05-22 Thread NAKAMURA Takumi via cfe-commits
@@ -339,8 +365,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-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] [Coverage][Expansion] handle nested macros in scratch space (PR #89869)

2024-05-21 Thread NAKAMURA Takumi via cfe-commits
chapuni wrote: @whentojump Any updates? Or Is it better for me to take this over? 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-05-19 Thread Jessica Paquette 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-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 NAKAMURA Takumi 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 NAKAMURA Takumi via cfe-commits
https://github.com/chapuni commented: They could be simpler if `SourceRegion` were compatible to `std::pair`. (I don't require you to work) https://github.com/llvm/llvm-project/pull/89869 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

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

2024-04-24 Thread NAKAMURA Takumi via cfe-commits
@@ -339,8 +365,17 @@ 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 NAKAMURA Takumi via cfe-commits
https://github.com/chapuni 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 NAKAMURA Takumi 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/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 NAKAMURA Takumi via cfe-commits
@@ -292,10 +292,22 @@ 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/3] [MC/DC][Coverage] Workaround for `##` conditions A

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

2024-04-24 Thread NAKAMURA Takumi via cfe-commits
https://github.com/chapuni commented: I've confirmed this works. I'd like to wait for other opinions. My comments are just my preferences. https://github.com/llvm/llvm-project/pull/89869 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

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

2024-04-24 Thread NAKAMURA Takumi 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 NAKAMURA Takumi via cfe-commits
@@ -298,6 +298,22 @@ class CoverageMappingBuilder { : SM.getIncludeLoc(SM.getFileID(Loc)); } + /// Find out where the current file is included or macro is expanded. If the + /// found expansion is a , keep looking. + SourceLocation

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

2024-04-24 Thread NAKAMURA Takumi via cfe-commits
https://github.com/chapuni 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 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 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 via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Wentao Zhang (whentojump) Changes The problematic program is as follows: ```shell #define pre_a 0 #define PRE(x) pre_##x void f(void) { PRE(a) 0; } int main(void) { return 0; } ``` in which after token concatenation (`##`),

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

2024-04-24 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-codegen Author: Wentao Zhang (whentojump) Changes The problematic program is as follows: ```shell #define pre_a 0 #define PRE(x) pre_##x void f(void) { PRE(a) 0; } int main(void) { return 0; } ``` in which after token concatenation

[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] [Coverage][Expansion] handle nested macros in scratch space (PR #89869)

2024-04-23 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 92631a4824a91f3268a5716dd3459df8dc6bfb63 2010fb3d7da4790985e16aabc634a50e9562bad3 --

[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