-/// Given a DITypeIdentifierMap, tries to find the corresponding
-/// DIType for a DITypeRef.
-DIType DITypeRef::resolve(const DITypeIdentifierMap &Map) const {
- if (!TypeVal)
- return NULL;
-
- if (const MDNode *MD = dyn_cast<MDNode>(TypeVal)) {
- assert(DIType(MD).isType() &&
- "MDNode in DITypeRef should be a DIType.");
- return MD;
- }
-
- const MDString *MS = cast<MDString>(TypeVal);
- // Find the corresponding MDNode.
- DITypeIdentifierMap::const_iterator Iter = Map.find(MS);
- assert(Iter != Map.end() && "Identifier not in the type map?");
- assert(DIType(Iter->second).isType() &&
- "MDNode in DITypeIdentifierMap should be a DIType.");
- return Iter->second;
+/// Specialize getFieldAs to handle fields that are references to DIScopes.
+template <>
+DIScopeRef DIDescriptor::getFieldAs<DIScopeRef>(unsigned Elt) const {
+ return DIScopeRef(getField(DbgNode, Elt));