DebugInfo: Drop confusing forwarding API from DILexicalBlockFile
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Mon, 6 Apr 2015 22:07:46 +0000 (22:07 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Mon, 6 Apr 2015 22:07:46 +0000 (22:07 +0000)
Remove `DILexicalBlockFile::getScope()` (whose last use was removed from
clang in r234245), which illegally returned a `DILexicalBlock` despite
its scope sometimes being an `MDSubprogram`.  Also remove the
`getLineNumber()` and `getColumnNumber()` methods that just forwarded to
`DILexicalBlock`'s versions, since there don't seem to be any callers.

Note that the block of code removed from `DebugInfo.cpp` was actually
dead code, since `isLexicalBlock()` (the previous branch) always returns
true when `isLexicalBlockFile()` returns true.

An earlier (broken and untested) version of this was squashed into
r234222 and reverted in r234225.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234246 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/DebugInfo.h
lib/IR/DebugInfo.cpp

index c204058763334a42014979ed3b10c5f81125ef5a..f851be737dfa2eb8d1651a0a1b89b34c2e687f08 100644 (file)
@@ -745,10 +745,7 @@ public:
     return *get();
   }
 
-  DIScope getContext() const { return getScope(); }
-  unsigned getLineNumber() const { return getScope().getLineNumber(); }
-  unsigned getColumnNumber() const { return getScope().getColumnNumber(); }
-  DILexicalBlock getScope() const { return DILexicalBlock(get()->getScope()); }
+  DIScope getContext() const { return get()->getScope(); }
   unsigned getDiscriminator() const { return get()->getDiscriminator(); }
 };
 
@@ -1050,11 +1047,9 @@ public:
     // Since discriminators are associated with lexical blocks, make
     // sure this location is a lexical block before retrieving its
     // value.
-    return getScope().isLexicalBlockFile()
-               ? DILexicalBlockFile(
-                     cast<MDNode>(cast<MDLocation>(DbgNode)->getScope()))
-                     .getDiscriminator()
-               : 0;
+    if (auto *F = dyn_cast<MDLexicalBlockFile>(get()->getScope()))
+      return F->getDiscriminator();
+    return 0;
   }
 
   /// \brief Generate a new discriminator value for this location.
index 1ad9dcae3ad73bc0864904fed69ef37349282fad..8ae2bcb84856f283a2279d712f16dc30117b44d0 100644 (file)
@@ -498,9 +498,6 @@ void DebugInfoFinder::processScope(DIScope Scope) {
   if (Scope.isLexicalBlock()) {
     DILexicalBlock LB(Scope);
     processScope(LB.getContext());
-  } else if (Scope.isLexicalBlockFile()) {
-    DILexicalBlockFile LBF = DILexicalBlockFile(Scope);
-    processScope(LBF.getScope());
   } else if (Scope.isNameSpace()) {
     DINameSpace NS(Scope);
     processScope(NS.getContext());