[clang] [llvm] Disentangle DISubprogram ODR type method uniquing from metadata uniquing (PR #217042)
Orlando Cazalet-Hyams via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 1 02:02:03 PDT 2026
================
@@ -2049,35 +2050,49 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
}
Metadata *CUorFn = getMDOrNull(Record[12 + OffsetB]);
- DISubprogram *SP = GET_OR_DISTINCT(
- DISubprogram,
- (Context,
- getDITypeRefOrNull(Record[1]), // scope
- getMDString(Record[2]), // name
- getMDString(Record[3]), // linkageName
- getMDOrNull(Record[4]), // file
- Record[5], // line
- getMDOrNull(Record[6]), // type
- Record[7 + OffsetA], // scopeLine
- getDITypeRefOrNull(Record[8 + OffsetA]), // containingType
- Record[10 + OffsetA], // virtualIndex
- HasThisAdj ? Record[16 + OffsetB] : 0, // thisAdjustment
- Flags, // flags
- SPFlags, // SPFlags
- HasUnit ? CUorFn : nullptr, // unit
- getMDOrNull(Record[13 + OffsetB]), // templateParams
- getMDOrNull(Record[14 + OffsetB]), // declaration
- getMDOrNull(Record[15 + OffsetB]), // retainedNodes
- HasThrownTypes ? getMDOrNull(Record[17 + OffsetB])
- : nullptr, // thrownTypes
- HasAnnotations ? getMDOrNull(Record[18 + OffsetB])
- : nullptr, // annotations
- HasTargetFuncName ? getMDString(Record[19 + OffsetB])
- : nullptr, // targetFuncName
- UsesKeyInstructions));
+
+ DISubprogram *SP = nullptr;
+ bool MaybeODRUnique = Context.isODRUniquingDebugTypes() && !IsDistinct &&
+ !(SPFlags & DISubprogram::SPFlagDefinition) &&
+ getMDString(Record[3]);
+ if (MaybeODRUnique)
+ SP = Context.getDebugTypeODRUniquer()->getODRSubprogramDecl(
+ getDITypeRefOrNull(Record[1]), getMDString(Record[3])->getString(),
+ getMDOrNull(Record[6]), getMDOrNull(Record[13 + OffsetB]));
----------------
OCHyams wrote:
Ah, right, yes you're right and it's easy to reproduce... I've fixed it but it's not particularly clean
https://github.com/llvm/llvm-project/pull/217042
More information about the llvm-commits
mailing list