r232791 - DebugInfo: Check for null before using DIType

Duncan P. N. Exon Smith dexonsmith at apple.com
Thu Mar 19 17:53:41 PDT 2015


Author: dexonsmith
Date: Thu Mar 19 19:53:40 2015
New Revision: 232791

URL: http://llvm.org/viewvc/llvm-project?rev=232791&view=rev
Log:
DebugInfo: Check for null before using DIType

A WIP patch to turn on stricter `DIDescriptor` accessor checks fires
here; it's obvious from the code that `T` can be null, so add an
explicit check.  Caught by dozens of current testcases.

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=232791&r1=232790&r2=232791&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Mar 19 19:53:40 2015
@@ -2232,7 +2232,7 @@ llvm::DIType CGDebugInfo::getOrCreateLim
   // Propagate members from the declaration to the definition
   // CreateType(const RecordType*) will overwrite this with the members in the
   // correct order if the full type is needed.
-  DBuilder.replaceArrays(Res, T.getElements());
+  DBuilder.replaceArrays(Res, T ? T.getElements() : llvm::DIArray());
 
   // And update the type cache.
   TypeCache[QTy.getAsOpaquePtr()].reset(Res);





More information about the cfe-commits mailing list