summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 916d49e)
raw | patch | inline | side by side (parent: 916d49e)
author | Eric Christopher <echristo@gmail.com> | |
Fri, 4 Oct 2013 23:35:30 +0000 (23:35 +0000) | ||
committer | Eric Christopher <echristo@gmail.com> | |
Fri, 4 Oct 2013 23:35:30 +0000 (23:35 +0000) |
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191999 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/DebugInfo.h | patch | blob | history |
index 8486b1023419b4c4a5fa2ed57b9d01d93ddbf07c..ad0149476a177e48b0f1dd2b5647ab9d6258952a 100644 (file)
--- a/include/llvm/DebugInfo.h
+++ b/include/llvm/DebugInfo.h
explicit DIRef(const Value *V);
public:
- T resolve(const DITypeIdentifierMap &Map) const {
- if (!Val)
- return T();
-
- if (const MDNode *MD = dyn_cast<MDNode>(Val))
- return T(MD);
-
- const MDString *MS = cast<MDString>(Val);
- // Find the corresponding MDNode.
- DITypeIdentifierMap::const_iterator Iter = Map.find(MS);
- assert(Iter != Map.end() && "Identifier not in the type map?");
- assert(DIDescriptor(Iter->second).isType() &&
- "MDNode in DITypeIdentifierMap should be a DIType.");
- return T(Iter->second);
- }
+ T resolve(const DITypeIdentifierMap &Map) const;
operator Value *() const { return const_cast<Value *>(Val); }
};
+template <typename T>
+T DIRef<T>::resolve(const DITypeIdentifierMap &Map) const {
+ if (!Val)
+ return T();
+
+ if (const MDNode *MD = dyn_cast<MDNode>(Val))
+ return T(MD);
+
+ const MDString *MS = cast<MDString>(Val);
+ // Find the corresponding MDNode.
+ DITypeIdentifierMap::const_iterator Iter = Map.find(MS);
+ assert(Iter != Map.end() && "Identifier not in the type map?");
+ assert(DIDescriptor(Iter->second).isType() &&
+ "MDNode in DITypeIdentifierMap should be a DIType.");
+ return T(Iter->second);
+}
+
/// Specialize getFieldAs to handle fields that are references to DIScopes.
template <> DIScopeRef DIDescriptor::getFieldAs<DIScopeRef>(unsigned Elt) const;
/// Specialize DIRef constructor for DIScopeRef.