From 1114e434b00f9559408610488fe2bde596f2cfbd Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Mon, 6 Apr 2015 21:30:23 +0000 Subject: [PATCH] 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/ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234225 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/IR/DebugInfo.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/llvm/IR/DebugInfo.h b/include/llvm/IR/DebugInfo.h index 24dd02056ad..2fa68982ac8 100644 --- a/include/llvm/IR/DebugInfo.h +++ b/include/llvm/IR/DebugInfo.h @@ -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(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(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(get()->getScope())) - return F->getDiscriminator(); - return 0; + return getScope().isLexicalBlockFile() + ? DILexicalBlockFile( + cast(cast(DbgNode)->getScope())) + .getDiscriminator() + : 0; } /// \brief Generate a new discriminator value for this location. -- 2.34.1