summaryrefslogtreecommitdiffstats
path: root/llvm/lib/AsmParser
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-04-19 14:55:09 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-04-19 14:55:09 +0000
commit0b0271ef976cec3ee6a1ab2d654e42cf111a68bd (patch)
treeb4425f350e69c433c823dfc993711143958a25fd /llvm/lib/AsmParser
parent171b92f1e159be30fbc29871fefcb09fd05a9016 (diff)
downloadbcm5719-llvm-0b0271ef976cec3ee6a1ab2d654e42cf111a68bd.tar.gz
bcm5719-llvm-0b0271ef976cec3ee6a1ab2d654e42cf111a68bd.zip
IR: getOrInsertODRUniquedType => DICompositeType::getODRType, NFC
Lift the API for debug info ODR type uniquing up a layer. Instead of clients managing the map directly on the LLVMContext, add a static method to DICompositeType called getODRType and handle the map in the background. Also adds DICompositeType::getODRTypeIfExists, so far just for convenience in the unit tests. This simplifies the logic in LLParser and BitcodeReader. Because of argument spam there are actually a few more lines of code now; I'll see if I come up with a reasonable way to clean that up. llvm-svn: 266742
Diffstat (limited to 'llvm/lib/AsmParser')
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index c906b7b22db..fb27ab5353f 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -3841,13 +3841,15 @@ bool LLParser::ParseDICompositeType(MDNode *&Result, bool IsDistinct) {
// If this isn't a forward declaration and it has a UUID, check for it in the
// type map in the context.
- DICompositeType **MappedT = nullptr;
- if (!(flags.Val & DINode::FlagFwdDecl) && identifier.Val &&
- (MappedT = Context.getOrInsertODRUniquedType(*identifier.Val)) &&
- *MappedT) {
- Result = *MappedT;
- return false;
- }
+ if (!(flags.Val & DINode::FlagFwdDecl) && identifier.Val)
+ if (auto *CT = DICompositeType::getODRType(
+ 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,
+ templateParams.Val)) {
+ Result = CT;
+ return false;
+ }
// Create a new node, and save it in the context if it belongs in the type
// map.
@@ -3856,8 +3858,6 @@ bool LLParser::ParseDICompositeType(MDNode *&Result, bool IsDistinct) {
(Context, 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, templateParams.Val, identifier.Val));
- if (MappedT)
- *MappedT = cast<DICompositeType>(Result);
return false;
}
OpenPOWER on IntegriCloud