Don't instantiate GC metadata for declarations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54895 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/GCMetadata.cpp b/lib/CodeGen/GCMetadata.cpp
index c02a73b..0b5c6f0 100644
--- a/lib/CodeGen/GCMetadata.cpp
+++ b/lib/CodeGen/GCMetadata.cpp
@@ -99,7 +99,9 @@
}
CollectorMetadata &CollectorModuleMetadata::get(const Function &F) {
+ assert(!F.isDeclaration() && "Can only get GCFunctionInfo for a definition!");
assert(F.hasCollector());
+
function_map_type::iterator I = Map.find(&F);
if (I != Map.end())
return *I->second;