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

via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 23 21:07:59 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 92631a4824a91f3268a5716dd3459df8dc6bfb63 2010fb3d7da4790985e16aabc634a50e9562bad3 -- clang/test/CoverageMapping/mcdc-scratch-space.c clang/lib/CodeGen/CoverageMappingGen.cpp clang/test/CoverageMapping/builtinmacro.c clang/test/CoverageMapping/macros.c
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp
index 3ec11d13cf..9268ac5b4c 100644
--- a/clang/lib/CodeGen/CoverageMappingGen.cpp
+++ b/clang/lib/CodeGen/CoverageMappingGen.cpp
@@ -304,7 +304,7 @@ public:
     if (Loc.isMacroID()) {
       Loc = SM.getImmediateExpansionRange(Loc).getBegin();
       while (Loc.isMacroID() &&
-        SM.isWrittenInScratchSpace(SM.getSpellingLoc(Loc))) {
+             SM.isWrittenInScratchSpace(SM.getSpellingLoc(Loc))) {
         auto ExpansionRange = SM.getImmediateExpansionRange(Loc);
         Loc = ExpansionRange.getBegin();
       }
@@ -543,7 +543,8 @@ public:
     SourceRegionFilter Filter;
     for (const auto &FM : FileIDMapping) {
       SourceLocation ExpandedLoc = FM.second.second;
-      SourceLocation ParentLoc = getIncludeOrNonScratchExpansionLoc(ExpandedLoc);
+      SourceLocation ParentLoc =
+          getIncludeOrNonScratchExpansionLoc(ExpandedLoc);
       if (ParentLoc.isInvalid())
         continue;
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/89869


More information about the cfe-commits mailing list