[clang-tools-extra] [clangd] fix crash in include cleaner (PR #99514)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 18 09:09:46 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 7e6a73959ae97b1f9476a90290a492ba90cb950d 93b2fec10a374fd09b128a70052f9a17c176aa20 --extensions cpp,h -- clang-tools-extra/clangd/CollectMacros.cpp clang-tools-extra/clangd/CollectMacros.h clang-tools-extra/clangd/IncludeCleaner.cpp
``````````

</details>

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

``````````diff
diff --git a/clang-tools-extra/clangd/CollectMacros.cpp b/clang-tools-extra/clangd/CollectMacros.cpp
index a8708fda53..280c1ecc30 100644
--- a/clang-tools-extra/clangd/CollectMacros.cpp
+++ b/clang-tools-extra/clangd/CollectMacros.cpp
@@ -37,7 +37,8 @@ void CollectMainFileMacros::add(const Token &MacroNameTok, const MacroInfo *MI,
   auto [FID, Start] = SM.getDecomposedLoc(Loc);
   size_t End = SM.getFileOffset(MacroNameTok.getEndLoc());
   if (auto SID = getSymbolID(Name, MI, SM))
-    Out.MacroRefs[SID].push_back({FID, Start, End, IsDefinition, InIfCondition});
+    Out.MacroRefs[SID].push_back(
+        {FID, Start, End, IsDefinition, InIfCondition});
   else
     Out.UnknownMacros.push_back({FID, Start, End, IsDefinition, InIfCondition});
 }

``````````

</details>


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


More information about the cfe-commits mailing list