summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2013-10-04 23:35:30 +0000
committerEric Christopher <echristo@gmail.com>2013-10-04 23:35:30 +0000
commitfc917c6208f7bc92b47ef917c5497dc6ea1edb02 (patch)
tree7568b7d4b377d1e19ef202169398ffa978a0d696
parentfac5612ab054735b7e887a4cf7f4ffc47e6824bd (diff)
downloadbcm5719-llvm-fc917c6208f7bc92b47ef917c5497dc6ea1edb02.tar.gz
bcm5719-llvm-fc917c6208f7bc92b47ef917c5497dc6ea1edb02.zip
Pull this out for a bit of readability.
llvm-svn: 191999
-rw-r--r--llvm/include/llvm/DebugInfo.h33
1 files changed, 18 insertions, 15 deletions
diff --git a/llvm/include/llvm/DebugInfo.h b/llvm/include/llvm/DebugInfo.h
index 8486b102341..ad0149476a1 100644
--- a/llvm/include/llvm/DebugInfo.h
+++ b/llvm/include/llvm/DebugInfo.h
@@ -226,24 +226,27 @@ template <typename T> class DIRef {
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.
OpenPOWER on IntegriCloud