[llvm] r191999 - Pull this out for a bit of readability.
Eric Christopher
echristo at gmail.com
Fri Oct 4 16:35:30 PDT 2013
Author: echristo
Date: Fri Oct 4 18:35:30 2013
New Revision: 191999
URL: http://llvm.org/viewvc/llvm-project?rev=191999&view=rev
Log:
Pull this out for a bit of readability.
Modified:
llvm/trunk/include/llvm/DebugInfo.h
Modified: llvm/trunk/include/llvm/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo.h?rev=191999&r1=191998&r2=191999&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/DebugInfo.h Fri Oct 4 18:35:30 2013
@@ -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.
More information about the llvm-commits
mailing list