[llvm-branch-commits] [llvm] [DebugInfo][FLMD] Add bitcode printing/parsing for function context (PR #236801)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Oct 29 07:55:35 PDT 2026
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 origin/main HEAD --extensions cpp,h -- llvm/include/llvm/Bitcode/LLVMBitCodes.h llvm/include/llvm/IR/FunctionLocalMetadata.h llvm/lib/Bitcode/Reader/MetadataLoader.cpp llvm/lib/Bitcode/Writer/BitcodeWriter.cpp llvm/lib/Bitcode/Writer/ValueEnumerator.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
index 6299f7c07..944d2bdee 100644
--- a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
+++ b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
@@ -2690,7 +2690,8 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
(void)Version;
// FLMD comprises 3 arrays with a leading length field.
uint64_t CurrentRecord = 1;
- MDFunctionLocalContext *NewFLMD = MDFunctionLocalContext::getDistinct(Context, IsNonDebug);
+ MDFunctionLocalContext *NewFLMD =
+ MDFunctionLocalContext::getDistinct(Context, IsNonDebug);
// Assign the metadata number now, so that we don't have to use forward
// references for ourself.
MetadataList.assignValue(NewFLMD, NextMetadataNo);
@@ -2729,8 +2730,8 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
uint32_t Line = Record[CurrentRecord++];
uint16_t Column = Record[CurrentRecord++];
uint16_t RawScopeIdx = Record[CurrentRecord++];
- NewFLMD->SrcLocs.push_back(FLSrcLoc(
- Line, Column, FLIndex<FLScope>::fromRaw(RawScopeIdx)));
+ NewFLMD->SrcLocs.push_back(
+ FLSrcLoc(Line, Column, FLIndex<FLScope>::fromRaw(RawScopeIdx)));
}
// InlinedCalls
uint64_t NumInlinedCalls = Record[CurrentRecord++];
@@ -2741,7 +2742,8 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
// function recurses from here or if the root array otherwise ends up being
// written to.
SmallVectorImpl<uint64_t> *InlinedCallFwdRefs = nullptr;
- for (uint64_t InlinedCallIdx = 0; InlinedCallIdx < NumInlinedCalls; ++InlinedCallIdx) {
+ for (uint64_t InlinedCallIdx = 0; InlinedCallIdx < NumInlinedCalls;
+ ++InlinedCallIdx) {
uint32_t RawSrcLocIdx = Record[CurrentRecord++];
uint16_t RawInlinedAtIdx = Record[CurrentRecord++];
bool Uniquable = Record[CurrentRecord++];
diff --git a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
index ee63320d7..0b5fe64ca 100644
--- a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
+++ b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
@@ -711,7 +711,7 @@ void ValueEnumerator::EnumerateMetadata(unsigned F, const Metadata *MD) {
// Fetching the MDNodes used by an MDFunctionLocalContext is expensive; if we
// need to get them at all, do so once in this map and reuse as needed.
DenseMap<const MDFunctionLocalContext *, SmallVector<const MDNode *, 0>>
- FLContextUsedNodes;
+ FLContextUsedNodes;
while (!Worklist.empty()) {
const MDNode *N = Worklist.back().first;
size_t &OpNum = Worklist.back().second;
@@ -743,7 +743,7 @@ void ValueEnumerator::EnumerateMetadata(unsigned F, const Metadata *MD) {
// operand count. For now, we have an assert to prevent a silent fail from
// being introduced.
assert(N->getNumOperands() == 0 &&
- "MDFunctionLocalContext expected to have no operands");
+ "MDFunctionLocalContext expected to have no operands");
auto Result = FLContextUsedNodes.try_emplace(FLContext);
auto &UsedMDNodes = Result.first->second;
if (Result.second)
@@ -764,7 +764,7 @@ void ValueEnumerator::EnumerateMetadata(unsigned F, const Metadata *MD) {
}
} else {
assert(OpNum <= N->getNumOperands() &&
- "Visited past the end of N's operands");
+ "Visited past the end of N's operands");
}
// All the operands have been visited. Now assign an ID.
``````````
</details>
https://github.com/llvm/llvm-project/pull/236801
More information about the llvm-branch-commits
mailing list