[llvm] r234225 - Revert "DebugInfo: Loosen DILexicalBlock constructor"

Duncan P. N. Exon Smith dexonsmith at apple.com
Mon Apr 6 14:30:23 PDT 2015


Author: dexonsmith
Date: Mon Apr  6 16:30:23 2015
New Revision: 234225

URL: http://llvm.org/viewvc/llvm-project?rev=234225&view=rev
Log:
Revert "DebugInfo: Loosen DILexicalBlock constructor"

This reverts commit r234222, while I look into bot failures [1].  I'll
recommit soon.

[1]: http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_check/7117/

Modified:
    llvm/trunk/include/llvm/IR/DebugInfo.h

Modified: llvm/trunk/include/llvm/IR/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfo.h?rev=234225&r1=234224&r2=234225&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/IR/DebugInfo.h Mon Apr  6 16:30:23 2015
@@ -704,7 +704,7 @@ public:
 class DILexicalBlock : public DIScope {
 public:
   explicit DILexicalBlock(const MDNode *N = nullptr) : DIScope(N) {}
-  DILexicalBlock(const MDLexicalBlockBase *N) : DIScope(N) {}
+  DILexicalBlock(const MDLexicalBlock *N) : DIScope(N) {}
 
   MDLexicalBlockBase *get() const {
     return cast_or_null<MDLexicalBlockBase>(DIDescriptor::get());
@@ -745,12 +745,10 @@ public:
     return *get();
   }
 
-  DIScope getContext() const { return get()->getScope(); }
+  DIScope getContext() const { return getScope(); }
   unsigned getLineNumber() const { return getScope().getLineNumber(); }
   unsigned getColumnNumber() const { return getScope().getColumnNumber(); }
-  DILexicalBlock getScope() const {
-    return dyn_cast<MDLexicalBlockBase>(get()->getScope());
-  }
+  DILexicalBlock getScope() const { return DILexicalBlock(get()->getScope()); }
   unsigned getDiscriminator() const { return get()->getDiscriminator(); }
 };
 
@@ -1052,9 +1050,11 @@ public:
     // Since discriminators are associated with lexical blocks, make
     // sure this location is a lexical block before retrieving its
     // value.
-    if (auto *F = dyn_cast<MDLexicalBlockFile>(get()->getScope()))
-      return F->getDiscriminator();
-    return 0;
+    return getScope().isLexicalBlockFile()
+               ? DILexicalBlockFile(
+                     cast<MDNode>(cast<MDLocation>(DbgNode)->getScope()))
+                     .getDiscriminator()
+               : 0;
   }
 
   /// \brief Generate a new discriminator value for this location.





More information about the llvm-commits mailing list