Skip to content

[CodeView] Require aggregates in getSizeInBytesForTypeRecord - #218715

Merged
Nerixyz merged 1 commit into
llvm:mainfrom
Nerixyz:fix/pdb-size-in-bytes-for-aggregate
Aug 25, 2026
Merged

[CodeView] Require aggregates in getSizeInBytesForTypeRecord#218715
Nerixyz merged 1 commit into
llvm:mainfrom
Nerixyz:fix/pdb-size-in-bytes-for-aggregate

Conversation

@Nerixyz

@Nerixyz Nerixyz commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

getSizeInBytesForTypeRecord returns the size of the CodeView leaf record for non-aggregates. It shouldn't be called with non-aggregates in the first place. This PR adds an assert and returns 0 in that case.
From a search here, it's only used in LVLogicalVisitor which already checks for tag records before calling this.

@llvmorg-github-actions

llvmorg-github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown

@llvm/pr-subscribers-debuginfo

@llvm/pr-subscribers-platform-windows

Author: Nerixyz (Nerixyz)

Changes

getSizeInBytesForTypeRecord returns the size of the CodeView leaf record for non-aggregates. It shouldn't be called with non-aggregates in the first place. This PR adds an assert and returns 0 in that case.
From a search here, it's only used in LVLogicalVisitor which already checks for tag records before calling this.


Full diff: https://github.com/llvm/llvm-project/pull/218715.diff

1 Files Affected:

  • (modified) llvm/lib/DebugInfo/CodeView/TypeRecordHelpers.cpp (+2-1)
diff --git a/llvm/lib/DebugInfo/CodeView/TypeRecordHelpers.cpp b/llvm/lib/DebugInfo/CodeView/TypeRecordHelpers.cpp
index 046b660abfab9..35acfcf18d175 100644
--- a/llvm/lib/DebugInfo/CodeView/TypeRecordHelpers.cpp
+++ b/llvm/lib/DebugInfo/CodeView/TypeRecordHelpers.cpp
@@ -177,6 +177,7 @@ uint64_t llvm::codeview::getSizeInBytesForTypeRecord(CVType CVT) {
   case LF_UNION:
     return getUdtSize<UnionRecord>(std::move(CVT));
   default:
-    return CVT.length();
+    assert(false && "not an aggregate");
+    return 0;
   }
 }

@Nerixyz
Nerixyz merged commit 664da8d into llvm:main Aug 25, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants