From 76efbcadd61b4590ce66c928bb2e6a987fe6b669 Mon Sep 17 00:00:00 2001
From: Simon Schuster <git@rationality.eu>
Date: Tue, 11 Apr 2017 18:02:51 +0200
Subject: [PATCH] Fix handling of scoped DebugLocations in PML.h

The `setSrcLocOnce` function wrongly rejected scoped `DebugLoc`
instances after the assert was refactored between 3.4 and 3.8.
See the comment in the sourcefile for details.
---
 include/llvm/PML.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/llvm/PML.h b/include/llvm/PML.h
index d0ff1e9aef0..75ca94dcb15 100644
--- a/include/llvm/PML.h
+++ b/include/llvm/PML.h
@@ -338,8 +338,12 @@ struct Block {
   void setSrcLocOnce(const DebugLoc &dl, MDNode *ScopeMD) {
     if (Loc.empty() && dl) {
       DIScope *Scope = cast<DIScope>(ScopeMD);
-      assert((!Scope) &&
-        "Scope of a DebugLoc should be null or a DIScope.");
+	  // FIXME: fo21qixo, 11.04.2017
+	  // Here used to be the following assert:
+      //   assert((!Scope) && "Scope of a DebugLoc should be null or a DIScope.");
+	  // In 3.4, it checked for (!Scope) && Scope.isScope().
+	  // However, as <cast> is a checked cast variant, I now consider it obsolete.
+	  // If things around SrcLocs break, this would be a good place to start.
       std::stringstream ss;
       if (Scope)
         ss << Scope->getFilename().str() << ":";
-- 
GitLab