Re-apply r251050 with a for PR25421
[oota-llvm.git] / lib / Analysis / LibCallSemantics.cpp
index 36b92c38e89088ff14db7cc28caa5538538ce6c3..b91ff20aee253d09108d9318fc60c6d93a3372cf 100644 (file)
@@ -21,7 +21,8 @@ using namespace llvm;
 /// See if the given exception handling personality function is one that we
 /// understand.  If so, return a description of it; otherwise return Unknown.
 EHPersonality llvm::classifyEHPersonality(const Value *Pers) {
-  const Function *F = dyn_cast<Function>(Pers->stripPointerCasts());
+  const Function *F =
+      Pers ? dyn_cast<Function>(Pers->stripPointerCasts()) : nullptr;
   if (!F)
     return EHPersonality::Unknown;
   return StringSwitch<EHPersonality>(F->getName())
@@ -33,6 +34,7 @@ EHPersonality llvm::classifyEHPersonality(const Value *Pers) {
     .Case("_except_handler4",      EHPersonality::MSVC_X86SEH)
     .Case("__C_specific_handler",  EHPersonality::MSVC_Win64SEH)
     .Case("__CxxFrameHandler3",    EHPersonality::MSVC_CXX)
+    .Case("ProcessCLRException",   EHPersonality::CoreCLR)
     .Default(EHPersonality::Unknown);
 }