diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-04-19 18:00:19 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-04-19 18:00:19 +0000 |
commit | 9738602869dda75509a0f3782cd6639f9e3927c4 (patch) | |
tree | 7930467116f656492380f6cef7c78a9f8aa3f1b7 /llvm/lib/AsmParser/LLParser.cpp | |
parent | 40a34c2e2af8eaabfac246c9801af09a4e478dc1 (diff) | |
download | llvm-9738602869dda75509a0f3782cd6639f9e3927c4.zip llvm-9738602869dda75509a0f3782cd6639f9e3927c4.tar.gz llvm-9738602869dda75509a0f3782cd6639f9e3927c4.tar.bz2 |
IR: Enable debug info type ODR uniquing for forward decls
Add a new method, DICompositeType::buildODRType, that will create or
mutate the DICompositeType for a given ODR identifier, and use it in
LLParser and BitcodeReader instead of DICompositeType::getODRType.
The logic is as follows:
- If there's no node, create one with the given arguments.
- Else, if the current node is a forward declaration and the new
arguments would create a definition, mutate the node to match the
new arguments.
- Else, return the old node.
This adds a missing feature supported by the current DITypeIdentifierMap
(which I'm slowly making redudant). The only remaining difference is
that the DITypeIdentifierMap has a "the-last-one-wins" rule, whereas
DICompositeType::buildODRType has a "the-first-one-wins" rule.
For now I'm leaving behind DICompositeType::getODRType since it has
obvious, low-level semantics that are convenient for unit testing.
llvm-svn: 266786
Diffstat (limited to 'llvm/lib/AsmParser/LLParser.cpp')
-rw-r--r-- | llvm/lib/AsmParser/LLParser.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index fb27ab5..d9b7f3e 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -3839,10 +3839,9 @@ bool LLParser::ParseDICompositeType(MDNode *&Result, bool IsDistinct) { PARSE_MD_FIELDS(); #undef VISIT_MD_FIELDS - // If this isn't a forward declaration and it has a UUID, check for it in the - // type map in the context. - if (!(flags.Val & DINode::FlagFwdDecl) && identifier.Val) - if (auto *CT = DICompositeType::getODRType( + // If this has an identifier try to build an ODR type. + if (identifier.Val) + if (auto *CT = DICompositeType::buildODRType( Context, *identifier.Val, tag.Val, name.Val, file.Val, line.Val, scope.Val, baseType.Val, size.Val, align.Val, offset.Val, flags.Val, elements.Val, runtimeLang.Val, vtableHolder.Val, |